You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Dilep <fo...@opensymphony.com> on 2007/02/27 02:07:12 UTC

Extra parameter value for DispatchAction.

Hi,
Is there a way to pass a extra paramameter for DispatchAction apart from parameter=method..
Onclick on a link(<html:link action="/someform.do?method=getRecord">) from Search Results, I wanna to pass the primary key value. I can't use hidden values as it is not a form.
I have one solution. But i don't know its proper approach. I tryig to set the session in javascript and its not working.
onclick="javascript:clickRequestId(primaryKeyValue));

function clickRequestId(value) {
 	 
 	 var primaryKey = value;
 	 session.setAttribute("id",primaryKey);
 }.
Any one has any idea please..
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=67368&messageID=127785#127785


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


Re: Extra parameter value for DispatchAction.

Posted by Michael Jouravlev <jm...@gmail.com>.
Dilep, use struts-user forum for questions like this.

On 2/26/07, Dilep <fo...@opensymphony.com> wrote:
> Hi,
> Is there a way to pass a extra paramameter for DispatchAction
> apart from parameter=method.

"parameter=method" is not meant to pass parameters to an action,
parameters are passed in request object.

> Onclick on a link(<html:link action="/someform.do?method=getRecord">)
> from Search Results, I wanna to pass the primary key value.
> I can't use hidden values as it is not a form.

If you have one link per row then just add your PK to the link
directly. If you have one link per whole table then you will need to
modify the link dynamically with Javascript.

> I have one solution. But i don't know its proper approach. I tryig to set the session in javascript and its not working.

If it does not work then it's not a solution.

> onclick="javascript:clickRequestId(primaryKeyValue));
>
> function clickRequestId(value) {
>
>          var primaryKey = value;
>          session.setAttribute("id",primaryKey);
>  }.
> Any one has any idea please..

You cannot access server-side session object from browser-contained
Javascript code. I mean, not in the fashion above. You need to read
sevlets/JSP book first to understand browser/server interaction.

Michael.

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


Re: Extra parameter value for DispatchAction.

Posted by Dave Newton <ne...@yahoo.com>.
--- Dilep <fo...@opensymphony.com> wrote:
> Is there a way to pass a extra paramameter for
> DispatchAction apart from parameter=method..

This should be moved to the user list.

> Onclick on a link(<html:link
> action="/someform.do?method=getRecord">) from Search
> Results, I wanna to pass the primary key value. I
> can't use hidden values as it is not a form.

You can either build the URL via EL (by using the
html-el tags) or via the normal parameter map method
(see
http://struts.apache.org/1.2.9/userGuide/struts-html.html#link)

> I have one solution. But i don't know its proper
> approach. I tryig to set the session in javascript
> and its not working.
> 
> function clickRequestId(value) {
>  	 var primaryKey = value;
>  	 session.setAttribute("id",primaryKey);
>  }

I'll admit I've never tried that approach... You may
have some very basic misconceptions about Javascript.

d.



 
____________________________________________________________________________________
Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
http://videogames.yahoo.com/platform?platform=120121

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