struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Allen Gilliland <allen.gillil...@sun.com>
Subject Re: struts2 equivalent of html:link tag?
Date Mon, 16 Apr 2007 20:48:48 GMT
that works fine for any actions that i have defined, but it doesn't work 
for non-struts actions.  so if i wanted "login" to point to a url like 
"/ui/something.jsp" or "/ui/login-old.do" then i can't do that because 
it will always just form the url as if the action existed.

i need the ability to point the urls to things outside of just my 
struts2 actions because i am migrating from struts1 to struts2, but not 
all at the same time, so my old struts1 actions are *.do and my new ones 
are *.action.  i need to have the ability to link to my old struts1 
actions from the struts2 config, and so far i can't see how to do that.

-- Allen


Shahak Nagiel wrote:
> How about:
> 
> <a href="<s:url action="login"/>>login</a>
> 
> This will generate a link to the "login.action" URL (as configured in struts.xml) and,
if necessary, do the appropriate URL encoding for the session.
> 
> ----- Original Message ----
> From: Allen Gilliland <allen.gilliland@sun.com>
> To: user@struts.apache.org
> Sent: Monday, April 16, 2007 4:00:28 PM
> Subject: struts2 equivalent of html:link tag?
> 
> Is there any struts2 equivalent to the struts1 html:link tag?  I see 
> that the s:a tag is available but is designed for use with ajax and the 
> only other tag i see is s:url.
> 
> The reason I ask is because in my application we used to form links like 
> this ...
> 
> <html:link forward="login">login</html:link>
> 
> and that would build a nice html anchor tag and set the href to the 
> location specified by "login" in the global-forwards section of the 
> struts config, but i can't find an equivalent way of doing that same 
> thing in struts2 using the s:url tag or anything else.
> 
> i suppose what i am really trying to get is the ability to use a logical 
> name like "login" to refer to an actual url like /ui/login.action and be 
> able to form links in my view components using the logical name.  is 
> there a way to do that in struts2?
> 
> -- Allen
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 
> 
> 
> 

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


Mime
View raw message