Roger wrote:
I often use:
<link type="text/css" rel="stylesheet" href="/css/main.css">
<link type="text/css" rel="stylesheet"
href="${pageContext.request.contextPath}/css/main.css">
<link type="text/css" rel="stylesheet" href="${initParam.css}/main.css">
where ${initParam.css} refers to an init param in web.xml (useful if it
needs to change with the deployment, such as a version number)
Could you point me at some code examples on how to set this up. I've a need to
load a different style sheet depending upon either the locale of the user, or
a user selected locale.
If dealing with Locale, I'd take a different approach. Struts2 sets the
locale on the response object, and the i18n interceptor allows it to be
overridden with the request_locale parameter.
So you could:
a. Reference the locale directly
eg.
<link type="text/css" rel="stylesheet"
href="/css/${pageContext.response.locale}/main.css">
or b. use the s:text tag to reference a path specified in a resource
bundle for the current locale
eg.
<link type="text/css" rel="stylesheet" href="<s:text
value="env.csspath">/main.css">
or c. Use Tiles and Sitemesh to include a different tile/decoration
based on the locale (as both support this).
eg. <tiles:includeDefinition name="page.cssIncludes"/>
I don't have any non-trivial i18n experience, so there's probably better
ways. It really depends on what else needs to change on the page; if
you're using a lot of s:text then that's a good approach; if you're
using different tiles then that seems a good approach.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]