Correction... the last two lines of code in my previous mail should have
been (getting myStylesUrl by value not name!)
<s:url id="myStylesUrl" value="/css/myStyles.css" />
<link rel="stylesheet" type="text/css" href="<s:property
value="myStylesUrl" />" />
not
<s:url id="myStylesUrl" value="/css/myStyles.css" />
<link rel="stylesheet" type="text/css" href="<s:property
name="myStylesUrl" />" />
Max Pimm wrote:
Thanks for the respones.
Perhaps i didn't explain myself properly. What i'm really looking for
is a way to define the context root url as the base url.
My motives for doing this is to allow me to share code across my
application. An example would be referencing a style sheet in a header
include. For examples i could use the line
<link rel="stylesheet" type="text/css" href="css/myStyles.css" />
in any jsp, irrespective of the request url that i am calling it from.
Up till now the only solution that i've found is to generate all href
values using a combination of s:url and s:properties, like so.
<s:url id="myStylesUrl" value="/css/myStyles.css" />
<link rel="stylesheet" type="text/css" href="<s:property
name="myStylesUrl" />" />
This generates a context relative url and works fine but is a bit
cumbersome if i have to do it every time i need to generate a url
outside struts tags.
max
This works fine but h
Musachy Barroso wrote:
Or the scriptletless version:
<base id="docBase" href='<s:property value="%{#context[@
[EMAIL PROTECTED]"/>' >
musachy
On 6/21/07, Van Riper <[EMAIL PROTECTED]> wrote:
On 6/21/07, Max Pimm <[EMAIL PROTECTED]> wrote:
> I am used to defining a base element in my pages but can't find
the way
> to define this with struts 2. All suggestions welcome.
I don't think you need struts 2 support to do this. I'm using webwork
2.2 currently and starting to monitor this list again in preparation
for migrating our webapp codebase to struts 2. We also use Sitemesh
for response decoration. So, our Sitemesh decorator sets the base
element for our response during the execution of sitemesh response
filter. The way we do it in JSP land is:
<base id="docBase" href="<%=request.getRequestURL()%>"/>
No webapp framework support required. We give the base element an "id"
because we have some javascript functions that need to access the base
document URL dynamically. This makes it easy to do the element lookup
by id via Javascript elsewhere.
Cheers, Van
Mike Van Riper
[EMAIL PROTECTED]
Silicon Valley Web Developer JUG
https://sv-web-jug.dev.java.net
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]