高分求教!!

ml457 2003-05-10 05:35:51
高分求教!!

想做一个试题库选题页面(create.jsp),代码如下:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>选题</title>
</head>
<%
int pid=1;
if(request.getParameter("pid")!=null)
{ pid=Integer.parseInt(request.getParameter("pid"));

}
%>
<body>
<form action="create.jsp" method="post" name="form1" target="_self" onSubmit="return check();">
<table width="100%" height="90%" border="1">
<tr>
<th height="25" colspan="2" nowrap>选题第 <%=pid%> 步</th>
</tr>
<tr>
<th height="60" rowspan="2" nowrap>请输入第<%=pid%>大题题头</th>
<th width="65%" height="35" nowrap> <input name="test_name" type="text" id="test_name" value="题头" size="45" maxlength="50">
</th>
</tr>
<tr>
<th height="25" nowrap><font color="#0066FF">例如:一、选择题(共10小题,20分)</font></th>
</tr>
<tr>
<td colspan="2"><table width="100%" height="100%" border="1">
<tr>
<th width="20%" nowrap>试题类型</th>
<td width="69%" rowspan="2"> <table width="100%" height="100%" border="1">
<tr>
<th width="35%" nowrap>难度为A</th>
<th width="31%" nowrap> <input name="numA" type="text" id="numA" value="0" size="6" maxlength="2">
道</th>
<th width="34%" nowrap> <input name="scoreA" type="text" id="scoreA" value="0" size="6" maxlength="2">
分</th>
</tr>
<tr>
<th nowrap>难度为B</th>
<th nowrap> <input name="numB" type="text" id="numB" value="0" size="6" maxlength="2">
道</th>
<th nowrap> <input name="scoreB" type="text" id="scoreB" value="0" size="6" maxlength="2">
分</th>
</tr>
<tr>
<th nowrap>难度为C</th>
<th nowrap> <input name="numC" type="text" id="numC" value="0" size="6" maxlength="2">
道</th>
<th nowrap> <input name="scoreC" type="text" id="scoreC" value="0" size="6" maxlength="2">
分</th>
</tr>
</table></td>
<th width="11%" rowspan="2" nowrap> <input type="reset" name="Submit" value="重置">
</th>
</tr>
<tr>
<th nowrap> <select name="test_type" id="test_type">
<option value="0" selected>请选择</option>
<option value="1">选择题</option>
<option value="2">填空题</option>
<option value="3">判断题</option>
<option value="4">名词解释</option>
<option value="5">读成问答</option>
<option value="6">编程题</option>
</select> </th>
</tr>
</table></td>
</tr>
<tr>
<th height="40" colspan="2" nowrap>
<% if((pid-1)>0)
{
%>
<a href=create_paper1.jsp?pid=<%=pid-1%>>上一步</a>
<%
}
%>

<% if((pid+1)<7)
{
%>
<input type="hidden" name="numA" value="0">
<a href=create_paper1.jsp?pid=<%=pid+1%> onClick="return check();">下一步</a>
<%
}
%>    
<input type="submit" name="Submit2" value="完成">
</th>
</tr>
</table>
</form>
</body>
</html>
想通过点击链接"下一步"对其他题型进行设置,同时将上一步设置存在session中。最后点击“完成”提交当时页面的表单(这时才使用另一个.jsp文件),配合session中存储的内容对数据库进行操作。问题是怎么在点击“下一步”的同时将目前表单对象中的参数存入session.(即如何不经过提交表单来获得其中的参数??)
...全文
93 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
vip007 2003-05-12
  • 打赏
  • 举报
回复
怎么得到上一步的设置呢??
aleccheung 2003-05-12
  • 打赏
  • 举报
回复
支持: beyond_xiruo(乱谈情)
/**
这样的话何必用到session,直接将上一步设置的东西保存在hidden里不就行了吗,而且这些都可以在客户端完成,根本不需要提交表单
*/
vip007 2003-05-11
  • 打赏
  • 举报
回复
To beyond_xiruo(乱谈情):请问怎么将上一步的设置保存在hidden里面??没有提交表单用什么语句获取表单对象的值??请举些例子好吗??谢了!
vip007 2003-05-11
  • 打赏
  • 举报
回复
大家帮帮忙!!
希偌 2003-05-10
  • 打赏
  • 举报
回复
这样的话何必用到session,直接将上一步设置的东西保存在hidden里不就行了吗,而且这些都可以在客户端完成,根本不需要提交表单
wsj 2003-05-10
  • 打赏
  • 举报
回复
sorry:

<a href="javascript:void(0)" onClick="if(check()){form1.action='save_paper1.jsp?pid=<%=pid+1%> ';form1.submit();}">下一步</a>
wsj 2003-05-10
  • 打赏
  • 举报
回复
<a href="javascript:void(0)" onClick="if(check())this.submit='save_paper1.jsp?pid=<%=pid+1%> '">下一步</a>


save_pager1.jsp
---------

if(Saved)
redirect "create_paper1.jsp?pid=thenextpid"


81,087

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