RE: stylesheets with jsp's under WEB-INF?

2002-11-18 Thread Madel,Kurt
Hey Wendy,

This seems to be a good way of getting the context relative path without
having to worry about where the page that is referencing the stylesheet is
located (I believe I saw it on Ted Husted's site):




Kurt Madel
Programmer, CSMi
(703) 823-4300 ext. 170


-Original Message-
From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, November 14, 2002 10:14 PM
To: Struts Users Mailing List
Subject: Re: stylesheets with jsp's under WEB-INF?

On Thu, 14 Nov 2002, Wendy Smoak wrote:

> Date: Thu, 14 Nov 2002 19:26:59 -0700
> From: Wendy Smoak <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: stylesheets with jsp's under WEB-INF?
>
>
> I asked about this on comp.lang.java.programmer, and the response was,
> basically, "Don't do that."  So, since Struts is the reason I'm putting my
> jsp's under WEB-INF, can anyone here help with this dilemma?
>
> Would it be better to move the jsp's back above WEB-INF and put in a
Filter
> to stop people accessing them directly?  (Not quite sure _how_ yet but if
> that's the answer I'll figure it out!)
>
> [Tomcat 4.1.14, Struts 1.1 nightly]
>
> I can't get my jsp's that are stored under WEB-INF/jsp to "see" my
> stylesheet.
>
> The jsp lives in:
> /path/to/tomcat/webapps/dev/WEB-INF/jsp/contact.jsp
> (They are under WEB-INF to keep people from getting to them without going
> through the Struts action controller.)
>
> I don't really need to hide my stylesheet, so it can live in:
> /path/to/tomcat/webapps/dev/css/style.css
>
> With all the style stuff directly in the jsp, it was working fine. But
since
> I want to use this stylesheet with all of my jsp's, I'd like to store it
> separately.
> I've tried both:
> 
> 
>
> As well as putting style.css right beside contact.jsp and using
> HREF="style.css"
>
> I'm sure I just haven't hit on the right combination of where to put it
and
> what LINK tag to use. Can someone enlighten me?
>

The fundamental issue you are running into is the fact that the servlet
spec prohibits serving any resource under /WEB-INF to the client directly
-- which, of course, is why you're putting the JSP page there in the first
place.  But, if you think for a second about what really happens when you
create a link to the stylesheet, you'll realize that the *client* is going
to grab it with a separate request -- and, if that path points inside the
/WEB-INF directory, it's going to fail!

You're perfectly free to leave your stylesheet where it is (in the "css"
subdirectory under your webapp), as long as you use an appropriate
relative URL:

  

This will get resolved (by the client) to an absolute URL that is outside
the WEB-INF directory, so everything should work normally.

NOTE -- the exact same issue will apply to any  element in your JSP
page where you're trying to use a relative URL to an image in the same
directory.  That fails for the same reason as retrieving the stylesheet
fails, because the image is retrieved by the client with a separate
request.

> Thanks in advance,
>
> --
> Wendy in Chander, AZ
>
>
>

Craig



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




RE: stylesheets with jsp's under WEB-INF?

2002-11-15 Thread Wendy Smoak
Craig wrote:
> You're perfectly free to leave your stylesheet where it is (in the "css"
> subdirectory under your webapp), as long as you use an appropriate
> relative URL:
>  

This doesn't work.  My version included here in case I missed something:


This does work (thanks Jeff & Jarnot):

It turns into:


> NOTE -- the exact same issue will apply to any  element in your JSP
> page where you're trying to use a relative URL to an image in the same
> directory.  That fails for the same reason as retrieving the stylesheet
> fails, because the image is retrieved by the client with a separate
> request.

Bingo! This is next problem I ran into.  Again, the ../../ to back up out of
the WEB-INF directory is not working.  No matter what path I put in the
styles that have images (background image, buttons) the client browser
cannot load them.  (I can tell when it sees the stylsheet because of some
bold text and alignment that the styles control.  But no images, ever.)

Images live in:  /dev/images/

I've tried variations of:
body { background: url("../../images/gray.jpg"); }

The only thing that works is hard-coding the context:
body { background: url("/dev/images/gray.jpg"); }

I guess I could put the styles in jsp code and use the rewrite tag!

So for now, I've got:
  include file="../../css/style.css" %> --> 
Which pulls the styles into each page directly.  At least I don't have to
maintain them everywhere, but they do have to go over the wire with every
page view.  I still want to get this to work with an external style sheet,
thinking that the browser will cache it.

Anyway, I know this isn't strictly Struts-related, but I appreciate the
help.

-- 
Wendy Smoak
Applications Systems Analyst, Sr.
Arizona State University PA Information Resources Management



RE: stylesheets with jsp's under WEB-INF?

2002-11-15 Thread Jarnot Voytek Contr AU HQ/SC
why not use

"
type="text/css">

That works for me regardless of where the jsp is located (mine happen to be
under WEB-INF as well)

-Original Message-
From: Wendy Smoak [mailto:Wendy.Smoak@;asu.edu]
Sent: Thursday, November 14, 2002 8:27 PM
To: [EMAIL PROTECTED]
Subject: stylesheets with jsp's under WEB-INF?



