| Author |
Getting 404 when i forward request using request dispetcher
|
Jigar Naik
Ranch Hand
Joined: Dec 12, 2006
Posts: 744
|
|
Hi,
I have written a servlet which forward the request to jsp page, but i am getting 404 error code. Can anybody help me solving this issue.
Bellow is my servlet mapping in DD
Bellow is my servlet code.
And below is my JSP which is in the application root folder.
I am sending request from the same jsp and forwarding the request to the same jsp i am fetching some data and putting in the request attribute to display it on jsp.
Console
|
Jigar Naik
|
 |
Prashant Hurria
Ranch Hand
Joined: Mar 23, 2009
Posts: 40
|
|
It seems simple and Should work.
I tried on my system and it did.
The only way you get a 404 here is when the folder structure /ExcelUploadPOC/WebContent/upload.jsp
is under web-inf i.e. you have places your JSP
here: <Tomcat-Dir> \webapps\<WebApplicationName>\WEB-INF\ExcelUploadPOC/WebContent/upload.jsp
put it here it will work:
<Tomcat-Dir> \webapps\<WebApplicationName>\ExcelUploadPOC/WebContent/upload.jsp
Let me know if it solves the issue.
|
 |
Hebert Coelho
Ranch Hand
Joined: Jul 14, 2010
Posts: 754
|
|
|
Is the tag "<servlet>" closed? Up there in the code you posted still opened...
|
[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
|
 |
Jigar Naik
Ranch Hand
Joined: Dec 12, 2006
Posts: 744
|
|
Hebert Coelho wrote:Is the tag "<servlet>" closed? Up there in the code you posted still opened...
yeah the tag is closed, i just missed it while copy on the forum.
|
 |
Jigar Naik
Ranch Hand
Joined: Dec 12, 2006
Posts: 744
|
|
Prashant Hurria wrote:It seems simple and Should work.
I tried on my system and it did.
The only way you get a 404 here is when the folder structure /ExcelUploadPOC/WebContent/upload.jsp
is under web-inf i.e. you have places your JSP
here: <Tomcat-Dir> \webapps\<WebApplicationName>\WEB-INF\ExcelUploadPOC/WebContent/upload.jsp
put it here it will work:
<Tomcat-Dir> \webapps\<WebApplicationName>\ExcelUploadPOC/WebContent/upload.jsp
Let me know if it solves the issue.
Hi Prashant,
Actually the JSPs are not underthe WEB-INF folder. I can access the jsp using below url
http://localhost:7001/ExcelUploadPOC/upload.jsp
I thought it has the problem with build, but even after cleaning, rebuild, restarting the weblogic, restarting the IDE, restarting the computer issue is still persist.
|
 |
Prashant Hurria
Ranch Hand
Joined: Mar 23, 2009
Posts: 40
|
|
|
I tested it on Tomcat. I have seen people facing strange issues on JBoss,Weblogic and most of the time it turns out to be problems like using \ insted of / and other similar things. I will ask a friend who faced a similar issue and will get back to you. In the meanwhile you can google the problem with Weblogic as additional keyword (I am sure you would have done already.)
|
 |
Jigar Naik
Ranch Hand
Joined: Dec 12, 2006
Posts: 744
|
|
|
Ya i have already done the google exercise... Currently i am setting attributes in session and using response.sendRedirect(String). And its working fine as a temperory workaround.
|
 |
 |
|
|
subject: Getting 404 when i forward request using request dispetcher
|
|
|