You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Paul <pa...@merge-solutions.com> on 2007/05/01 16:49:05 UTC

[S2] w/ params?

All,
 
Quick question with S2 tags using <s:url>. Have the following:
 
<input type="button" onclick="location.href='<s:url action="editAction"><s:param name="method" value="add"/></s:url>'"
Value="Add"/>
 
When viewing the page source after rendering should it not read: location.href='editAction.do?method=add' ?
 
Or is my understanding of the param tag incorrect and in this case do you need explicitly do location.href='<s:url action="editAction"/>?method=add' 
 
Thanks in advance!
 
Regards,
Paul

RE: [S2] w/ params?

Posted by Dave Newton <ne...@yahoo.com>.
--- Paul <pa...@merge-solutions.com> wrote:
> Doh! Thanks once again Dave. Works now. :)

I was thinking about getting "value is an Object!" as
a tattoo, but that's a little esoteric, even for me. I
settled for a couple of Post-It! (tm) notes.

d.


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


RE: [S2] w/ params?

Posted by Paul <pa...@merge-solutions.com>.
Ah!

Doh! Thanks once again Dave. Works now. :)

P.

-----Original Message-----
From: Dave Newton [mailto:newton.dave@yahoo.com] 
Sent: Tuesday, May 01, 2007 11:02 AM
To: Struts Users Mailing List;Paul
Subject: Re: [S2] <s:url> w/ params?

--- Paul <pa...@merge-solutions.com> wrote:
> <input type="button" onclick="location.href='<s:url
> action="editAction"><s:param name="method"
> value="add"/></s:url>'"
> Value="Add"/>
> 
> When viewing the page source after rendering should
> it not read:
> location.href='editAction.do?method=add' ?

http://struts.apache.org/2.x/docs/tag-syntax.html

Value is an object, so you'd probably want:

<s:param name="method" value="%{'add'}"/>

That's probably why they have the warning in yellow on
(every?) tag doc page and the link above contains the
following gem:

"""
= value is an Object!

[...] if there is a reason to set the value directly,
be advised that value is an Object NOT a String.

Since value is not a String, whatever is passed to
value is evaluated as an expression - NOT a String
literal.
"""

;)

I *think* what they're trying to say is that it's not
a string, but an object.

(That section always makes me smile; it's a great
reminder for every... single... time... I do the exact
same thing because I forgot.)

d.


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



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


Re: [S2] w/ params?

Posted by Dave Newton <ne...@yahoo.com>.
--- Paul <pa...@merge-solutions.com> wrote:
> <input type="button" onclick="location.href='<s:url
> action="editAction"><s:param name="method"
> value="add"/></s:url>'"
> Value="Add"/>
> 
> When viewing the page source after rendering should
> it not read:
> location.href='editAction.do?method=add' ?

http://struts.apache.org/2.x/docs/tag-syntax.html

Value is an object, so you'd probably want:

<s:param name="method" value="%{'add'}"/>

That's probably why they have the warning in yellow on
(every?) tag doc page and the link above contains the
following gem:

"""
= value is an Object!

[...] if there is a reason to set the value directly,
be advised that value is an Object NOT a String.

Since value is not a String, whatever is passed to
value is evaluated as an expression - NOT a String
literal.
"""

;)

I *think* what they're trying to say is that it's not
a string, but an object.

(That section always makes me smile; it's a great
reminder for every... single... time... I do the exact
same thing because I forgot.)

d.


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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