You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jason Lea <ja...@kumachan.net.nz> on 2003/07/10 23:46:53 UTC

Re: Location of JSP Pages

DVINCENT@bnpfactor.fr wrote:
> Hi,
> 
> For security reasons (forbid direct access to JSP Pages), I've localized my
> JSP Pages under WEB-INF.
> Each page is fronted with a Struts Action.
> 
> 
> I encounter since JSP compilation problems :
> 
> "org.apache.jasper.JasperException: Unable to compile class for JSP
> An error occurred at line: -1 in the jsp file: null
> Generated servlet error:
>     [javac] Compiling 1 source file
> M:
> \wsad\VINCENT_view_tomcatservices\WebServicesNet\work\org\apache\jsp\WEB-INF\pages\accueil_jsp.java:1:
> 
> ';' expected
> package org.apache.jsp.WEB-INF.pages;
> 1 error "
> 
> '-' char (from WEB-INF)  seems not to be valid for package name ...
> 
> I use Tomcat 4.1.12
> 
> Is it possible to protect JSP Pages from direct access ?
> What is the best practice for that ?

Yes, but it looks like you have put them in the wrong place.

Your web app should look something like this:

/../webapp
     /WEB-INF
         /classes
             (your java classes get compiled into here)
         /lib
             (your jar files go here)
	/struts-config.xml
         /web.xml
    (your index.html and other plain files can go here, images directory)

I created a 'jsp' directory under WEB-INF and put my directory structure 
of jsps there eg

/../webapp
     /WEB-INF
         /classes
         /lib
         /jsp
             /layout
                 /layout.jsp
             /tiles
                 /tile1.jsp
                 /tile2.jsp

Hope that helps...

-- 
Jason Lea


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org