You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Theodosios Paschalidis <th...@hotmail.com> on 2003/12/07 00:10:19 UTC

Link-to-action?

Hi all,

I am a new struts user utilizing it for my uni project. I have reached a point that I do not know how to handle "the struts way" and am really stuck! I spent a lot time on this and I would be grateful for any further info!

 I am dynamically producing some search results. I will be turning them into links and I want to pass a parameter.

Is it possible that a user clicking on a link can trigger an action? eg having something like <a href="DisplayItem.do?ItemId=223">

Using JSPs would be easy to do invoking the appropriate method directly the above way.

Using servlets I could just do String itemId=request.getParameter("Itemid").
Since an ActionClass is a servlet could I achieve the same using the Form as a transfer object for the ID property?

If this cannot be done using the struts sequence (Form-Action) then maybe it will be easier forwarding to a JSP? Doing that though will require me using a scriptlet to retrieve the object of interest :( Any better way? (because my Items are nested I am trying to do it through an Action)

In a nutshell: 1) I display a collection
                   2) I want to somehow select the item that the user clicked, for detailed description

Any help will be really appreciated!
Thank you for your time,
Theo




Re: Link-to-action?

Posted by Theodosios Paschalidis <th...@hotmail.com>.
Dennis,

thank you very much for the prompt reply. I had a brief look at the example
application but upon googling for a link tag in struts I found the following
http://husted.com/struts/resources/linkParam.htm (source code included)
This seems to be exactly what I need (had no time to try using it yet).
I hope this will be useful to all that face similar problems.

All the best,
Theo


----- Original Message ----- 
From: "Dennis Hunziker" <st...@gloom.ch>
To: "'Struts Users Mailing List'" <st...@jakarta.apache.org>
Sent: Sunday, December 07, 2003 9:04 AM
Subject: RE: Link-to-action?


> Hi
>
> In our current project we are using an adapted version of the Link<X>Tag
> class provided with the struts example application. Check out this class
> and I hope it is what you need.
>
> Kind regards
> Dennis Hunziker
>
>
>
> -----Original Message-----
> From: Theodosios Paschalidis [mailto:theopa7@hotmail.com]
> Sent: Sonntag, 7. Dezember 2003 00:10
> To: struts-user@jakarta.apache.org
> Subject: Link-to-action?
>
> Hi all,
>
> I am a new struts user utilizing it for my uni project. I have reached a
> point that I do not know how to handle "the struts way" and am really
> stuck! I spent a lot time on this and I would be grateful for any
> further info!
>
>  I am dynamically producing some search results. I will be turning them
> into links and I want to pass a parameter.
>
> Is it possible that a user clicking on a link can trigger an action? eg
> having something like <a href="DisplayItem.do?ItemId=223">
>
> Using JSPs would be easy to do invoking the appropriate method directly
> the above way.
>
> Using servlets I could just do String
> itemId=request.getParameter("Itemid").
> Since an ActionClass is a servlet could I achieve the same using the
> Form as a transfer object for the ID property?
>
> If this cannot be done using the struts sequence (Form-Action) then
> maybe it will be easier forwarding to a JSP? Doing that though will
> require me using a scriptlet to retrieve the object of interest :( Any
> better way? (because my Items are nested I am trying to do it through an
> Action)
>
> In a nutshell: 1) I display a collection
>                    2) I want to somehow select the item that the user
> clicked, for detailed description
>
> Any help will be really appreciated!
> Thank you for your time,
> Theo
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: Link-to-action?

Posted by Dennis Hunziker <st...@gloom.ch>.
Hi

In our current project we are using an adapted version of the Link<X>Tag
class provided with the struts example application. Check out this class
and I hope it is what you need.

Kind regards
Dennis Hunziker



-----Original Message-----
From: Theodosios Paschalidis [mailto:theopa7@hotmail.com] 
Sent: Sonntag, 7. Dezember 2003 00:10
To: struts-user@jakarta.apache.org
Subject: Link-to-action?

Hi all,

I am a new struts user utilizing it for my uni project. I have reached a
point that I do not know how to handle "the struts way" and am really
stuck! I spent a lot time on this and I would be grateful for any
further info!

 I am dynamically producing some search results. I will be turning them
into links and I want to pass a parameter.

Is it possible that a user clicking on a link can trigger an action? eg
having something like <a href="DisplayItem.do?ItemId=223">

Using JSPs would be easy to do invoking the appropriate method directly
the above way.

Using servlets I could just do String
itemId=request.getParameter("Itemid").
Since an ActionClass is a servlet could I achieve the same using the
Form as a transfer object for the ID property?

If this cannot be done using the struts sequence (Form-Action) then
maybe it will be easier forwarding to a JSP? Doing that though will
require me using a scriptlet to retrieve the object of interest :( Any
better way? (because my Items are nested I am trying to do it through an
Action)

In a nutshell: 1) I display a collection
                   2) I want to somehow select the item that the user
clicked, for detailed description

Any help will be really appreciated!
Thank you for your time,
Theo





---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org