• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Web.XMl in JSP

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Ranch Hand
Posts: 85
MySQL Database Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Solution -> the directory structure should be like this

 
Gaurav x Jain
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 85
MySQL Database Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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......
 
Ranch Hand
Posts: 47
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 85
MySQL Database Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Still genrating Error
 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 35
Hibernate jQuery Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please try http://localhost:8080/TestJSP/TestJSP
 
Gaurav x Jain
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Error is still same: I think i am not writing correct code in web.xml. Please help me
 
Rupesh Mhatre
Ranch Hand
Posts: 35
Hibernate jQuery Eclipse IDE
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am attaching a war file just in case if this can help you. Access the application using http://localhost:8080/TestJsp/TestJSP
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic