• 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

how to run a simple jsp?

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hiii!!!

i m beginner of jsp. can anyone tell me how to run a simple jsp program
and what are the settings(environment variables) which are required to run a jsp programs???



let the jsp program be

<h1>my first jsp</h1>
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Running JSP is a function of a web server that implements the Java API for servlets and JSP.

Therefore your first step will be to install such a server on your local machine - Tomcat is the usual choice. A simple search will find the site to download from. Choose the zipped download that lets you install Tomcat as an application (as opposed to a service).

Tomcat comes with a nice selection of JSP an servlet examples - get them running before trying your own.

Bill
 
sanjana sanjay
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have deployed many servlets on my system!!!
all were running perfectly!!!
but when i try to run a simple jsp as shown above, i m left with "404: resource not available error"

my first.jsp is in test folder and i deployed it by placing in webapps folder
and my url is http://localhost:8086/test/first.jsp
bt i am left with 404 error


can you please help me out in solving this issue???
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just as for servlets, the JSP must be within a web context. So placing it directly within webapps is useless.Create a folder within webapps in which to place your web app, which can include your JSP.

By the way, JSPs are templates for views, rather than "programs" -- I sure hope that you are not planning on putting Java code in your JSPs? :shock:
 
sanjana sanjay
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Just as for servlets, the JSP must be within a web context. So placing it directly within webapps is useless.Create a folder within webapps in which to place your web app, which can include your JSP.

By the way, JSPs are templates for views, rather than "programs" -- I sure hope that you are not planning on putting Java code in your JSPs? :shock:





i have created a folder test and init i placed my first.jsp and then i placed my test folder in webapps folder of tomcat!!!

but still i am getting "404: resource not available error"

why do you think it is happening???
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No WEB-INF? No web.xml? If not, no web app.

Again, JSPs are not "programs" that you run. They are the view component of a web app. To be used with servlets and other Java class; not instead of them.
 
sanjana sanjay
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok !! i have created test folder, in that WEB-INF and first.jsp and in WEB-INF i created web.xml file

web.xml:
<web-app>
</web-app>

url : http://localhost:8086/test/first.jsp

error:404 requested resource not available!!!
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please drop the habit of using multiple question and exclamation marks; single ones are quite sufficient.
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
8086?

You're going to have to put some effort into these questions. Give us the exact setup and what you've done. 8086 is not the standard port.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There seems to be web server running on that port, though, otherwise there would not be an HTTP response 404. And "404 requested resource not available" sounds like a Tomcat error message.

Post the directory and file layout of the "test" directory. It is inside of "webapps", right, and you did restart Tomcat after creating it, right?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic