<% Userinfro u = bc.editUser(uid);
    System.out.println("jsp                                     "+u.getIntId());%><a href="showUserinfroAction.action?UserID=<s:property value="#u.getIntId()"/>">个人信息</a></span>上面的输出可以获取当前用户的ID,为什么下面传参数过去是空的?请教高手!

解决方案 »

  1.   

    换成这个试试:<a href="showUserinfroAction.action?UserID=<s:property value="<%=u.getIntId()%>" />">
      

  2.   

    这个试过了,也不行! Userinfro u是个用户的对象。
      

  3.   

    <a href="showUserinfroAction.action?UserID="+<s:property value='<%=u.getIntId()%>'+"/>">
    这样 
      

  4.   

    <a href="showUserinfroAction.action?UserID=<s:property value="${u.intId}>" />">
      

  5.   

    <a href="showUserinfroAction.action?UserID='<s:property value='${u.intId}>'/>'"></a>
      

  6.   

    4楼
    bbs.jsp(59,46) According to TLD or attribute directive in tag file, attribute value does not accept any expressions
    表达式写法不对
      

  7.   

    <a href="showUserinfroAction.action?UserID=<s:property value='#u.intId'/>"></a>
      

  8.   

    4楼  
    后来那个写法还是显示According to TLD or attribute directive in tag file, attribute value does not accept any expressions
      

  9.   

    请问你这个是什么标签?是struts2 标签吗?如果对struts2标签库不熟悉的话 尽量别使用。等弄懂了之后再使用,你可以选择用EL。直接${u.userId};
      

  10.   

    EL是什么?我没有学过。
    是struts2的标签
      

  11.   

    <a href="showUserinfroAction.action?UserID=<s:property value='#{u.intId}'/>"></a>
      

  12.   


    <% Userinfro u = bc.editUser(uid);
       request.setAttribute("u",u);
    %>
      

  13.   

    <a href="showUserinfroAction.action?UserID='${u.intId}'/>"></a>,不要用<s:property>标签了!
      

  14.   

    15楼
    在网址栏上显示已经取得ID号  在Action里面怎么取得获得的ID号?代码怎么写呢?
      

  15.   

    15楼
    我在action里面定义了一个UserId System.out.println(UserId);输入是0
      

  16.   

    如果你的UserID已经取到了的话,在Action中,只在有对应的UserID属性就可以取到这个值,或者有这个属性对应的对象,都是可以的,不过要有属性或对应的get,set方法哈
    Action中如果有一个UserID变量
    private int UserID;
    //get set方法
    再直接使用变量即可
    或者
    private User user;//前提是User类中有UserID属性
    //get set方法
    通过user.getUserId()即可
      

  17.   


    18楼
    private int UserID;
    System.out.println(UserID);这个输入的是0喔。但是在地址栏中可以看见UserId='111'
      

  18.   

    在action中,request.getParameter("UserID")就可以得到了!
      

  19.   

    <a href="showUserinfroAction.action?UserID='u.intId'">
      

  20.   


    20楼
    在action中,插入request.getParameter("UserID"),提示request cannot be  resolved
      

  21.   

    <a href="showUserinfroAction.action?UserID=<s:property value="#u.getIntId()"/>">UserID变成小写例:userId
      

  22.   

    http://localhost:8080/bss/showUserinfroAction.action?uid='111'/>这里显示了,怎么在ACTION里面打印输出是0呢?
      

  23.   


    你既然这里的参数是uid,那你在获取的时候就用request.getParameter("uid"),就可以得到,
    request的获取方法:HttpServletRequest request=ServletActionContext.getRequest();
      

  24.   

    用这样的方法可以正确显示了<a href="showUserinfroAction.action?uid=${u.intId}">。
    谢谢了