<% Userinfro u = bc.editUser(uid);
System.out.println("jsp "+u.getIntId());%><a href="showUserinfroAction.action?UserID=<s:property value="#u.getIntId()"/>">个人信息</a></span>上面的输出可以获取当前用户的ID,为什么下面传参数过去是空的?请教高手!
System.out.println("jsp "+u.getIntId());%><a href="showUserinfroAction.action?UserID=<s:property value="#u.getIntId()"/>">个人信息</a></span>上面的输出可以获取当前用户的ID,为什么下面传参数过去是空的?请教高手!
这样
bbs.jsp(59,46) According to TLD or attribute directive in tag file, attribute value does not accept any expressions
表达式写法不对
后来那个写法还是显示According to TLD or attribute directive in tag file, attribute value does not accept any expressions
是struts2的标签
<% Userinfro u = bc.editUser(uid);
request.setAttribute("u",u);
%>
在网址栏上显示已经取得ID号 在Action里面怎么取得获得的ID号?代码怎么写呢?
我在action里面定义了一个UserId System.out.println(UserId);输入是0
Action中如果有一个UserID变量
private int UserID;
//get set方法
再直接使用变量即可
或者
private User user;//前提是User类中有UserID属性
//get set方法
通过user.getUserId()即可
18楼
private int UserID;
System.out.println(UserID);这个输入的是0喔。但是在地址栏中可以看见UserId='111'
20楼
在action中,插入request.getParameter("UserID"),提示request cannot be resolved
你既然这里的参数是uid,那你在获取的时候就用request.getParameter("uid"),就可以得到,
request的获取方法:HttpServletRequest request=ServletActionContext.getRequest();
谢谢了