jsp action怎么写 很简单

来源:百度知道 编辑:UC知道 时间:2024/05/27 10:00:17
一般表单里的action是怎么写的?
有的人写成./action 有的直接写的
还有 是用驼峰式呢 还是用像类那样的大写?
用myeclipse自成生成的servlet的xml 一般要做哪些改动

<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>/action</url-pattern>
</servlet-mapping>

表单中的action的写法:/action;和<url-pattern>标签中的值一致,myeclipse中生成的JSP页面开头都有String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

<head>标签内有<base href="<%=basePath%>">
如果<head>中没有上述内容,action写成<%=basePath%>/action最保险