We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

want to learn JSP ...plz help

cofactor
cofactor asked
on
Medium Priority
1,103 Views
Last Modified: 2012-06-21
hi,i know java.  i write java codes in Jcreator and  use sun SDK1.5 beta version . now,  i want to learn  JSP

i have no idea, what are the softwares needed to learn JSP. after reading first 2 pages from a tutorial , i came to know i need a software to run JSP programs.

 
plz will  you tell me what are the good softwares  needed to run JSP codes and  where can i get those? this is my first time to JSP. any kind of information is appreciated.
my PC has Windows-Xp operating System.

waiting for the response

thanks
Comment
Watch Question

Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:

Author

Commented:
hi, i  went to download>binary  and found there lots of binaries.which one is usefull ?
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:

Author

Commented:
hi, i already downloaded that and was trying to startup. but it is not starting yet.....i am facing some problem........

i  am following this link >  http://www.onjava.com/pub/a/onjava/2001/03/29/tomcat.html
it deals with the configauration visually.



The downloaded distribution  also  has one RUNNING .TXT which says > i am excerpting from that





--------------------------------------------------------------------------------------------------------------------
$Id: RUNNING.txt,v 1.3 2003/09/08 10:10:23 remm Exp $


                 Running The Tomcat 5 Servlet/JSP Container
                 ==========================================

This subproject contains Tomcat 5, a server that implements the Servlet 2.4
and JSP 2.0 specifications from the Java Community Process
<http://www.jcp.org/>.  In order to install and run this container, you must do
the following:


(0) Download and Install a Java Development Kit

* Download a Java Development Kit (JDK) release (version 1.3 or later) from:

    http://java.sun.com/j2se/

* Install the JDK according to the instructions included with the release.

* Set an environment variable JAVA_HOME to the pathname of the directory
  into which you installed the JDK release.


(1) Download and Install the Tomcat 5 Binary Distribution

NOTE:  As an alternative to downloading a binary distribution, you can create
your own from the Tomcat source repository, as described in "BUILDING.txt".
If you do this, the value to use for "${catalina.home}" will be the "dist"
subdirectory of your source distribution.

* Download a binary distribution of Tomcat from:

    http://jakarta.apache.org/site/binindex.cgi

* Unpack the binary distribution into a convenient location so that the
  distribution resides in its own directory (conventionally named
  "jakarta-tomcat-5").  For the purposes of the remainder of this document,
  the symbolic name "$CATALINA_HOME" is used to refer to the full
  pathname of the release directory.


(2) Start Up Tomcat 5

Tomcat 5 can be started by executing the following commands:

      $CATALINA_HOME\bin\startup.bat          (Windows)

      $CATALINA_HOME/bin/startup.sh           (Unix)

After startup, the default web applications included with Tomcat 5 will be
available by visiting:

    http://localhost:8080/

Further information about configuring and running Tomcat 5 can be found in
the documentation included here, as well as on the Tomcat web site:

    http://jakarta.apache.org/tomcat/


(3) Shut Down Tomcat 5

Tomcat 5 can be shut down by executing the following command:

      $CATALINA_HOME\bin\shutdown            (Windows)

      $CATALINA_HOME/bin/shutdown.sh         (Unix)

-------------------------------------------------------------------------------------------------------------
and troubleshooting and advanced configauration etc etc.









Now what i did (according to the advice of my above configauration link)

first of all, i did  RENAMED   the distribution jakarta-tomcat-5.0.4   to    tomcat and kept it in     C:\tomcat  

 then i changes system  variables( from control panel) like below .

1.  variable name   :   JAVA_HOME             variable value :   C:\Program Files\Java

2.  variable name    :  TOMCAT_HOME        variable value :  C:\tomcat


then i went to commmand prompt  and typed  

 C:\>tomcat\bin\startup.bat
The CATALINA_HOME environment variable is not defined correctly
This environment variable is needed to run this program.


can you tell  whats   has been gone wrong ?



NOTE :

i am giving more information. i have windows-xp  OS.

AND  my java directory is in   C:\Program Files\Java.   This java folder has  J2re1.50 and  J2sdk1.50 subdirectory.

whats wrong i have done ? how can i make it  ok ?

thanks


Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
> 2.  variable name    :  TOMCAT_HOME        variable value :  C:\tomcat

Change the name of this var to CATALINA_HOME

Author

Commented:
ok.. i did that  CATALINA_HOME ....still not working.

 as soon as i  gone to the  C:\>tomcat\bin\startup.bat  -----command prompt vanished.

nothing happened.
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
getting a little further :)

try:

startup run

this should help you see what the error is.

Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
sorry that should be:

catalina run

must be time for me to get some sleep

Author

Commented:
hi...not been sucessful. i did

C:\>catalina run
'catalina' is not recognized as an internal or external command,
operable program or batch file.

i dont understand what has gone wrong.
 

anyway... is there any other software which will do the same job ? preferably which has GUI so that it can connect to the server and  i could run JSP codes.

thanks


>>my java directory is in   C:\Program Files\Java.   This java folder has  J2re1.50 and  J2sdk1.50 subdirectory

JAVA_HOME should point to the "bin" directory of your java installation. Say, if ur distribution is in the following directory, c:\java\bin then JAVA_HOME should be c:\java  . I believe in ur case it would be c:\program files\java\j2sdk1.50  . Try this and let me know
>> anyway... is there any other software which will do the same job ? preferably which has GUI so that it can connect to the server and  i could run JSP codes.

As of now, all you are doing is trying to set up the server. So, we havent come to the part where u would need the GUI. After setting up the server, u might want to download an IDE like "Gel" or "NetBeans" or "JBuilder". These are a few of the better IDEs I have worked with in the past.

Vikkki
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
> 'catalina' is not recognized as an internal or external command,

You need to specify the full path if tomcats bin directory is not in your path

\tomcat\bin\catalina.bat run

Author

Commented:

 vikram
-----------

i changed  in the JAVA_HOME
c:\program files\java\j2sdk1.50  




so currently,my setting is

JAVA_HOME     ---------- >        C:\Program Files\Java\j2sdk1.5.0

CATALINA_HOME -------->         C:\tomcat


C:\tomcat\bin>startup.bat  --------> nothing happened.






OBJECTS
------------------------------------------------------------------------------------------------------------

i have changed the settings  as above . then i did

C:\tomcat\bin>catalina.bat run

and getting the results like below ... i am copying from the command prompt whtever i am getting .

C:\tomcat\bin>catalina.bat run
Using CATALINA_BASE:   C:\tomcat
Using CATALINA_HOME:   C:\tomcat
Using CATALINA_TMPDIR: C:\tomcat\temp
Using JAVA_HOME:       C:\Program Files\Java\j2sdk1.5.0
Mar 25, 2004 6:43:49 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on port 8080
Mar 25, 2004 6:43:50 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 3953 ms
Mar 25, 2004 6:43:50 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Mar 25, 2004 6:43:50 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.0.19
Mar 25, 2004 6:43:50 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Mar 25, 2004 6:43:50 PM org.apache.catalina.core.StandardHost getDeployer
INFO: Create Host deployer for direct deployment ( non-jmx )
Mar 25, 2004 6:43:50 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Processing Context configuration file URL file:C:\tomcat\conf\Catalina\loc
alhost\admin.xml
Mar 25, 2004 6:43:53 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=tru
e
Mar 25, 2004 6:43:53 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNul
l=true
Mar 25, 2004 6:43:54 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.webapp.admin.ApplicationResources', retur
nNull=true
Mar 25, 2004 6:44:04 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Processing Context configuration file URL file:C:\tomcat\conf\Catalina\loc
alhost\balancer.xml
Mar 25, 2004 6:44:05 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Processing Context configuration file URL file:C:\tomcat\conf\Catalina\loc
alhost\manager.xml
Mar 25, 2004 6:44:05 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Installing web application at context path /jsp-examples from URL file:C:\
tomcat\webapps\jsp-examples
Mar 25, 2004 6:44:06 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Installing web application at context path  from URL file:C:\tomcat\webapp
s\ROOT
Mar 25, 2004 6:44:06 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Installing web application at context path /servlets-examples from URL fil
e:C:\tomcat\webapps\servlets-examples
Mar 25, 2004 6:44:07 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Installing web application at context path /tomcat-docs from URL file:C:\t
omcat\webapps\tomcat-docs
Mar 25, 2004 6:44:07 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Installing web application at context path /webdav from URL file:C:\tomcat
\webapps\webdav
Mar 25, 2004 6:44:08 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on port 8080
Mar 25, 2004 6:44:09 PM org.apache.jk.common.ChannelSocket init
INFO: JK2: ajp13 listening on 0.0.0.0/0.0.0.0:8009
Mar 25, 2004 6:44:09 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=16/765  config=C:\tomcat\conf\jk2.properties
Mar 25, 2004 6:44:09 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 19265 ms
|


-----------------------------------------------------------------------------------------------------------------





i dont understand  those technical terms ......am i connected to the server ?  if so how do i run the simplest JSP code ? i use Jcreator IDE.

thanks



Author

Commented:
hi, usually i connect to unix server through TELNET  and write codes c/c++ in vi editor . my problem is  here how do i use tomcat to run jsp codes?

say i  want  this program

hello.jsp
----------
<HTML>
<BODY>
Hello, world
</BODY>
</HTML>


to run. how do i start ?

Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
looks like it is starting up ok.

try loading http://127.0.0.1:8080/jsp-examples

Author

Commented:
hi, the link that you have given is opening in my browser(IE). i tried to run a JSP code copied from jsptut.com. but it is not running. probabily i am wrong how to run the code.

what i did , i am giving below the steps

step 1 > first of all i started  Tomcat server by  typing on the command line  
c:\tomcat\bin\catalina.bat  run


step 2 > i opened my Jcreator IDE and then   new empty  project > add file > JSP application

step3 > i copied and pasted this code from jsptut.com and gave file name hello.jsp

  <HTML>
<BODY>
Hello!  The time is now <%= new java.util.Date() %>
</BODY>
</HTML>


step 4 > i  compiled  and execute file from the Jcreator menu . it gave lots of exceptions .

probabily i have to link the  code to the server.



can you tell how can i run the code. what i have to do ?  does Jcreator need to configauration to run Jsp codes. what is that ?

i want to run the code . what should i do . can you give some steps? is there any other IDE do i need ?
You need to paste the JSP file in ur "tomcat\webapps\yourfolder".  Create some folder and replace "youfolder" with the folder u have created. Else, you can paste the jsp file into the "tomcat\webapps\ROOT" folder.

If u have used the latter method, type "http://localhost:8080/jspfile.jsp" .. If u have used the former method, type "http://localhost:8080/yourfolder/jspfile.jsp" to run it. U neednt have to compile it, tomcat would do it for u.

If the above doesnt work, there is a possibility that tomcat is running on a different port than the normal. Try giving  "http://localhost/jspfile.jsp" without the port number in both cases and check it out.

All the best
Vikram.

Author

Commented:

hi, i could not make it. i tried various way but no sucesses. i am writing below.....


trial 1
------

step 1 . i copied jsp file (i wrote in a notepad and  gave a name  testjsp.jsp  )  and pasted it into the ROOT folder . then checked  with

  http://localhost:8080/testjsp.jsp -----> The requested URL could not be retrieved

  http://localhost/testjsp.jsp -------------> The requested URL could not be retrieved









here is my another attempt......

trial 2
--------

there was no folder called "yourfolder"in  C:\tomcat\webapps\.  However i  created a new folder and gave it a name "myfolder". then checked like below


 http://localhost:8080/myfolder/testjsp.jsp -----> The requested URL could not be retrieved
 http://localhost/myfolder/testjsp.jsp ------------->The requested URL could not be retrieved


here is the code for


testjsp.jsp
------------
 <HTML>
<BODY>
Hello!  The time is now <%= new java.util.Date() %>
</BODY>
</HTML>





i did not get sucesses. but my server is starting up as soon as i type c:\tomcat\bin\catalina.bat run

is there anything wrong in my attempt ?

thanks
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
hi vikram thanks.... it is working now....jsp file is running perfectly.... can you plz tell me which version of tomcat is bugless( as you have pointed out  tomcat 5  sever.xml and web.xml has got some problem ) ? what about others tomcat4 or tomcat 3 ? are they free of bugs ?

well, i  have found a good tutorial from jsptut.com and will  read lessons from that .

thanks
 
Hai. Nice to hear that your problem is solved..

This is not a bug in version 5. It is just a few configuration tweaks that need to be done. Version 5 is the best, and i would recommend u carry on with it..

All the best with your jsp.

Vikram.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.