2 回答

TA貢獻(xiàn)1813條經(jīng)驗 獲得超2個贊
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>/action</url-pattern>
</servlet-mapping>
表單中的action的寫法:/action;和<url-pattern>標(biāo)簽中的值一致,myeclipse中生成的JSP頁面開頭都有String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
<head>標(biāo)簽內(nèi)有<base href="<%=basePath%>">
如果<head>中沒有上述內(nèi)容,action寫成<%=basePath%>/action最保險

TA貢獻(xiàn)1799條經(jīng)驗 獲得超6個贊
action=你需要提交到的servlet的地址。com.our.servlet.YourServlet是你的Servlet的類名,然后在Servlet mapping中你把這個Servlet映射到一個地址上面,而這個地址就是action后面要填的值。
添加回答
舉報