I asked about this on comp.lang.java.programmer, and the response was,
basically, "Don't do that."  So, since Struts is the reason I'm putting my
jsp's under WEB-INF, can anyone here help with this dilemma?

Would it be better to move the jsp's back above WEB-INF and put in a Filter
to stop people accessing them directly?  (Not quite sure _how_ yet but if
that's the answer I'll figure it out!)

[Tomcat 4.1.14, Struts 1.1 nightly]

I can't get my jsp's that are stored under WEB-INF/jsp to "see" my
stylesheet.

The jsp lives in:
/path/to/tomcat/webapps/dev/WEB-INF/jsp/contact.jsp
(They are under WEB-INF to keep people from getting to them without going
through the Struts action controller.)

I don't really need to hide my stylesheet, so it can live in:
/path/to/tomcat/webapps/dev/css/style.css

With all the style stuff directly in the jsp, it was working fine. But since
I want to use this stylesheet with all of my jsp's, I'd like to store it
separately.
I've tried both:



As well as putting style.css right beside contact.jsp and using
HREF="style.css"

I'm sure I just haven't hit on the right combination of where to put it and
what LINK tag to use. Can someone enlighten me?

Thanks in advance,

--
Wendy in Chander, AZ



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: stylesheets with jsp's under WEB-INF?

2002-11-14 Thread Craig R. McClanahan
On Thu, 14 Nov 2002, Wendy Smoak wrote:

> Date: Thu, 14 Nov 2002 19:26:59 -0700
> From: Wendy Smoak <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: stylesheets with jsp's under WEB-INF?
>
>
> I asked about this on comp.lang.java.programmer, and the response was,
> basically, "Don't do that."  So, since Struts is the reason I'm putting my
> jsp's under WEB-INF, can anyone here help with this dilemma?
>
> Would it be better to move the jsp's back above WEB-INF and put in a Filter
> to stop people accessing them directly?  (Not quite sure _how_ yet but if
> that's the answer I'll figure it out!)
>
> [Tomcat 4.1.14, Struts 1.1 nightly]
>
> I can't get my jsp's that are stored under WEB-INF/jsp to "see" my
> stylesheet.
>
> The jsp lives in:
> /path/to/tomcat/webapps/dev/WEB-INF/jsp/contact.jsp
> (They are under WEB-INF to keep people from getting to them without going
> through the Struts action controller.)
>
> I don't really need to hide my stylesheet, so it can live in:
> /path/to/tomcat/webapps/dev/css/style.css
>
> With all the style stuff directly in the jsp, it was working fine. But since
> I want to use this stylesheet with all of my jsp's, I'd like to store it
> separately.
> I've tried both:
> 
> 
>
> As well as putting style.css right beside contact.jsp and using
> HREF="style.css"
>
> I'm sure I just haven't hit on the right combination of where to put it and
> what LINK tag to use. Can someone enlighten me?
>

The fundamental issue you are running into is the fact that the servlet
spec prohibits serving any resource under /WEB-INF to the client directly
-- which, of course, is why you're putting the JSP page there in the first
place.  But, if you think for a second about what really happens when you
create a link to the stylesheet, you'll realize that the *client* is going
to grab it with a separate request -- and, if that path points inside the
/WEB-INF directory, it's going to fail!

You're perfectly free to leave your stylesheet where it is (in the "css"
subdirectory under your webapp), as long as you use an appropriate
relative URL:

  

This will get resolved (by the client) to an absolute URL that is outside
the WEB-INF directory, so everything should work normally.

NOTE -- the exact same issue will apply to any  element in your JSP
page where you're trying to use a relative URL to an image in the same
directory.  That fails for the same reason as retrieving the stylesheet
fails, because the image is retrieved by the client with a separate
request.

> Thanks in advance,
>
> --
> Wendy in Chander, AZ
>
>
>

Craig



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: stylesheets with jsp's under WEB-INF?

2002-11-14 Thread Jeff_Mychasiw

Greetings:
  We have no problems with our jsp files under web-inf and our style
sheets in the public area.

  Though I think you should be using the rewrite tag


we do the same thing with javascript:
'>


it renders the path with the  app name:



hope this  helps.







Wendy Smoak <[EMAIL PROTECTED]> on 11/14/2002 08:26:59 PM

Please respond to "Struts Users Mailing List"
   <[EMAIL PROTECTED]>

To:[EMAIL PROTECTED]
cc:

Subject:stylesheets with jsp's under WEB-INF?



I asked about this on comp.lang.java.programmer, and the response was,
basically, "Don't do that."  So, since Struts is the reason I'm putting my
jsp's under WEB-INF, can anyone here help with this dilemma?

Would it be better to move the jsp's back above WEB-INF and put in a Filter
to stop people accessing them directly?  (Not quite sure _how_ yet but if
that's the answer I'll figure it out!)

[Tomcat 4.1.14, Struts 1.1 nightly]

I can't get my jsp's that are stored under WEB-INF/jsp to "see" my
stylesheet.

