• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Web.XMl in JSP

 
Gaurav x Jain
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • 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.

 
Ifteqar Ahmed
Ranch Hand
Posts: 85
Java Linux MySQL Database
  • Mark post as helpful
  • send pies
  • 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
  • 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
Java Linux MySQL Database
  • Mark post as helpful
  • send pies
  • 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......
 
Ankit Nagpal
Ranch Hand
Posts: 47
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • 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
  • 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
Java Linux MySQL Database
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Still genrating Error
 
sri ramvaithiyanathan
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • 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
 
Rupesh Mhatre
Ranch Hand
Posts: 35
Eclipse IDE Hibernate jQuery
  • Mark post as helpful
  • send pies
  • 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
  • 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
Eclipse IDE Hibernate jQuery
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic