| Author |
Unable to see jsp output in eclipse
|
Priety Sharma
Ranch Hand
Joined: Jun 10, 2008
Posts: 156
|
|
I created a web project in eclipse.
I added tomcat 5.0 server through the server tab.
I created a simple jsp. I has just one line in the body which says. Welcome jsp.
Now how do I see the the output of this jsp?
What I tried:
I right clicked on the jsp and clicked on Run on Server.
The tomcat server starts but no output appears. No browser opens.
What do I do? What is the way to get this running?
Some changes:
The no browser opens problem is gone.
It was trying to open firefox and could not find it.
So I changed it to "internal browser".
Now when I run it the browser opens.
The url shown is : http://localhost:8080/mywebpro/WEB-INF/jspone.jsp
Now I get status 404.
It says the requested resource is not available.
What do I do now?
|
Priety.
|
 |
Mohamed Sanaulla
Bartender
Joined: Sep 08, 2007
Posts: 2927
|
|
What is the name of the JSP? And I suppose it is at the root of the application you are trying to deploy.
The URL mostly would be: http://localhost:8080/mywebpro/<jspname>
And I dont know why the JSP is in the WEB-INF folder.
|
Mohamed Sanaulla | My Blog
|
 |
Priety Sharma
Ranch Hand
Joined: Jun 10, 2008
Posts: 156
|
|
Hi Mohamed,
Thanks for the reply.
I dont know what I was thinking, the jsp should be outside of the WEB-INF folder.
The name of the jsp is jspone.jsp
Thanks a lot. I think things should be working now.
|
 |
Sean Clark
Rancher
Joined: Jul 15, 2009
Posts: 377
|
|
Hey,
If you are going for the MVC approach the you probably want your JSPs to be under the WEB-INF folder. It makes sense there as you do not want people accessing your jsps directly without going through a Servlet. For example your servlet may load some data from the database and put it in the request so that your JSP page can then display it.
If you were able to access the JSP directly then you'd just get some nasty looking error message because the data would not be there, not very professional.
Here is a good link here: http://www.coderanch.com/t/492064/JSP/java/Jsp-under-WEB-INF
Sean
|
I love this place!
|
 |
Priety Sharma
Ranch Hand
Joined: Jun 10, 2008
Posts: 156
|
|
Hi Mohamed,
I put the jsp in the webcontent folder and now its working fine.
Thanks again.
Hi Sean,
Thanks for the link. I would be trying the "jsp's under WEB-INF folder" approach too.
|
 |
 |
|
|
subject: Unable to see jsp output in eclipse
|
|
|