hello.jsp
<%@ page contentType= "text/html;charset=gb2312 " language= "java " %>
<%@ taglib uri= "/WEB-INF/struts-bean.tld " prefix= "bean " %>
<%@ taglib uri= "/WEB-INF/struts-html.tld " prefix= "html " %>
<%@ taglib uri= "/WEB-INF/struts-logic.tld " prefix= "logic " %>
<!-- UTF-8-->
<html:html locale= "true ">
<head>
<title> <bean:message key= "hello.jsp.title "/> </title>
<html:base/>
</head>
<body bgcolor= "white "> <p>
<h2> <bean:message key= "hello.jsp.page.heading "/> </h2> <p>
<html:errors/> <p>
<logic:present name= "personbean " scope= "request ">
<h2>
<bean:message key= "hello.jsp.page.name "/>
<bean:write name= "personbean " property= "userName " /> ! <br> <!--personbean.java的getUserName()=hello weiqin -->
<bean:message key= "hello.jsp.page.ps "/>
<bean:write name= "personbean " property= "passWord " />
</h2>
</logic:present>
<html:form action= "/HelloWorld.do " > <!--focus= "userName " -->
<bean:message key= "hello.jsp.prompt.person "/>
<html:text property= "userName " size= "16 " maxlength= "16 "/> <!-- --> <br>
<bean:message key= "hello.jsp.prompt.ps "/>
<html:text property= "passWord " size= "16 " maxlength= "16 "/> <br>
<html:submit property= "submit " value= "Submit "/>
<html:reset/>
</html:form> <br>
<html:img page= "/struts-power.gif " alt= "Powered by Struts "/>
</body>
</html:html>
helloaction.java
package hello;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletResponse;