1
我想传递一个参数,并通过标记保存用户名。<html:link>传递参数
在corrosponding动作类中,我使用request.getParameter()函数检索参数,但是我将该值作为null。这里是我的代码
<%
String username="aniket";
request.setAttribute("username",username);
%>
<html:link action="AllResidentInfo.do" paramName="username" paramProperty="username">All Resident's Info</html:link>
我在做什么错
如果我PARAMNAME含有具有“用户名”,吸气二传手怎么一回事,因为如果我这样做,你告诉我,它让我有错误的JSP文件的名称作为“没有getter方法的属性:”username“bean:”username“ –
JSP没有getter和setter,我不明白你在问什么,'paramId'是请求参数的名字。 paramName是包含参数值的请求属性的名称,所以如果paramId是“foo”,paramName是“bar”,并且你有一个包含字符串“hello”的请求属性名称“bar”,它会生成链接'AllResidentInfo.do?foo = hello'。所以,你的脚本代码示例上面的sould会生成'AllResidentInfo.do?username = aniket' –
ya,我做了你告诉我的,但它仍然给我错误,无法在任何范围内找到bean:username。 –