在一个页面1.jsp中有一个form,form的action是2.jsp页面,target是1.jsp中的一个隐藏的iframe,在2.jsp中完成处理后会forward回1.jsp(为了防止页面刷新)现在问题是,在2.jsp中设置了一个request属性sizess
request.setAttribute("sizess","123");
request.getRequestDispatcher("1.jsp?q=102").forward(request, response);,在1.jsp中有这么一段
<%
Object errorinfo = request.getAttribute("sizess");
boolean erflag = false;
if ( errorinfo != null)
{
errorinfo = request.getAttribute("sizess").toString();
erflag = true;
out.println(errorinfo);
}
%>
<script language="JavaScript">
if (<%=erflag%>)
alert("<%=errorinfo%>");
</script>从2.jsp回到1.jsp以后,会成功地弹出对话框,对话框里是request里属性的内容(errorinfo),但是out.println(errorinfo却不能输出任何信息,如果加入
<%=errorinfo%> ,也会是空的,求指点
request.setAttribute("sizess","123");
request.getRequestDispatcher("1.jsp?q=102").forward(request, response);,在1.jsp中有这么一段
<%
Object errorinfo = request.getAttribute("sizess");
boolean erflag = false;
if ( errorinfo != null)
{
errorinfo = request.getAttribute("sizess").toString();
erflag = true;
out.println(errorinfo);
}
%>
<script language="JavaScript">
if (<%=erflag%>)
alert("<%=errorinfo%>");
</script>从2.jsp回到1.jsp以后,会成功地弹出对话框,对话框里是request里属性的内容(errorinfo),但是out.println(errorinfo却不能输出任何信息,如果加入
<%=errorinfo%> ,也会是空的,求指点
解决方案 »
- 新手问简单JSP问题!
- Tomcat+Mysql+eclipse+myeclipse最新的版本搭配是什么,现在用于J2EE开发的主要平台是什么?
- ajax是个什么东西啊,怎么玩的啊
- 问问题,送分啦
- 关于复选框多选删除的问题!!
- jsp初学者的群3809074
- mvc在实际工作中的使用
- 有关servlet奇怪的问题,急~~~~~~~~
- 在windows2000+tomcat+jsp下通过http访问怎么获得smil.jsp所在的路径
- 用ssm,随着页面增加,pojo复用率越来越低,开发人员经常会随意得根据页面展示要求去建类,怎么约束
- 怎么让外网访问局域中的tomcat项目?
- struts2 OGNL
问题在那个隐藏的iframe,其实弹出的对话框是iframe里的页面弹出的,因为隐藏了,所以页面看不见,让我误以为是原来的页面弹出来的,errorinfo在隐藏的iframe里其实是有输出的,我SB了