File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to see jsp output in eclipse

 
Priety Sharma
Ranch Hand
Posts: 156
Android Eclipse IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Mohamed Sanaulla
Saloon Keeper
Pie
Posts: 3159
33
Google App Engine Java Ruby
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Priety Sharma
Ranch Hand
Posts: 156
Android Eclipse IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 377
Android Java Spring
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Priety Sharma
Ranch Hand
Posts: 156
Android Eclipse IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic