Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to run a simple jsp?  RSS feed

 
sanjana sanjay
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • 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>
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • 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
  • 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???
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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!!!
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please drop the habit of using multiple question and exclamation marks; single ones are quite sufficient.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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: 42970
73
  • Mark post as helpful
  • send pies
  • 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?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!