iframe里的页面跳转不行?
在做简单的考试系统时碰到的问题:
我在会话里存入生成的考试题目,按“下一题”显示一道题目
JSP里用btclick事件用jquery:
springACTION里:
return new ModelAndView("student/test");跳转到student/test.jsp没反应
我单步执行,question的值是对的,就是显示不出来。
jsp里:
还有就是JSP放在iframe里。
我在会话里存入生成的考试题目,按“下一题”显示一道题目
JSP里用btclick事件用jquery:
$("#btNext").click(function(){
answer = $("input[name='answerId']:checked").val();
pos = $("input[name='pos']").val();
utid = $("input[name='utid']").val();
alert("pos: "+pos+" utid: "+utid);
if(null == answer || "undefined" == answer){
alert("请选择题目,不能为空!");
return ;
}else{
$.ajax({
type: 'POST',
url: 'updateUT.do',
data: {'pos':Number(pos+1),'act':'next','utid':utid,'answer':answer}
});
}
});
springACTION里:
public ModelAndView updateUT(HttpServletRequest request,
HttpServletResponse response) throws Exception {
//上一题,下一题,完成
String act = (request.getParameter("act")==null)?"next":request.getParameter("act");
String utid = request.getParameter("utid");
int pos = (request.getParameter("pos")==null)?0:Integer.parseInt(request.getParameter("pos")); //位置
String answer = (request.getParameter("answer")==null)?" ":(String)(request.getParameter("answer"));
System.out.println("------------------"+utid+" ****** "+pos+" "+answer);
//下一题
if(act.equals("next")){
//保存答案
//显示下一题
List qs = (request.getSession().getAttribute("qs")==null)?null:(List)request.getSession().getAttribute("qs"); //qL是题目集
if(qs.size()>0){
pos = (pos >= (qs.size()-1))?qs.size():pos;
request.getSession().setAttribute("question", qs.get(pos));
}
request.getSession().setAttribute("pos", pos);
return new ModelAndView("student/test");
}else if(act.equals("pre")){ //上一题
}
return null;
return new ModelAndView("student/test");跳转到student/test.jsp没反应
我单步执行,question的值是对的,就是显示不出来。
jsp里:
<form name="form1">
<table align="center" cellspacing='0' cellpadding='0' border="1" style="font-size: 14px;border: 1px solid #ccc;width:100%;">
<tr>
<td>题目名称:${sessionScope.question.subject}</td>
</tr>
<tr>
<td><input type="radio" name="answerId" value="A"/>选项A:${sessionScope.question.option1}</td>
</tr>
<tr>
<td><input type="radio" name="answerId" value="B"/>选项B:${sessionScope.question.option2}</td>
</tr>
<tr>
<td><input type="radio" name="answerId" value="C"/>选项C:${sessionScope.question.option3}</td>
</tr>
<tr>
<td><input type="radio" name="answerId" value="D"/>选项D:${sessionScope.question.option4}</td>
</tr>
<tr><td>
<input type="hidden" name="utid" id="utid" value="${sessionScope.question.id}"/>
<input type="hidden" name="pos" id="pos" value="${sessionScope.pos}"/>
<input type="button" name="btPre" id="btPre" value="<" style="width:50px;height:25px;"/>
<input type="button" name="btNext" id="btNext" value=">" style="width:50px;height:25px;"/>
<input type="button" name="btOk" id="btOk" value="完成" style="width:50px;height:25px;"/>
</td></tr>
</table>
</form>
还有就是JSP放在iframe里。
...全文
相关推荐
JS页面跳转和js对iframe进行页面跳转、刷新
JS页面跳转和js对iframe进行页面跳转、刷新
HTML阻止iframe跳转页面并使用iframe在页面内嵌微信网页版的实现方法
就想弄一个winform结合html5的一个小东西,突有心血来潮,想在里面嵌套一个微信网页版,下面小编给大家介绍下HTML阻止iframe跳转页面并使用iframe在页面内嵌微信网页版的实现方法,一起看看吧
Iframe页面请求跳转问题解决
首先在父页面的javascript给定义一个window.name,并赋予一个字符串值,如window.name="test",其中赋予的字符串值可以随意定义,然后在Iframe页面的Form 标签中定义target属性,并且其值也必须与之前定义的window.name的值相同,即<form method="post" target="test" >,在子页面提交后即可刷新父页面跳转到指定的请求页面. 此资源由网友提供。谢谢!
Android WebView拦截iframe标签内部跳转教程
主要介绍了Android WebView拦截iframe标签内部跳转教程,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
iframe 实现页面跳转 动态改变主题
虽然不是我开发的,但是,好东西,还是要和大家分享,主要是我的资源分只有个位数了,大家支持一下,呵呵,


Web 开发
