现有如下的代码:
<display:column property="compid" title='COMPID' sortable="true"></display:column>
我现在想在上面的代码title=''中实现国际化,想使用<bean:write key = ""/>
title='<bean:write key = ""/>'但是识别不了,请问该怎么解决?

解决方案 »

  1.   

    <%@ taglib uri="/WEB-INF/displaytag-11.tld" prefix="display" %>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
    <%@ page language="java" pageEncoding="GB2312" %>
    <html>
    <head><link rel="stylesheet" href="css/screen.css" type="text/css" media="screen, print" />
    </head>
    <body>
    <html:link action="/listBook.do?method=listAllBook"><bean:message key="goal.home"/></html:link>
    <fmt:setLocale value="${sessionScope.key_local}"/>
    <fmt:setBundle basename="application"/>
    <display:table name="orders" pagesize="${applicationScope.pageSize}" export="true" id="row" requestURI="${requestScope.requestURL}" >
      <display:column property="book.name" titleKey="book.name" sortable="true"/>
      <display:column property="count" titleKey="car.bookCount" sortable="true"/>
         <display:column property="money" titleKey="car.money" sortable="true"/>
         <display:column titleKey="order.date" sortable="true">
          <fmt:formatDate value="${row.date}" type="DATE" dateStyle="long" />
         </display:column>      
      <display:setProperty name="basic.empty.showtable" value="true" />
      <display:setProperty name="export.pdf" value="true" />
    </display:table>
    </body>
    </html>
    支持国际化的,只是使用kstl的,使用titleKey
      

  2.   

    写错了jstl.如果已经引入了struts,那么肯定是使用struts的locale,可以从struts得到Local对象以后传递给jstl
      

  3.   

    非常感谢楼上的朋友,我写了displaytag.properties文件,在文件里加入了locale.provider=org.displaytag.localization.I18nStrutsAdapter这样就可以指定displaytag使用struts的资源文件了,但是不知道这两种方法有没有优缺点之分?如果用来做工程的话哪种更好一点?