Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
JSP - A mailing list about Java Server Pages specification and reference
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Oracle Connection Pooling in 3 2 2
Servlet : Session invalidate
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Tomcat and webapplication specific java library path
Running a Simple JMS Example
Mapping in workers2 properties
org apache jasper JasperException
Cannot find message resources under key org apache struts action
   MESSAGE
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
url string for connecting jboss to oracle
Value attribute of <html:checkbox
javax servlet ServletException: BeanUtils populate
HTTP Status 404 The requested resource is not available
5 0 18: Windows XP Pro vs Windows 2000
 
"File not found " with file include in a jsp file.

"File not found " with file include in a jsp file.

2006-12-12       - By David Smith

 Back
Reply:     1     2     3     4     5     6     7     8     9     10     >>  

My apologies for reposting this outside the thread, but Thunderbird has
a real problem with the encoding of the original thread and has made a
mess of the minimal formatting I tried to put in below. --David

Try this directory structure, starting with the appbase you declared in
your host definition:

wwwroot
ROOT
headerCon.jsp
product
product_view.jsp
WEB-INF
web.xml

The web.xml can be very minimal -- just a <web-app> root element with
the appropriate dtd or schema declaration.

Then request http://localhost:8080/product/product_view.jsp.

Note all the jsp files are contained inside the ROOT webapp folder. You
name the ROOT folder something else, but be aware the ROOT name is
special under tomcat and receives requests that don't match up with any
other webapp.


I would highly recommend you read the servlet spec at
http://jcp.org/aboutJava/communityprocess/final/jsr154/index.html

--David




David Smith ??:

>> > > You can't have files in the webapps top level. In this regard things
>> > > stop working the way they do in Apache Httpd. Move your
headerCon.jsp
>> > > file down into the product webapp or put the whole works in a ROOT
>> > > directory inside of your wwwroot.
>> > >
>> > > --David
>> > >
> >

Hello, David,

Follow your advice, i put the whole directory to a subdirectory in the
/home/test/wwwroot/webapps

Then use the http://uri/webapps, everything works well. But, that's
could not accepted by my clients.

I wonder know, why it works great under tomcat4.1 with the same
configuration. Is it any differences between the two versions? So it has
the different behaviors.

If i don't wanna to put it to a subdirectory under the top webapps
directory. What should i do make it workable?

Thanks very much.

Wang Penghui


