You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Danieleippoliti@libero.it" <Da...@libero.it> on 2008/04/15 11:33:03 UTC
HOW TO SPECIFY AN ACTION WITH A PARAMETER
hello everybody,
my need would be to click a link in my web page,
and to associate a variable parameter to it,
giving the possibility to the action java code to
recognize the parameter string and compute a logic
depending on its value; to be more clear, i visualize
a dinamyc number of links, one for each id reflecting a
DB query computed before to obtain the id value list, and thus, i would like to use this id as a parameter for the same action for every link; tha action should use the id parameter to compute a second query, with the id used as a key-field.
How to specify the invocation of an action passing a parameter? i mean, how to invoke it via html, and how to
read the parameter via action java code?
Thanks a lot for every answer,
Marco and Daniele
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: HOW TO SPECIFY AN ACTION WITH A PARAMETER
Posted by Ralf Fischer <th...@googlemail.com>.
On Tue, Apr 15, 2008 at 11:33 AM, Danieleippoliti@libero.it
<Da...@libero.it> wrote:
> hello everybody,
> my need would be to click a link in my web page,
> and to associate a variable parameter to it,
> giving the possibility to the action java code to
> recognize the parameter string and compute a logic
> depending on its value; to be more clear, i visualize
> a dinamyc number of links, one for each id reflecting a
> DB query computed before to obtain the id value list, and thus, i would like to use this id as a parameter for the same action for every link; tha action should use the id parameter to compute a second query, with the id used as a key-field.
This is all what web applications are about, don't you think? :-)
> How to specify the invocation of an action passing a parameter? i mean, how to invoke it via html, and how to
> read the parameter via action java code?
You don't need to "read" parameters passed like in plain servlets,
they're injected into your action when it has the appropriate
properties (setter/getter). Take a look at the bootstrap section[1]
from the struts tutorials[2] on the homepage as a starting point, and
take a look at the showcase app, it should have tons of examples for
this.
Cheers,
-Ralf
[1] http://struts.apache.org/2.0.11.1/docs/bootstrap.html
[2] http://struts.apache.org/2.0.11.1/docs/tutorials.html
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org