- 提交表单action路径问题:
./表示当前目录
../表示父级目录
/表示根目录
在如下工程中
regist.html文件中有如下标签
当regist.html文件放在WebContent中时
<form class="loginForm" method="post" action="./RegistServlet">
<form class="loginForm" method="post" action="RegistServlet">可实现
当regist.html文件放在WebContent/static中时
<form class="loginForm" method="post" action="../RegistServlet">可实现
以上两种情况<form class="loginForm" method="post" action="/RegistServlet">均无法实现
注意:在jsp中,action href src 中的路径写绝对路径 如action="工程名称/RegistServlet",工程名可用EL表达式
${pageContext.request.contextPath}表示
错误提示:
Duplicate local variable conn重复定义变量conn;