日期:2014-05-18  浏览次数:20731 次

初學Struts,有點問題,大家看看,在頁面上輸入一個姓名,然後返回到該頁面
jsp頁面
<%@   page   contentType= "text/html;charset=utf-8 "   language= "java "   pageEncoding= "utf-8 "   %>
<%@   taglib   uri= "http://jakarta.apache.org/struts/tags-html "   prefix= "html "   %>
<%@   taglib   uri= "/tstiTagLib "   prefix= "tsti "   %>
<%@   taglib   uri= "http://jakarta.apache.org/struts/tags-logic "   prefix= "logic "   %>
<%@   taglib   uri= "http://jakarta.apache.org/struts/tags-bean "   prefix= "bean "   %>

<script>
        message= <%=request.getAttribute( "message ")%> ;
                        if(message!= " "&&message!=null)
                        alert(message);
</script>

<html>
    <head> <title> alert   test </title>
  <script   language= "javascript ">
                function   __doPostBack(method)   {
                        var   thisForm   =   document.forms[0];
                        thisForm.method.value   =   method;              
                                thisForm.submit();

                }
</script>
    </head>
    <body>
<html:form   action= "/A_action ">
    <table>
            <tr> <td> 姓名   </td>
                    <td> <html:text   property= "name "/> </td>
            </tr>
            <tr> <td   align= "center ">
                    <input   type= "button "   value= "go "   onClick= "__doPostBack( 'btn_Submit ') ">
            </td> </tr>
    </table>
      </html:form>
    </body>

</html>
form為:
package   tsti.ctust.aam.rgm.form;
import   org.apache.struts.action.ActionForm;

/**
  *   Created   by   IntelliJ   IDEA.
  *   User:   Administrator
  *   Date:   2007/1/30
  *   Time:   上午   11:50:55
  *   To   change   this   template   use   File   |   Settings   |   File   Templates.
  */
public   class   A_form   extends   ActionForm   {
        public   String   getName()   {
          &n