当前位置: 代码迷 >> Java Web开发 >> 在精通struts的例子里加了个文本框password,但显示的还是username内容,而不是password提交的内容,如何回师?
  详细解决方案

在精通struts的例子里加了个文本框password,但显示的还是username内容,而不是password提交的内容,如何回师?

热度:43   发布时间:2016-04-17 16:56:43.0
在精通struts的例子里加了个文本框password,但显示的还是username内容,而不是password提交的内容,怎么回师?????
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;
  相关解决方案