• 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

Unable to see jsp output in eclipse

 
Ranch Hand
Posts: 156
Android Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 377
Android Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: https://coderanch.com/t/492064/JSP/java/Jsp-under-WEB-INF

Sean
 
Priety Sharma
Ranch Hand
Posts: 156
Android Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Evacuate the building! Here, take this tiny ad with you:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic