The only thing you have to worry about is how your users browsers are
constructing the request for the css file.
Here's some help from Ted:
* Use rewrite to reference HTML assets *
The Struts <html:rewrite> tag can convert a context-relative URI into a base
URI that can be used to access style sheets, JavaScripts, images and other
HTML assets. For example,
<LINK rel="stylesheet" type="text/css"
HREF="<html:rewrite page='/assets/styles/base.css'/>">
If you wanted to hedge your bets about where the style sheets will be
located, an ActionForward may also be used.
<LINK rel="stylesheet" type="text/css"
HREF="<html:rewrite forward='baseStyle'/>">
Likewise, references to JavaScripts, as well as URIs to be processed by
JavaScripts, can be rendered this way.
<SCRIPT language='javascript'>
SRC='<html:rewrite page="/assets/scripts/remote.js"/>'>
</SCRIPT>
<SCRIPT>
<!--
function doScript(aScript)
aBase = '<html:rewrite forward="scriptPreview"/>';
HC_doOpenRemote(aBase + '?script=' + aScript); }
// --
</SCRIPT>
In the latter example, we retrieve the base URI for the JavaScript function
from an ActionForward and then append the script number based to the
function. This type of function would usually be called from a hyperlink
like this:
<A HREF='javascript:doScript(10011)'>10011</A>
that was generated using JSP code like this:
<A HREF='javascript:doScript(<bean:write name="row"
property="script"/>)'>
<bean:write name="row" property="script"/> </A>
Since we are calling a JavaScript function, we did not bother with a
<html:link> tag to provide URL encoding. The hyperlink will be handled
client-side so maintaining the session is not an issue. The URI generated by
the <rewrite> tag, and subsequently used by the Javascript, will be URL
encoded, so that the session will be maintained if cookies are not present.
HTH - Ted.
James Mitchell
Software Engineer\Struts Evangelist
Struts-Atlanta, the "Open Minded Developer Network"
http://www.open-tools.org/struts-atlanta
> -----Original Message-----
> From: Afshartous, Nick [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 24, 2002 10:18 PM
> To: 'Struts Users Mailing List'
> Subject: RE: Firewall and Struts inhibit CSS references
>
>
>
> < From: James Mitchell [mailto:[EMAIL PROTECTED]]
>
> < The request made by the browser for the text file
> < "/strutstest/css/adm_01.css" is handled by your web server. It
> never even
> < makes it to the servlet container, much less the struts action servlet.
>
> Would it be possible that somehow the environment of the servlet or
> container indirectly
> affects the processing of the CSS link ref ? I'm asking this because
> when the file has a .html suffix it works fine, but with a .jsp suffix
> the CSS file is not applied. Also, when the URL path to the page is
> requested (i.e. .../test.jsp) it works fine. Its only when an action
> forwards to the .jsp file that the CSS file is not found/applied to the
> .jsp.
>
> < You should consult the firewall documentation or try a bit more
> debugging
> < with your firewall software. I run a very restrictive firewall
> on my home
> < server and it handles .css just fine.
>
> The firewall in our case is not at the server end. The user's machine
> is behind a firewall looking at the outside world where the server is.
> When the user's machine is not behind a firewall the CSS file is
> applied to
> the .jsp and the page is rendered fine.
>
> Thanks for any info.
>
> Nick
>
>
>
>
>
>
> > -----Original Message-----
> > From: Eddie Bush [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, September 24, 2002 12:33 PM
> > To: Struts Users Mailing List
> > Subject: Re: Firewall and Struts inhibit CSS references
> >
> >
> > Pardon, but I think your subject is misleading. Struts is doing nothing
> > to inhibit your CSS references. Your firewall I don't know about -
> > that's a different story. This is definitely not a "Struts" issue
> > though :-)
> >
> > Afshartous, Nick wrote:
> >
> > > We have run into an issue with references to CSS files.
> > > The references have this form
> > >
> > > <link rel="STYLESHEET" type="text/css"
> > >href="/strutstest/css/adm_01.css">
> > >
> > > We have set up the application in our DMZ and the pages are rendered
> > >fine for us,
> > > however for one of our customers who is viewing from behind a
> > >firewall, the stylesheets
> > > are not being found/applied.
> > >
> > > We have tested the pages via a non-Struts servlet and that works
> > >fine for the
> > > customer, so somehow
> > > the combination of Struts and the external firewall are causing the
> > >problem.
> > > If anyone has any suggestions please let me know, thanks.
> > >
> > >--
> > > Nick
> > >
> >
> > --
> > Eddie Bush
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>