正在加载图片...
</html: form 2.3.2 Struts国际化处理 为了方便的使一个页面多个不同语言的人都能看懂 Struts提供了很好的国际化语言处理解 决方法。 首先,我们删除了原来 Struts添加时产生的 Application Resources. properties文件,而是在 src目录下新建了两个文件,如下图所示 e struts b action b bean s dao b C form e service E Application ResourcesCN properties E Application ResourcesEN properties 然后我们将这两个文件配置到 struts-config. m中 <message-resources parameter="ApplicationResourcescN"/> <message-resources parameter=""ApplicationResourcesEn"/ 这里的 parameter是指语言文件所在的目录。 然后我们修改登录页面为: <html: form action="userAction do?action=login"method="post"> <table align="center"> <tr> <td><bean: message key="user userlogin. jsp username"/ td><html: text property="username" value=""/></td> </tr> <tr> <td><bean: message key="user userlogin. jsp. userpassword"/>: </td> <td><html: password property="password" value=""/></td> </t <td><html: submit/></td> <td><html et/x</td> </table> </html: form> 这里的用户名和密码都换掉成了,使用 struts的bean标签的 message元素。 然后我们分别在 Application ResourcesCN. properties文件和 Application ResourcesEN properties 文件中,添加页面key所对应的键值对11 </html:form> 2.3.2Struts 国际化处理 为了方便的使一个页面多个不同语言的人都能看懂 Struts 提供了很好的国际化语言处理解 决方法。 首先,我们删除了原来 Struts 添加时产生的 ApplicationResources.properties 文件,而是在 src 目录下新建了两个文件,如下图所示。 然后我们将这两个文件配置到 struts-config.xml 中。 <message-resources parameter="ApplicationResourcesCN"/> <message-resources parameter="ApplicationResourcesEN"/> 这里的 parameter 是指语言文件所在的目录。 然后我们修改登录页面为: <html:form action="userAction.do?action=login" method="post" > <table align="center"> <tr> <td><bean:message key="user.userlogin.jsp.username"/>: </td> <td><html:text property="username" value=""/></td> </tr> <tr> <td><bean:message key="user.userlogin.jsp.userpassword"/>: </td> <td><html:password property="password" value=""/></td> </tr> <tr> <td><html:submit/></td> <td><html:reset/></td> </tr> </table> </html:form> 这里的用户名和密码都换掉成了,使用 struts 的 bean 标签的 message 元素。 然后我们分别在 ApplicationResourcesCN.properties 文件和 ApplicationResourcesEN.properties 文件中,添加页面 key 所对应的键值对
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有