Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-3561

Struts2.1.8 use Tiles not to support chinese(Internationalization I18n)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Implemented
    • 2.1.8
    • None
    • None
    • None
    • Windows XP, Eclipse, Tomcat6.0.14, Struts2.1.8, Maven

    • Important

    Description

      When I use struts2-core-2.1.8.jar and struts2-tiles-plugin-2.1.8.jar to test a jsp which it needs I18n support for chinese, there are ApplicationResources_en_US.properties and ApplicationResources_zh_CN.properties in classpath. If I use tiles, for example
      <s:textfield name="userName" key="label.username" id="userName" />
      The chinese will be produced disorder code (???) in the page

      I use this command native2ascii -encoding UTF-8 a.txt ApplicationResources_zh_CN.properties. And all jsps adopt uniform charset (utf-8)
      <%@ page contentType="text/html; charset=UTF-8 pageEncoding="UTF-8"%>

      Please refer to the following Struts.xml
      <struts>
      <constant name="struts.enable.DynamicMethodInvocation"
      value="false" />
      <constant name="struts.devMode" value="false" />
      <constant name="struts.custom.i18n.resources"
      value="ApplicationResources" />

      <package name="default" extends="struts-default" namespace="/">
      <result-types>
      <result-type name="tiles"
      class="org.apache.struts2.views.tiles.TilesResult" />
      </result-types>
      <action name="login"
      class="net.viralpatel.struts2.LoginAction">
      <result name="success" type="tiles">/welcome.tiles</result>
      <result name="error">Login.jsp</result>
      </action>
      <action name="customer"
      class="net.viralpatel.struts2.CustomerAction">
      <result name="success" type="tiles">/customer.success.tiles</result>
      <result name="input" type="tiles">/customer.tiles</result>
      </action>
      <action name="customer-form">
      <result name="success" type="tiles">/customer.tiles</result>
      </action>
      </package>
      </struts>

      But when I do not use tiles, these jsps will display correctly
      Please refer to the Struts.xml

      <struts>
      <constant name="struts.enable.DynamicMethodInvocation"
      value="false" />
      <constant name="struts.devMode" value="false" />
      <constant name="struts.custom.i18n.resources"
      value="ApplicationResources" />

      <package name="default" extends="struts-default" namespace="/">
      <action name="login"
      class="net.viralpatel.struts2.LoginAction">
      <result name="success">Welcome.jsp</result>
      <result name="error">Login.jsp</result>
      </action>
      <action name="customer"
      class="net.viralpatel.struts2.CustomerAction">
      <result name="success" >Customer.jsp</result>
      <result name="input">Customer.jsp</result>
      </action>
      <action name="customer-form">
      <result name="success">Customer.jsp</result>
      </action>
      </package>
      </struts>

      Attachments

        1. StrutsHelloWorld.rar
          8 kB
          keming.hu

        Activity

          People

            Unassigned Unassigned
            grandhkm keming.hu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: