Using the ajax tags you can submit a form on the request, using the "formId" attribute (http://struts.apache.org/2.0.6/docs/ajax-tags.html), like:
<form id="data" > //fields here // if you need to submit an id, use <input type="hidden" value="superId" /> </form> <s:a theme="ajax" formId="data" href="%{#url} >Submit</s:a> I'm assuming that the mentioned "id" parameter is something that will change on the client based on some user selection or something, otherwise you could build your url using the "url" tag, and just use it in the href attribute of the ajax tags. regards musachy On 4/11/07, Minerva CC <[EMAIL PROTECTED]> wrote:
Hi musachy, Thanks for pointing it out. I forgot what environment I am in now. My last project was .NET desktop application. Anyhow, what I am trying to do is to pick up a id from a table. Then, pass this id to an Ajax link as parameter. I used an onClick function to setup a javascript variable as id. Then, in the struts part, I have the following lines <s:url action="parameterlist" id="parlistUrl"> <s:param name="orderid" value="%{id}" /> </s:url> <div id="search_parameters"> <div style="text-align: right;"> <s:a theme="ajax" notifyTopics="/refresh">Refresh</s:a> </div> <s:div id="searchParameters" theme="ajax" href="%{parlistUrl}" loadingText="Loading..." listenTopics="/refresh"/> </div> Obviously, this won't work as you already pointed out the tags run on the server side. Is there anyway I can get around it? Thanks, Willa ----- Original Message ---- From: Musachy Barroso <[EMAIL PROTECTED]> To: Struts Users Mailing List <user@struts.apache.org> Sent: Tuesday, April 10, 2007 2:16:24 PM Subject: Re: How to pass a Javascript variable to Struts parameter? Tags are evaluated on the *server* side, javascript runs on the *client* side. Can you give more details on what you are trying to do? regards musachy On 4/10/07, Minerva CC <[EMAIL PROTECTED]> wrote: > > Hi, > > I tried to pass a Javascript variable to a struts url tag and I did it as > follow: > > In the Javascript part: > var id_ = 10; > > In the struts tag par: > <s:url action="myAction" id="myUrl"> > <s:param name="id" value="%{id_}" /> > </s:url> > > But, it didn' work. Would somebody tell me how to do it? > > Thanks in advance for you help. > Willa > > > > > ____________________________________________________________________________________ > TV dinner still cooling? > Check out "Tonight's Picks" on Yahoo! TV. > http://tv.yahoo.com/ -- "Hey you! Would you help me to carry the stone?" Pink Floyd ____________________________________________________________________________________ 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
-- "Hey you! Would you help me to carry the stone?" Pink Floyd