Hi Ed,
Thanks for the suggestion, I agree with you.
But when I changed my JSP Web-inf/jsp/non-tiles.jsp
to point to my .css and .js in your suggested way, I get weird behaviour in the browsers.
In IE 6, I get a blank page *(yes a totally white blank page)
In Mozilla firefox 2.0 , I get simple content (as before making this changes) without applying the stylesheets... what am I doing wrong now.
Here's non-tiles.jsp code , may be you can spot the culprit.
------------------------------
<%@ page language="java"%>
<%@ taglib uri="http://struts.apache.org/tags-bean"; prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html"; prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic"; prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles"; prefix="tiles" %>
<html:html>
<head>
<title>adfasdf</title>
<script src="${context_root}/scripts/oBCTS_scripts.js" language="javascript" type="text/javascript"></script>
<script type="text/css" src="${context_root}/css/styles.css"/>
</head>
<body class="sidebar">
<dl id="menu">
<%-- <html:button property="Back" onclick="location.href='default.do'">Back</html:button> --%> <dt onclick="javascript:show();"><a href="navigatePatient.do?do=getFirstPatient">Add New Patient</a></dt> <dt onclick="javascript:show();"><a href="listPatients.do">View Working List</a></dt> <%--<dt class="level1Menu" onclick="javascript:show('smenu3');">Access Patient Roster</dt>--%> <dt onclick="javascript:show();"><a href="myAction.do?do=addBook">Access Patient Roster</a></dt>
<dd id="smenu3">
<ul>
<li><a href="myAction.do?do=addBook">History</a></li>
<li><a href="myAction.do?do=addBook">Clinical Presentations</a></li>
<li><a href="myAction.do?do=addBook">Family Malignancies</a></li>
<li><a href="myAction.do?do=addBook">Comorbidities</a></li>
<dl id ="menu2">
<dt style="text-align:right;" onclick="javascript:show('ssmenu1');" >Treatments*</dt>
<dd id="ssmenu1">
<ul>
<li><a href="myAction.do?do=addBook">Neo Adjuvant</a></li>
<li><a href="myAction.do?do=addBook">Surgery</a></li>
<li><a href="myAction.do?do=addBook">Adjuvant Chemo</a></li>
<li><a href="myAction.do?do=addBook">Hormonal</a></li>
<li><a href="myAction.do?do=addBook">Biologic Agents</a></li>
<li><a href="myAction.do?do=addBook">Clinical Trial</a></li>
</ul>
</dd>
</dl>
<%-- <li><a href="myAction.do?do=addBook">Images</a></li> --%> <%-- robin: Check with M if this is required here. --%>
<li><a href="myAction.do?do=addBook">Pathologies</a></li>
<li><a href="myAction.do?do=addBook">Biopsies</a></li>
<li><a href="myAction.do?do=addBook">Clinical Evaluation/Follow-ups</a></li>
</ul>
</dd>
<%--<dt onclick="javascript:show('smenu4');">View Images</dt>--%>
<dt onclick="javascript:show();"><a href="myAction.do?do=addBook">View Images</a></dt>
<dd id="smenu4">
<ul>
<li><a href="myAction.do?do=addBook">Mammograms</a></li>
<li><a href="myAction.do?do=addBook">X-Rays</a></li>
<li><a href="myAction.do?do=addBook">Bone Scans</a></li>
<li><a href="myAction.do?do=addBook">CT Scans</a></li>
<li><a href="myAction.do?do=addBook">Ultrasound Scans</a></li>
<li><a href="myAction.do?do=addBook">MRI Studies</a></li>
</ul>
</dd>
</dl>
</body>
</html:html>

----------------------------------------



----- Original Message ----- From: "Ed Griebel" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Thursday, November 09, 2006 4:44 PM
Subject: Re: problem with moving jsp pages under web-inf/ folder


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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to