What happens when the JSP is converted to HTML, it is sent to the
browser. The browser then tries to access the css and js files from
the webserver, but since the HTML points to web-inf, it won't serve
them.

One way to do it is to create an action mapping that is just defined
as a ForwardAction, e.g. <action path="/css"
type="org.apache.struts.actions.ForwardActions"
parameter="/WEB-INF/css/my.css"/>

However, why do you need to protect the CSS and javascript files? Why
not have them outside of the WAR files's WEB-INF directory, then your
http would just have a simple <script type="text/css"
file="${context_root}/css/my.css"/> ? You are not going to keep
anything "secret" by keeping them in WEB-INF because they are simple
text files and anyone who looks at the generated HTML will see where
the CSS comes from.

On 11/9/06, robin bajaj <[EMAIL PROTECTED]> wrote:
Hi Everybody,

- SUMMARY -
Can anyone tell me as to how can I make my jsp lying in Web-inf/jsp/ folder
pick the stylesheet and javascript lying
in Web-inf/scripts and Web-inf/css ??

- DETAILS -
I have SSL enabled my web-app this morning using SSLext release 0 .
I am using Struts 1.2.x with Tiles. Now I can switch from http to https etc.
So,everything is working fine except that my jsp pages
(and other images, css and javascript files) are still lying under WebRoot\
folder.
To be specific - webRoot\jsp , webRoot\css, webRoot\images, webRoot\scripts
have the corresponding resources.

I want to avoid direct access to the jsp (and the static resources) from the
browser
(foreg: since my jsp pages are currently in webRoot\jsp, user can still
access them
using http://hostname:port//context-name/jsp/abc.jsp )

So I tried moving my jsp folder (and images, css, scripts folders) to
webRoot\WEB-INF\
from webRoot. Since I am using tiles, I also updated the references to the
jsps
from /jsp/abc.jsp   to ---> /WEB-INF/jsp/abc.jsp

Now when i go to my home page. My images, javascripts and css are not being
applied to the jsp pages. I get plain white jsp page with contents.

Just to make sure, that Tiles is not messing things up. I created a new JSP
page - Web-inf\jsp\non-tiles.jsp
And copied the contents of another jsp that uses javascript and css
stylesheets.

And forwarded my index.jsp to an actionForward that points to this
non-tiles.jsp.
Even this .jsp shows up without applying the css and javascript.

So I thought its a path issue.
I am accessing my javascript and css as
<script src="../scripts/oBCTS_scripts.js" language="javascript"
type="text/javascript"></script>
<link rel=stylesheet type="text/CSS" HREF="../css/styles.css">

Since my non-tiles.jsp is in Web-inf/jsp/ folder , and oBCTS.js file is in
Web-inf/scripts/ folder  (similary .css file is in Web-inf/css/styles.css)
I think the above paths should resolve correctly. But they DO NOT and hence
even my non-tiles.jsp shows up without applying the .css stylesheet and .js
javascript effects.

Just to prove it for myself, I copy-pasted the contents .css and .js files
into the jsp itself and now access them as
<script type="text/javascript">      [...]     </script>
<style type="text/css">  [...]  </style>

So this works fine. (After all... :-(
Can anyone tell me as to how can I make my jsp lying in Web-inf/jsp/ folder
pick the stylesheet and javascript lying in Web-inf/scripts and Web-inf/css
??

Thanks in advance,
robin


---------------------------------------------------------------------
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]

Reply via email to