form表单提交到servlet无法捕获
登录后,我点击提交数据无法捕获left.jsp
<div id="menu">
<li>
<a href="../system/left.jsp#Menu=Menu5" onClick="DoMenu('Menu5')"><strong>教师考勤</strong>
</a>
<ul id="Menu5" class="collapsed">
<li>
<a href="../system/kaoqin/start_chkattend.jsp" target="I2">启动考勤</a>
</li>
<li>
<a href="../system/kaoqin/start_chkattend.jsp"
target="I2">考勤查看</a>
</li>
<li>
<a href="../login/kaoqin/orgUserList_jihua.jsp"
target="I2">考勤统计</a>
</li>
</ul>
</li>
</div>
<script src="../js/leftButton.js"></script>
<div id="bottom"></div>
</div>
点击 启动考勤跳到start_chkattend.jsp:
<%
String[] course = null;
String courseName = null;
if (session.getAttribute("course") != null) {
String str = session.getAttribute("course").toString();
course = str.split(",");
}
%>
<body>
<br>
<br>
<center>
<form name="form1" action="TeacherCourseServlet?action=active" method="post">
<table border="0" cellpadding="0" cellspacing="0" class="bg_table"
align="center">
<tr>
<td colspan="6" background="images/login_07.gif" class="tdys">
课程考勤启动
</td>
</tr>
<tr align="center">
<th class="td1">
<span class="style1">课程名</span>
</th>
<th class="td21">
<span class="style1" >
<select name=chsCourse style="width: 150px;">
<!-- 动态加载教师课程 -->
<%
if (course != null) {
for (int i = 0; i < course.length; i++) {
courseName = course[i];
%>
<option value="<%=courseName%>"><%=courseName%></option>
<%
}
}
%>
</select>
</span>
</th>
</tr>
<tr align="center">
<th class="td1">
<span class="style1">任课教师</span>
</th>
<th class="td21">
<span class="style1"><input
value='<%=user.getUserName()%>' readOnly
type=text name="teacher" /> </span>
</th>
</tr>
<tr align="center">
<th class="td1">
<span class="style1">考勤时间</span>
</th>
<th class="td21">
<span class="style1"><input
value="<%=new Date().toLocaleString()%>" readOnly type=text
name="kaoqin" /> </span>
</th>
</tr>
<tr align="center">
<th class="td1">
<span class="style1">课程时段</span>
</th>
<td class="td21">
<input class="courseTime" type="radio" name="courseTime"
value="上午" checked="checked" />
上午
<input class="courseTime" type="radio" name="courseTime"
value="下午" />
下午
<input class="courseTime" type="radio" name="courseTime"
value="晚上" />
晚上
</td>
</tr>
<tr align="center">
<th class="td1">
<span class="style1">课程节次</span>
</th>
<td class="td21">
<div id="am">
<input type="radio" name="coursePoint" checked="checked" value="1-2节"/>
1-2节
<input type="radio" name="coursePoint" value="3-4节" />
3-4节
<input type="radio" name="coursePoint" value="1-4节" />
1-4节
</div>
<div id="pm" style="display: none;">
<input type="radio" name="coursePoint" checked="checked" value="5-6节"/>
5-6节
<input type="radio" name="coursePoint" value="7-8节" />
7-8节
<input type="radio" name="coursePoint" value="5-8节" />
5-8节
</div>
<div id="night" style="display: none;">
<input type="radio" name="coursePoint" checked="checked" value="9-10节"/>
9-10节
</div>
</td>
</tr>
<tr>
<td colspan="6" class="tdys">
<input type="submit" class="btn" value="启动考勤"/>
</td>
</tr>
</table>
</form>
</center>
</body>
</html>
无法在"TeacherCourseServlet中获得数据,由于登录后我用servlet验证,然后点击启动考勤,在TeacherCourseServlet中无法获取表单数据,请大家指点下。 --------------------编程问答-------------------- 我怀疑是登录验证使用了servlet对后面使用servlet有影响。。。 --------------------编程问答-------------------- servlet配置的对吗 --------------------编程问答-------------------- 首先的你参数就不规范action="TeacherCourseServlet?action=active。
贴出web.xml的代码。自己好好debug是否有跑进去serlvet --------------------编程问答-------------------- 跳转时候URL地址的参数是否正确啊,能否写个测试页面直接带URL值传给SERVLET试试看。 --------------------编程问答-------------------- 你先输入servlet的地址栏看看能不能访问到对应的servlet --------------------编程问答-------------------- servlet地址栏正确,我单独测试通过。现给出web.xml
<!-- 教师课程Servlet -->
<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>TeacherCourseServlet</servlet-name>
<servlet-class>attend.servlet.TeacherCourseServlet</servlet-class>
</servlet>
<!-- 教师课程Servlet -->
<servlet-mapping>
<servlet-name>TeacherCourseServlet</servlet-name>
<url-pattern>/TeacherCourseServlet</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list> --------------------编程问答-------------------- action="TeacherCourseServlet?action=active"
form的action还能带参数???
补充:Java , Web 开发