1,建立一个MainAction.java
其中必须有这么一句代码实现跳转:
return mapping.findForward("main");
2.上面的那个main对应着struts-config.xml中的forward
5.main.jsp中的标签key是需要和ApplicationResources.properties文件中对应的
main.jsp.title=DENNIS.main.jsp.Dennis
main.jsp.welcome=Welcome.to.Dennis
修改struts的配置文件需要重启Tomcat,记住了,然后就会出现配置的响应的信息了。嘿嘿。刚开始看,慢慢学习,不论多困难,都会有进步的。
其中必须有这么一句代码实现跳转:
return mapping.findForward("main");
2.上面的那个main对应着struts-config.xml中的forward
<action
attribute="mainForm"
input="/main.jsp"
name="mainForm"
path="/main"
scope="request"
type="com.yourcompany.struts.action.MainAction">
<forward name="main" path="/main.jsp"></forward>
</action>
3.在main.jsp中用struts自带的标签,然后关联到ApplicationResources.properties文件
<head><title><bean:message key="main.jsp.title" /></title></head>
<body>
<h3>
<bean:message key="main.jsp.welcome" />
</h3>
</body>
4.在struts-config.xml中关联到ApplicationResources.properties文件中的
<message-resources parameter="com.yourcompany.struts.ApplicationResources" />5.main.jsp中的标签key是需要和ApplicationResources.properties文件中对应的
main.jsp.title=DENNIS.main.jsp.Dennis
main.jsp.welcome=Welcome.to.Dennis
修改struts的配置文件需要重启Tomcat,记住了,然后就会出现配置的响应的信息了。嘿嘿。刚开始看,慢慢学习,不论多困难,都会有进步的。
本文详细介绍了如何在Struts框架中进行配置以实现页面跳转,包括MainAction.java的编写、struts-config.xml的设置、main.jsp的标签使用以及ApplicationResources.properties文件的关联。
1808

被折叠的 条评论
为什么被折叠?