The jsp lives in:
/path/to/tomcat/webapps/dev/WEB-INF/jsp/contact.jsp
(They are under WEB-INF to keep people from getting to them without going
through the Struts action controller.)

I don't really need to hide my stylesheet, so it can live in:
/path/to/tomcat/webapps/dev/css/style.css

With all the style stuff directly in the jsp, it was working fine. But
since
I want to use this stylesheet with all of my jsp's, I'd like to store it
separately.
I've tried both:



As well as putting style.css right beside contact.jsp and using
HREF="style.css"

I'm sure I just haven't hit on the right combination of where to put it and
what LINK tag to use. Can someone enlighten me?

Thanks in advance,

--
Wendy in Chander, AZ










--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: stylesheets with jsp's under WEB-INF?

2002-11-14 Thread James Mitchell
Hi Wendy,

I understand your dilemma.  I typically use a stylesheet tag that I wrote
about a year ago to solve this.

While there are a couple of ways to handle this, I find this the cleanest.

 The sourceforge.net site is down for maintenance right now, but the cvs
viewer is working:
 http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/struts/struts-atlanta/

You can find the tld and the source there.

It allows you to do this:
 

and it will prepend your application prefix.



James Mitchell
Software Engineer/Struts Evangelist
http://www.open-tools.org

"If you were plowing a field, which would you rather use? Two strong oxen or
1024 chickens?"
- Seymour Cray (1925-1996), father of supercomputing


> -Original Message-
> From: Wendy Smoak [mailto:Wendy.Smoak@;asu.edu]
> Sent: Thursday, November 14, 2002 9:27 PM
> To: [EMAIL PROTECTED]
> Subject: stylesheets with jsp's under WEB-INF?
>
>
>
> I asked about this on comp.lang.java.programmer, and the response was,
> basically, "Don't do that."  So, since Struts is the reason I'm putting my
> jsp's under WEB-INF, can anyone here help with this dilemma?
>
> Would it be better to move the jsp's back above WEB-INF and put
> in a Filter
> to stop people accessing them directly?  (Not quite sure _how_ yet but if
> that's the answer I'll figure it out!)
>
> [Tomcat 4.1.14, Struts 1.1 nightly]
>
> I can't get my jsp's that are stored under WEB-INF/jsp to "see" my
> stylesheet.
>
> The jsp lives in:
> /path/to/tomcat/webapps/dev/WEB-INF/jsp/contact.jsp
> (They are under WEB-INF to keep people from getting to them without going
> through the Struts action controller.)
>
> I don't really need to hide my stylesheet, so it can live in:
> /path/to/tomcat/webapps/dev/css/style.css
>
> With all the style stuff directly in the jsp, it was working
> fine. But since
> I want to use this stylesheet with all of my jsp's, I'd like to store it
> separately.
> I've tried both:
>  TITLE="Style" />
>  TITLE="Style"/>
>
> As well as putting style.css right beside contact.jsp and using
> HREF="style.css"
>
> I'm sure I just haven't hit on the right combination of where to
> put it and
> what LINK tag to use. Can someone enlighten me?
>
> Thanks in advance,
>
> --
> Wendy in Chander, AZ
>
>
>


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: stylesheets with jsp's under WEB-INF?

2002-11-14 Thread edgar
The way to think about this is that the style sheets are loaded by the
client, not by the server.  When you do the reference, make sure the
client can load the file.  The link tag is just passed through to the
browser.

my root is 

//htdocs   - visible to the client

My jsp's are in

//htdocs/WEB-INF/jsp   - invisible to the client

My styles are in

//htdocs/styles- visible to the client

My style reference is



Hope that helps

Edgar


-Original Message-
From: Wendy Smoak [mailto:Wendy.Smoak@;asu.edu] 
Sent: Thursday, November 14, 2002 9:27 PM
To: '[EMAIL PROTECTED]'
Subject: stylesheets with jsp's under WEB-INF?



I asked about this on comp.lang.java.programmer, and the response was,
basically, "Don't do that."  So, since Struts is the reason I'm putting
my jsp's under WEB-INF, can anyone here help with this dilemma?

Would it be better to move the jsp's back above WEB-INF and put in a
Filter to stop people accessing them directly?  (Not quite sure _how_
yet but if that's the answer I'll figure it out!)

[Tomcat 4.1.14, Struts 1.1 nightly]

I can't get my jsp's that are stored under WEB-INF/jsp to "see" my
stylesheet.

The jsp lives in: /path/to/tomcat/webapps/dev/WEB-INF/jsp/contact.jsp
(They are under WEB-INF to keep people from getting to them without
going through the Struts action controller.)

I don't really need to hide my stylesheet, so it can live in:
/path/to/tomcat/webapps/dev/css/style.css

With all the style stuff directly in the jsp, it was working fine. But
since I want to use this stylesheet with all of my jsp's, I'd like to
store it separately. I've tried both:  

As well as putting style.css right beside contact.jsp and using
HREF="style.css"

I'm sure I just haven't hit on the right combination of where to put it
and what LINK tag to use. Can someone enlighten me?

Thanks in advance,

--
Wendy in Chander, AZ




--
To unsubscribe, e-mail:   
For additional commands, e-mail: