当前页面: 开发资料首页 → JSP 专题 → request.getParameter获得的值怎样不通过GET/POST方式,而通过JSP动态生成,高分急等
request.getParameter获得的值怎样不通过GET/POST方式,而通过JSP动态生成,高分急等
摘要: request.getParameter获得的值怎样不通过GET/POST方式,而通过JSP动态生成,高分急等
因为现在有一个第三方控件获得的一个参数是用request.getParameter方式。而该调用没有前一jsp,现在其它setAttribute的值都通过办法搞定了,getParameter方式的值如何通过程序来设置呀?
路过,顶下
把它改成session,就能动态设置参数值了
用javax.servlet.http.HttpServletRequestWrapper。
javax.servlet.http.HttpServletRequestWrapper reqa=new javax.servlet.http.HttpServletRequestWrapper((HttpServletRequest)request);
ding
up
up
接分
up
加一个隐藏域
upup,还是不行啊
to:wmzsl(王明哲)
加一个隐藏域要提交后在下一jsp生效,我要改变当前jsp,而且当前jsp经过连续两步struts Atcion跳转(也就是ActionForward指定到xxx.do了),所有的表单参数都丢失了,不行
to:pigo()
HttpServletRequestWrapper只能用在Filter吧?我要在jsp里用,能行吗?
to:ruanjiantaotao(涛涛)
我就是不想改那第三方控件的源码,不然的话早修改成getAttribute了
首先 xx.do 里面是通过 mapping.forward("path") 转过去的.数据会随着request带过去.
在action 里面用request.setAttribute(request.getParameter("xx"))
页面里面就用 request.getRequestDispatcher("path").forward(request,response)
to 楼上:
request.setAttribute(request.getParameter("xx"));
这不是把getParameter的表单对象转移到Bean对象了吗?下一个页面通过getParameter可以得到吗?
request.getRequestDispatcher("path"+"?pram="+request.getParameter("xx"));).forward(request,response)
错了. 应该这样这样,刚多写了一个 ";"
request.getRequestDispatcher("path?pram="+request.getParameter("xx")).forward(request,response)
自己写一个request实现HttpServletRequest接口,实现getParameter方法,在jsp里把request封装进去。
呆会去试试..
//HttpServletRequestWrapper只能用在Filter吧?我要在jsp里用,能行吗?
也是可以的阿
可以的