我正在使用jsf 1.1和icefaces 1.8。我有一个PartsInv.jsp页面和一个托管的PartsInv.java bean。我已经尝试了几个基于我碰到的谷歌点击的课程,并且感觉自己越来越接近了,但我无法完全理解它。这是我有:如何获取查询字符串
HttpServletRequestWrapper hsrw;
String rcVal = hsrw.getAttribute("rc").toString();
当然hsrw
,但没有正确实例化。我真的不知道如何(或者什么绕到它)。任何帮助,将不胜感激。
编辑:基于Jigar的回答,我已经更新了我的代码如下:
HttpServletRequest hsr = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
if(hsr.getAttribute("rc") != null)
{
try
{
int rc = Integer.parseInt(hsr.getAttribute("rc").toString());
this.SOM_RC.setValue(rc);
this.changeRC(null);
}
catch(NumberFormatException nfe)
{
this.lblStatus.setValue("eASP error, please see an administrator.");
return;
}
}
EDIT2:好了,我使用了错误的方法。 hsr.getParameter()
的伎俩
非常感谢!我欠你一个;) –
欢迎您也考虑麦道的 –