Title: RE: [displaytag-user] How Use Displaytag Linking to a Struts Action

Hi,

Just to add something to the answer.
If you have to give multiple parameters, but the parameters depend on the values of some attributres of the "current object or row" of the table, then you won't be able to do it like this: <html:link forward="..." ...etc

I have solved this with the following code:

<display:column titleKey="somekey.property1" >
  <%
        RowObject rep = (RowObject ) pageContext.getAttribute("row");  // If  id="row" in display:table definition
        Map parametersMap = rep.getDetailsParametersMap(); // Get map with (param, value) tuples from the row
        parametersMap.put("extraparam1", xxxx); //optionally, add other parameters that do not depend on the row object
        parametersMap.put("extraparam2", yyyy); //e.g. if action is a dispatch, maybe this can be the "command" of the action

        pageContext.setAttribute("ParametersMap", parametersMap); // add map to pageContext
  %>                   
        <html:link action="" name="ParametersMap" > // action is overview.do, and name are the parameters
                <bean:write name="row" property="property1" /> //What will be shown in the current cell of the table
        </html:link>
</display:column>

I hope this helps.

regards,
Miro

-----Original Message-----
From: Rick Herrick [mailto:[EMAIL PROTECTED]]
Sent: dinsdag 11 juli 2006 20:10
To: displaytag-user@lists.sourceforge.net
Subject: Re: [displaytag-user] How Use Displaytag Linking to a Struts
Action


The simplest answer is that you just change the URL:

<display:column property="id" title="ID" href="">
paramId="id" />

Possible complications to this involve passing multiple parameters.  The
paramId and other param* attributes only allow you to specify one
parameter to be appended to the URL.  In that case you need to do
something like I posted in response to your list within a table question
earlier, i.e.:

<display:table name="items" uid="item">
   <display:column title="ID">
      <html:link forward="..." paramName="item" paramId="id"/>
   </display:column>
</display:table>

Or you can use EL/JSTL:

<display:table name="items" uid="item">
   <display:column title="ID">
      <a href="">
   </display:column>
</display:table>

If you're not using JSP 2.4, then you'd have to replace the in-line ELs
with JSTL, e.g. ${item.id} is <c:out value="${item.id}"/>.

Mississippi John Hurt wrote:
> Normally in Struts I use <html:link> to link to an action, but with
> displaytag you do linking like below...
>
> <display:table name="sessionScope.details">
>   <display:column property="id" title="ID" href="" paramId="id"
> />
>   <display:column property="email" href="" paramId="action"
> paramName="testparam" paramScope="request" />
>   <display:column property="status" href="" paramId="id"
> paramProperty="id" />
> </display:table>
>
> So how do I tell displaytag to link to a Struts action instead of a
> .jsp? Thanks.
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> displaytag-user mailing list
> displaytag-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/displaytag-user
>


--
Rick Herrick
[EMAIL PROTECTED]

I haven't got time for inner peace.

"No reasonable definition of reality could be expected to permit
this."--Albert Einstein, Boris Podolsky and Nathan Rosen in 1935



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
displaytag-user mailing list
displaytag-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-user

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
displaytag-user mailing list
displaytag-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-user

Reply via email to