File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Web.XMl in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Web.XMl in JSP" Watch "Web.XMl in JSP" New topic
Author

Web.XMl in JSP

Gaurav x Jain
Ranch Hand

Joined: Feb 01, 2011
Posts: 39
Hi Friends

I am trying to run jsp application without using any IDE for that I put all my stuffs in WebApps folder.Below is structure of project


But still I am getting following error. Please help me



HTTP Status 404 - /TestJSP/

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

type Status report

message /TestJSP/

description The requested resource (/TestJSP/) is not available.

Ifteqar Ahmed
Ranch Hand

Joined: May 02, 2011
Posts: 85

Hi,

Solution -> the directory structure should be like this

Gaurav x Jain
Ranch Hand

Joined: Feb 01, 2011
Posts: 39
Thank you for the directory structure. One more thing I want to know what I should write in web.xml file because I am still getting the same problem. I think it is because of web.xml details. Please help me.
Ifteqar Ahmed
Ranch Hand

Joined: May 02, 2011
Posts: 85

in web.xml add an entry just like a servlet for jsp page

<servlet>
<servlet-name>a</servlet-name>
<jsp-file>/test.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>a</servlet-name>
<url-pattern>/anyURL/<url-pattern>
</servlet-mapping>


Refer Head First Servlets and JSP for your clear understanding......
Ankit Nagpal
Ranch Hand

Joined: Sep 09, 2008
Posts: 47

Hi Gaurav/John,

The structure is fine even if we put web.xml as specified by Gaurav. I could see a few issues here:

1) you are giving the URL http://localhost:<port>/TestJSP/ but missing the filename test.jsp after that. It won't pick up the jsp file by default until we specify the filenames to be picked in the web.xml file.

Or

2) Remember that the names are case-sensitive, TestJSP is different from testJSP/TestJsp etc.
Gaurav x Jain
Ranch Hand

Joined: Feb 01, 2011
Posts: 39
Hi Friends

I am accessing this link http://localhost:8080/TestJSP/Test.jsp and genrating same error.Please find the directory structure,web.xml file details and errors as below:

1. Directory Structure where Test.Jsp is jsp page, TestJSP is project folder


2. Web.xml (details)
------------------
3. Error
---------

HTTP Status 404 -

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

type Status report

message

description The requested resource () is not available.


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

Apache Tomcat/6.0.26

Ifteqar Ahmed
Ranch Hand

Joined: May 02, 2011
Posts: 85

posted Today 12:34:05
Hi Friends

I am accessing this link http://localhost:8080/TestJSP/Test.jsp and genrating same error.Please find the directory structure,web.xml file details and errors as below:

1. Directory Structure where Test.Jsp is jsp page, TestJSP is project folder


2. Web.xml (details)
------------------

access this

http://localhost:8080/TestJSP
Gaurav x Jain
Ranch Hand

Joined: Feb 01, 2011
Posts: 39
Still genrating Error
sri ramvaithiyanathan
Ranch Hand

Joined: Nov 20, 2010
Posts: 109
place welcome file list in your web.xml file.
Check the jsp path and name twice.
run your application http://localhost:your_port_number/your_war_name or your_ear_name

Hope it helps


For java examples,ebooks,interview questions,visit this blog
http://periodicupdates.blogspot.com/
Rupesh Mhatre
Ranch Hand

Joined: Apr 29, 2011
Posts: 35

Please try http://localhost:8080/TestJSP/TestJSP
Gaurav x Jain
Ranch Hand

Joined: Feb 01, 2011
Posts: 39
Error is still same: I think i am not writing correct code in web.xml. Please help me
Rupesh Mhatre
Ranch Hand

Joined: Apr 29, 2011
Posts: 35

I am attaching a war file just in case if this can help you. Access the application using http://localhost:8080/TestJsp/TestJSP
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60732
    
  65

Gaurav x Jain wrote:Error is still same: I think i am not writing correct code in web.xml. Please help me


UseCodeTags ⇐ read this

Use code tags to post your folder structure - the ones you've posted so far aren't formatted to tell us where the files really are. Also post your web.xml. If you are just using JSPs for now, it doesn't need to contain much.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Web.XMl in JSP
 
Similar Threads
Cannot print exception message
Only a type can be imported. mypackage.StringManipulation resolves to a package
debugging jsp in eclipse
security constraint - not working
deploying my webapplication on tomcat