首先在servlet里面使用
String qid="123",aid="456";
request.setAttribute("qid",qid);
request.setAttribute("aid",aid);
request.getRequestDispatcher("index.jsp").forward(request,response);在index.jsp页面里<input name="qid" value="${requestScope.qid}">
<input name="aid" value="${requestScope.aid}">遇到问题如下:
第一次执行,index.jsp的两个文本框里显示了123 456
但是一刷新,就没有值显示了
为什么呀?
String qid="123",aid="456";
request.setAttribute("qid",qid);
request.setAttribute("aid",aid);
request.getRequestDispatcher("index.jsp").forward(request,response);在index.jsp页面里<input name="qid" value="${requestScope.qid}">
<input name="aid" value="${requestScope.aid}">遇到问题如下:
第一次执行,index.jsp的两个文本框里显示了123 456
但是一刷新,就没有值显示了
为什么呀?
还是不行哦
我在servlet里面写了System.out.print(request.getParameter("qid"));显示的是null没有取到<input name="qid" value="${requestScope.qid}">这个对象....???
你看一下,你的url
我没有把值放在url里
就直接在servlet里用request.getParameter()取的值
如果用session application等作用域 可以实现楼主的想法
我是通过提交表单,进而请求servlet的。
谢谢大家咯!!