>> > > Wang Penghui wrote:
>> > >
> >
>>>> >> >> Dick Balaska ??:
>>>> >> >>
>>>> >> >>
>> >>
>>>>>> >>> >>> If /product_view.jsp is at the root of your tree (a top
level document),
>>>>>> >>> >>> surely it can not know how to go up above the root. This
is by design.
>>>>>> >>> >>>
>>>>>> >>> >>> I say it's at the root of the tree of the virtual host
based on the
>>>>>> >>> >>> parse error "/product_view.jsp(2,0)"
>>>>>> >>> >>>
>>>>>> >>> >>> dik
>>>>>> >>> >>>
>>>>>> >>> >>>
>>> >>>
>>>> >> >>
>>>> >> >> Thanks very much for your quick response.
>>>> >> >>
>>>> >> >> I am afraid that the product_view.jsp is NOT on the root of
the tree.
>>>> >> >> And i don't know why tomcat server add a slash in the front
of it.
>>>> >> >>
>>>> >> >> It's in product/product_view.jsp.
>>>> >> >>
>>>> >> >> But i think there maybe something wrong with the virtual host
>>>> >> >> configuration in server.xml.
>>>> >> >>
>>>> >> >> Here is my configuraiton about this virtual host:
>>>> >> >>
>>>> >> >>
>>>> >> >>
>> >>
>>>>>> >>> >>> <Host className="org.apache.catalina.core.StandardHost Source code of org.apache.catalina.core.StandardHost"
appBase="/home/test/wwwroot" autoDeploy="true"
configClass="org.apache.catalina.startup.ContextConfig Source code of org.apache.catalina.startup.ContextConfig"
contextClass="org.apache.catalina.core.StandardContext Source code of org.apache.catalina.core.StandardContext" debug="0"
deployXML="true"
errorReportValveClass="org.apache.catalina.valves.ErrorReportValve Source code of org.apache.catalina.valves.ErrorReportValve"
liveDeploy="true"
mapperClass="org.apache.catalina.core.StandardHostMapper"
name="test.jsp-test.bizcn.com" unpackWARs="true">
>>>>>> >>> >>> <Context path="" docBase="" reloadable="true" debug="0"/>
>>>>>> >>> >>> </Host>
>>>>>> >>> >>>
>>>>>> >>> >>>
>>> >>>
>>>> >> >> And the tomcat version is 5.5.20 offical package from the
>>>> >> >> http://tomcat.apache.org.
>>>> >> >>
>>>> >> >> Thanks again.
>>>> >> >>
>>>> >> >> Wang.
>>>> >> >>
>>>> >> >>
>>>> >> >>
>> >>
>>>>>> >>> >>> On 12/12/2006 1:22 AM also sprach Wang Penghui :
>>>>>> >>> >>>
>>>>>> >>> >>>
>>> >>>
>>>>>>>> >>>> >>>> Hello,
>>>>>>>> >>>> >>>>
>>>>>>>> >>>> >>>> I am using tomcat 5.5.20, apache 2.0 and mod_jk.so
to building a jsp
>>>>>>>> >>>> >>>> server on a RHEL 4.
>>>>>>>> >>>> >>>>
>>>>>>>> >>>> >>>> And there is a very strange problem here:
>>>>>>>> >>>> >>>>
>>>>>>>> >>>> >>>> There is a file named "headerCon.jsp" in the
document root of a virtual
>>>>>>>> >>>> >>>> host. And there is a folder named product. There is
a file named
>>>>>>>> >>>> >>>> product_view.jsp in the folder product.
>>>>>>>> >>>> >>>>
>>>>>>>> >>>> >>>> Here is a folder structure
>>>>>>>> >>>> >>>>
>>>>>>>> >>>> >>>> wwwroot--headerCon.jsp
>>>>>>>> >>>> >>>> |
>>>>>>>> >>>> >>>> -product/
>>>>>>>> >>>> >>>> |
>>>>>>>> >>>> >>>> -product_view.jsp
>>>>>>>> >>>> >>>>
>>>>>>>> >>>> >>>> And there are the follow sentences in product_view.jsp:
>>>>>>>> >>>> >>>>
>>>>>>>> >>>> >>>> <%@ page contentType="text/html; charset=gb2312"
language="java"
>>>>>>>> >>>> >>>> errorPage="" %>
>>>>>>>> >>>> >>>> <%@ include file ="../headerCon.jsp"%>
>>>>>>>> >>>> >>>> <%@ page import="com.longtopsystem.comm.*" %>
>>>>>>>> >>>> >>>> <%@ page import="com.handle.common.*" %>
>>>>>>>> >>>> >>>>
>>>>>>>> >>>> >>>> Then there web browser will show me the follow error
messages:
>>>>>>>> >>>> >>>>
>>>>>>>> >>>> >>>> HTTP Status 500 -
>>>>>>>> >>>> >>>>
>>>>>>>> >>>> >>>>
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
>>>>>>>> >>>> >>>>
>>>>>>>> >>>> >>>> type Exception report
>>>>>>>> >>>> >>>> message
>>>>>>>> >>>> >>>> description The server encountered an internal error
() that prevented
>>>>>>>> >>>> >>>> it from fulfilling this request.
>>>>>>>> >>>> >>>> exception
>>>>>>>> >>>> >>>> org.apache.jasper.JasperException Source code of org.apache.jasper.JasperException:
/product_view.jsp(2,0) File
>>>>>>>> >>>> >>>> "/../headerCon.jsp" not found
>>>>>>>> >>>> >>>>
org.apache.jasper.servlet.JspServletWrapper Source code of org.apache.jasper.servlet.JspServletWrapper
(JspServletWrapper.java:512)
>>>>>>>> >>>> >>>>
org.apache.jasper.servlet.JspServletWrapper Source code of org.apache.jasper.servlet.JspServletWrapper(JspServletWrapper.java:377)
>>>>>>>> >>>> >>>>
org.apache.jasper.servlet.JspServlet Source code of org.apache.jasper.servlet.JspServlet(JspServlet.java:314)
>>>>>>>> >>>> >>>>
org.apache.jasper.servlet.JspServlet Source code of org.apache.jasper.servlet.JspServlet(JspServlet.java:264)
>>>>>>>> >>>> >>>>
javax.servlet.http.HttpServlet Source code of javax.servlet.http.HttpServlet(HttpServlet.java:802)
>>>>>>>> >>>> >>>>
>>>>>>>> >>>> >>>>
>>>>>>>> >>>> >>>> root cause
>>>>>>>> >>>> >>>> org.apache.jasper.JasperException Source code of org.apache.jasper.JasperException:
/product_view.jsp(2,0) File
>>>>>>>> >>>> >>>> "/../headerCon.jsp" not found
>>>>>>>> >>>> >>>>
org.apache.jasper.compiler.DefaultErrorHandler Source code of org.apache.jasper.compiler.DefaultErrorHandler(DefaultErrorHandler
.java:39)
>>>>>>>> >>>> >>>>
org.apache.jasper.compiler.ErrorDispatcher Source code of org.apache.jasper.compiler.ErrorDispatcher(ErrorDispatcher.java:405)
>>>>>>>> >>>> >>>>
org.apache.jasper.compiler.ErrorDispatcher Source code of org.apache.jasper.compiler.ErrorDispatcher(ErrorDispatcher.java:86)
>>>>>>>> >>>> >>>>
org.apache.jasper.compiler.Parser Source code of org.apache.jasper.compiler.Parser(Parser.java:339)
>>>>>>>> >>>> >>>>
org.apache.jasper.compiler.Parser Source code of org.apache.jasper.compiler.Parser(Parser.java:372)
>>>>>>>> >>>> >>>>
org.apache.jasper.compiler.Parser Source code of org.apache.jasper.compiler.Parser(Parser.java:484)
>>>>>>>> >>>> >>>>
org.apache.jasper.compiler.Parser Source code of org.apache.jasper.compiler.Parser(Parser.java:1556)
>>>>>>>> >>>> >>>> org.apache.jasper.compiler.Parser Source code of org.apache.jasper.compiler.Parser(Parser.java:126)
>>>>>>>> >>>> >>>>
org.apache.jasper.compiler.ParserController Source code of org.apache.jasper.compiler.ParserController(ParserController.java:211)
>>>>>>>> >>>> >>>>
org.apache.jasper.compiler.ParserController Source code of org.apache.jasper.compiler.ParserController(ParserController.java:100)
>>>>>>>> >>>> >>>>
org.apache.jasper.compiler.Compiler Source code of org.apache.jasper.compiler.Compiler(Compiler.java:155)
>>>>>>>> >>>> >>>>
org.apache.jasper.compiler.Compiler Source code of org.apache.jasper.compiler.Compiler(Compiler.java:295)
>>>>>>>> >>>> >>>>
org.apache.jasper.compiler.Compiler Source code of org.apache.jasper.compiler.Compiler(Compiler.java:276)
>>>>>>>> >>>> >>>>
org.apache.jasper.compiler.Compiler Source code of org.apache.jasper.compiler.Compiler(Compiler.java:264)
>>>>>>>> >>>> >>>>
org.apache.jasper.JspCompilationContext Source code of org.apache.jasper.JspCompilationContext(JspCompilationContext.java:563)
>>>>>>>> >>>> >>>>
org.apache.jasper.servlet.JspServletWrapper Source code of org.apache.jasper.servlet.JspServletWrapper(JspServletWrapper.java:305)
>>>>>>>> >>>> >>>>
org.apache.jasper.servlet.JspServlet Source code of org.apache.jasper.servlet.JspServlet(JspServlet.java:314)
>>>>>>>> >>>> >>>>
org.apache.jasper.servlet.JspServlet Source code of org.apache.jasper.servlet.JspServlet(JspServlet.java:264)
>>>>>>>> >>>> >>>>
javax.servlet.http.HttpServlet Source code of javax.servlet.http.HttpServlet(HttpServlet.java:802)
>>>>>>>> >>>> >>>>
>>>>>>>> >>>> >>>>
>>>>>>>> >>>> >>>> note The full stack trace of the root cause is
available in the Apache
>>>>>>>> >>>> >>>> Tomcat/5.5.20 logs.
>>>>>>>> >>>> >>>>
>>>>>>>> >>>> >>>>
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
>>>>>>>> >>>> >>>>
>>>>>>>> >>>> >>>> Apache Tomcat/5.5.20
>>>>>>>> >>>> >>>>
>>>>>>>> >>>> >>>>
>>>>>>>> >>>> >>>> But if i copy the file headerCon.jsp to the product/
folder. and change
>>>>>>>> >>>> >>>> the line
>>>>>>>> >>>> >>>> <%@ include file ="../headerCon.jsp"%>
>>>>>>>> >>>> >>>> to
>>>>>>>> >>>> >>>> <%@ include file ="headerCon.jsp"%>
>>>>>>>> >>>> >>>> It works great.
>>>>>>>> >>>> >>>>
>>>>>>>> >>>> >>>> And i have also tried use a absolute path, it
doesn't work.
>>>>>>>> >>>> >>>>
>>>>>>>> >>>> >>>> I have digged this for a while, but no result. Could
someone pick me up?
>>>>>>>> >>>> >>>>
>>>>>>>> >>>> >>>> Every repsonse is appreciated.
>>>>>>>> >>>> >>>>
>>>>>>>> >>>> >>>> Best regards
>>>>>>>> >>>> >>>>
>>>>>>>> >>>> >>>> Wang.
>>>>>>>> >>>> >>>>
>>>>>>>> >>>> >>>>
>>>>>>>> >>>> >>>>
>>>>>>>> >>>> >>>>
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
>>>>>>>> >>>> >>>> To start a new topic, e-mail: users@(protected)
>>>>>>>> >>>> >>>> To unsubscribe, e-mail:
users-unsubscribe@(protected)
>>>>>>>> >>>> >>>> For additional commands, e-mail:
users-help@(protected)
>>>>>>>> >>>> >>>>
>>>>>>>> >>>> >>>>
>>>>>>>> >>>> >>>>
>>>>>>>> >>>> >>>>
>>>> >>>>
>>>>>> >>> >>>
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
>>>>>> >>> >>> To start a new topic, e-mail: users@(protected)
>>>>>> >>> >>> To unsubscribe, e-mail: users-unsubscribe@(protected)
>>>>>> >>> >>> For additional commands, e-mail:
users-help@(protected)
>>>>>> >>> >>>
>>>>>> >>> >>>
>>>>>> >>> >>>
>>>>>> >>> >>>
>>> >>>
>>>> >> >>
>>>> >> >>
>>>> >> >>
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
>>>> >> >> To start a new topic, e-mail: users@(protected)
>>>> >> >> To unsubscribe, e-mail: users-unsubscribe@(protected)
>>>> >> >> For additional commands, e-mail: users-help@(protected)
>>>> >> >>
>>>> >> >>
>>>> >> >>
>> >>
>> > >
>> > >
>> > >
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
>> > > To start a new topic, e-mail: users@(protected)
>> > > To unsubscribe, e-mail: users-unsubscribe@(protected)
>> > > For additional commands, e-mail: users-help@(protected)
>> > >
>> > >
> >



-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To start a new topic, e-mail: users@(protected)
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)


-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To start a new topic, e-mail: users@(protected)
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)



-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To start a new topic, e-mail: users@(protected)
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)


©2008 junlu.com - Jax Systems, LLC, U.S.A.