Menu

Multiple Parameters to display:column -Newbie

Help
2006-02-20
2012-10-09
  • Harish Kumar

    Harish Kumar - 2006-02-20

    HI All

    Im new to using displaytag. I have a struts application, in which im using the display tag to show the results of the SQL. I store my SQL results in an arraylist in the Action Class and store the arraylist in the session. the display tag code in the jsp is :

    <jsp:scriptlet>
    Object foo = session.getAttribute("userResults");
    </jsp:scriptlet>

    <display:table name="sessionScope.userResults" pagesize="5" decorator="org.displaytag.sample.Wrapper">

    &lt;display:column property=&quot;recId&quot; title=&quot;User ID&quot; href=&quot;userAction.do&quot; paramId=&quot;id&quot; /&gt;
    &lt;display:column sortable=&quot;true&quot; property=&quot;firstName&quot; /&gt;
    &lt;display:column property=&quot;lastName&quot; /&gt;
    &lt;display:column property=&quot;loginName&quot; /&gt;
    &lt;display:column sortable=&quot;true&quot; property=&quot;lastUpdated&quot; /&gt;
    

    </display:table>

    In this i need to add another display:column with title "Action", whose link should be as:

    http://server:8080/myApp/userAction.do?id="recId"&action="edit"

    That is I need to pass 2 parameters to the href.
    I have tried to c:out, but it is not working, just empty id.

    <display:column title="Action"> <a href="userAction.do?action=edit&id=<c:out
    value='${row.recId}'/>">Modify</a> </display:column>

    Alternatively, I also tried to use the decorator tag and tried to use:

    <display:column title="Action" property="link2" />

    But the decorator is not working at all, and the display table is not shown at all:


    7 items found, displaying 1 to 5.[First/Prev] 1, 2 [Next/<a href="/PMR/user-grid.jsp?level=040FC&code=BUH&group=13&submit=Submit&d-49653-p=2&loginId=&id=&a

    So please tell me the best way to have 2 params to the href/link

    This is very urgent and hoping for a very very early reply

    Thanks and Regards

    Harish

     
    • Harish Kumar

      Harish Kumar - 2006-02-21

      Hi All

      Its me again. Update to the above thread:

      My Wrapper.java [Decorator] code to the above is:

      public class Wrapper extends TableDecorator {

      public Wrapper() {
          super();
      }
      
      public String getLink2() {
          System.out.println(&quot;Breakpoint 1&quot;);
          ListObject object = (ListObject) getCurrentRowObject();
          if (object != null) {
              int id = object.getId();
              System.out.println(&quot;Breakpoint 2&quot;);
              return &quot;&lt;a href=\&quot;userAction.do?id=&quot; + id
      
                      + &quot;&amp;action=edit\&quot;&gt;Edit&lt;/a&gt; | &quot;
                      + &quot;&lt;a href=\&quot;userAction.do?id=&quot; + id
                      + &quot;&amp;action=delete\&quot;&gt;Delete&lt;/a&gt;&quot;;
      
          } else {
              System.out.println(&quot;Null Breakpoint 3&quot;);
              return null;
          }
      }
      

      }

      When i run my Display tag JSP page, only the "Breakpoint 1" is displayed on my tomcat console. It just hangs after that, even "Null Breakpoint" is not displayed.

      Please advice

      Regards

      Harish

       
      • Sushma Singh

        Sushma Singh - 2008-01-10

        Change ListObject with your java bean class.

         
    • matt_dowell

      matt_dowell - 2006-02-21

      I am also curious about this. The old displaytag used to store the parameter names and values in a map so you could have an infinite number of params, your URL's looked like this:

      www.page.com?id=3&name=blah&this=that....

      Cannot we not do this? I am getting rid of my forked version and am trying to move to 1.1 and it looks great, but I need this functionality.

      Any ideas?

       

Log in to post a comment.

MongoDB Logo MongoDB