日期:2014-05-20  浏览次数:20762 次

form action=""的问题
写了个表单提交action=""应该填什么
<servlet-mapping>
  <servlet-name>loginServlet</servlet-name>
  <url-pattern>/servlet/loginServlet</url-pattern>
  </servlet-mapping>
<servlet>
  <description>This is the description of my J2EE component</description>
  <display-name>This is the display name of my J2EE component</display-name>
  <servlet-name>loginServlet</servlet-name>
  <servlet-class>servlet.loginServlet</servlet-class>
  </servlet>
我的项目login 下有个servlet包,servlet包下有控制表单的loginServlet
<jsp:useBean id="userBean" class="bean.UserBean" scope="request"></jsp:useBean>
  <form action="/servlet/loginServlet" method="post" >
  用户名<input type="text" name="username" >
  <font color="red"><%=userBean.getErrorMsg("username") %></font><br>
  密码 <input type="text" name="password">
  <font color="red"><%=userBean.getErrorMsg("password") %></font><br>
  密码 <input type="text" name="idNumber">
  <font color="red"><%=userBean.getErrorMsg("idNumber") %></font><br>
  <input type="submit" value="提交">
  </form>

------解决方案--------------------
探讨
这样写试试: <form action="<%=path%>/servlet/loginServlet" method="post" >