struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurie Harper <>
Subject Re: [S2] URL management
Date Tue, 16 Sep 2008 20:47:47 GMT
If the URLs you are substituting in are external to the web app, they 
don't need to be 's2-friendly'; an external site doesn't care about your 
Struts app's session ID, etc. If the URLs are (or may be) internal to 
the application, however, you do need to take care of that. In that 
case, use s:url tags directly, generating the attribute values (as 
opposed to trying to generate the entire s:url tag).

You haven't how you're exposing the URLs to the page (are they embeded 
in larger text blocks? Are they stand-alone text fields in the DB?) but 
essentially what you'd want is to be able to write something like this 
in your JSP:

... <s:url value="%{myurl}"/> ...

where 'myurl' is either a property containing the URL with the PHP tags 
already stripped, or a method that looks up the URL and does the PHP tag 

The key point is, you can't build something that generates the s:url 
tags themselves, you you can build something that generates the input 
data you need to feed to the s:url tags.


esemba wrote:
> Thank you for your reply.
> So you think there is now way, how to parse urls out of the text stored in
> the db and make them s2-friendly (i mean jsessionid rewriting in case of
> disabled cookies, etc.)?
> esemba wrote:
>> Hi,
>> i'm migrating my old php website to Struts 2 and have problem with url
>> management. In my db, i have urls tagged like this
>> [url][/url]. In php, i just do regexp replace of this
>> custom
>> url tags with proper html tags. I would need to do something like this in
>> struts 2, but want to use <s:url>. Best solution would be like this: In
>> jsp(ognl) replace every occurrence of [url]url string[/url] with 
>> <s:url value= ">.
> That wouldn't work, since JSP custom action tags are processed at page 
> compilation time; by the time your substitution happened (during page 
> rendering) it's too late to introduce s:url tags.
> I this case, you probably don't need s:url tags anyway; just use vanilla 
> HTML  ... 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message