How to run jsp file in Apache Tomcat 5.0?

hi,
i'm using jdk1.5,jsp1.2 & Apache Tomcat 5.0 as a web server.in my application i have 2 jsp files,1 html file & 1 javabean class.where i must place the html,jsp files and the .java file & .class file for a bean class.how to run this application.
bean class:
public class Userdata {
private String username;
private String email;
private int age;
public void setUsername( String value )
username = value;
public void setEmail( String value )
email = value;
public void setAge( int value )
age = value;
public String getUsername() { return username; }
public String getEmail() { return email; }
public int getAge() { return age; }
getname.html file:
<HTML>
<BODY>
<FORM METHOD=POST ACTION="Savename.jsp">
What's your name? <INPUT TYPE=TEXT NAME=username SIZE=20><BR>
What's your e-mail address? <INPUT TYPE=TEXT NAME=email SIZE=20><BR>
What's your age? <INPUT TYPE=TEXT NAME=age SIZE=4>
<P><INPUT TYPE=SUBMIT>
</FORM>
</BODY>
</HTML>
savename.jsp file:
<jsp:useBean id="user" class="Userdata" scope="session"/>
<jsp:setProperty name="user" property="*"/>
<HTML>
<BODY>
Continue
</BODY>
</HTML>
nextpage.jsp file:
<jsp:useBean id="user" class="Userdata" scope="session"/>
<HTML>
<BODY>
You entered<BR>
Name: <%= user.getUsername() %><BR>
Email: <%= user.getEmail() %><BR>
Age: <%= user.getAge() %><BR>
</BODY>
</HTML>
refer these source code and plz,give the result at the earliest.
whether i want to write a web.xml file for this jsp file.
if yes,means plz present the web.xml file for this application.
plz,if anybody knows give me detailed description for this application.

create a dir under webapps dir
place your .html and .jsp files here
also create WEB-INF dir here
Under WEB-INF create classes and lib dir
under classes dir put your .class file
You also need to put web.xml under your WEB-INF dir.
You ca keep your java file any where u want on your computer.

Similar Messages

  • How to run different versions of Apache Tomcat on one machine?

    Hi, I am developing a web application. My application runs on Apache Tomcat 5.5.12 and i am using jdk 1.5_03. My application detects files that are automatically scanned to a specific directory and queues them for capture in a database.
    The scanner software (HP Toolbox) is also a web application (Unfortunately), it installs itself with Apache Tomcat 4.03. It is "wired" in a specialised way (not the way you would usually deploy web apps). So the Web server is customised by HP (Hewlett-Packard).
    The scanner needs this software running inorder to automatically scan to a specified folder. You can only specify local directories to scan to from the Toolbox application
    There seems to be some resource conflict when I run my version of Tomcat when the Toolbox application is running (I get an exception
    ..IllegalMonitorState...current thread not owner). Visa vera is alos true..if i start my application first the Toolbox application won't run.
    I tried to install the Toolbox app on another machine and monitor a directory remotely...this doesn't work because you can't read or write to remote files from a servlet or JSP.
    I tried loading my application in the web apps directory of Apache 4.03 but it did not detect my application. I don't know how to configure the Tomcat customised by HP.
    How can i go about this problem? Is there a way of running two versions of Apache Tomcat on one machine?
    Thanks
    Parthiv

    This is the exception i get when i try to run my version of Apache Tomcat when the Toolbox is running: My application is set to port 80.
    Exception in thread "http-80-1" java.lang.IllegalMonitorStateException: current thread not owner
         at java.lang.Object.notifyAll(Native Method)
         at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1216)
         at java.lang.Thread.run(Unknown Source)

  • How to run jsp in tomcat server

    hi this is satish1529,
    i am new to jsp technology,i have written small jsp file and html file,i don't know where to place jsp and html files in tomcat server and where i have to do setting in the server and how to run jsp file. pls give me step by step describing how to run jsp in tomcat server.
    i am showing u files
    this is jsp file
    <html>
    <body>
    <center> data recieved from client <center>
    <%
    String s= request.getParameter("t1");
    String a= request.getParameter("t2");
    %>
    username :<%=s%><br>
    address :<%=a%>
    </body>
    </html>
    this is html file
    <html>
    <body>
    <form action="http://localhost:8080/form.jsp">
    enter name <input type="text" name="t1"> <br>
    enter address <textarea name="t2"> </textarea> <br>
    <input type="submit" vaule="login">
    </form>
    </body>
    </html>

    Thanx a lot for ur promt reply.
    we r succful in running simple jsp in tomcat6.0.
    bt one more problem occured as following when we r trying to run jsp file in tomcat.
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: /main1.jsp(1,1) The value for the useBean class attribute webCounter is invalid.
         org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
         org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
         org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
         org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1200)
         org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1155)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2336)
         org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2386)
         org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2392)
         org.apache.jasper.compiler.Node$Root.accept(Node.java:489)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2336)
         org.apache.jasper.compiler.Generator.generate(Generator.java:3374)
         org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:210)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:306)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    note The full stack trace of the root cause is available in the Apache Tomcat/6.0.13 logs.

  • How to Run JSP in Tomcat Server 3.3.2

    Hi all,
    i have just installed tomcat server 3.3.2 in my system which as windows xp home edition as a operating system and no problem i can able to start the tomcat server.But the problem is that i dont no how to run jsp in tomcat i listed some of my problems below..
    How to put my jsp file in the virtual directory(default and also i want to create ) then tell me how use IE to run the JSP file.
    Thanks in advance..
    With Regards
    Vijay

    Hi all,
    i have just installed tomcat server 4.1 in my
    system which as windows NT 4.0 home edition as a
    operating system and no problem i can able to start
    the tomcat server.But the problem is that i dont no
    how to run jsp in tomcat i listed some of my problems
    below..
    How to put my jsp file in the virtual
    directory(default and also i want to create ) then
    tell me how use IE to run the JSP file.
    Thanks in advance..
    With Regards
    Baliram

  • Unable to run JSP file in TOmcat

    My Tomcat is running when i type http://localhost:8080/index.jsp , i'm able to see home page
    CLASSPATH=C:\j2sdk1.4.2_08\bin;E:\Grinder;E:\Grinder\lib\grinder.jar;C:\Program Files\Java\j2re1.4.2_08\lib\grinder.jar;
    JAVA_HOME=C:\j2sdk1.4.2_08
    I tried both pointing to JAVA_HOME C:\Program Files\Java\j2re1.4.2_08
    When i try to run the JSP file under C:\Tomcat 5.0\webapps\ROOT\add.jsp. I'm getting following error.
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: Unable to compile class for JSP
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:97)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:346)
         org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:414)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    Unable to find a javac compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK
         org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:106)
         org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:935)
         org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:764)
         org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:382)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

    I know the same.
    But problem is that whenever I am creating a new file containing single line say 'Hello world' and then try to run,
    the similar type of error msg comes.

  • How can I run two instances of apache tomcat in the same machine.

    Hi
    Can I run 2 instances of apache tomcat in the same machine.If yes then how.?

    Yes, you can. Just run 2 instances. Make sure that they run on different ports.

  • How to run ear file in java application server

    i want how to run .ear file in java application server
    1. i m created ear file
    2. i m created jar file (bean,home,remote)
    3.i m created war file(in the form of jsp)
    but till now i couldnt run ear file
    how to run
    please hel me

    You must create :
    1.Jar file
    2.War file
    And then put them into an ear file
    Exemple : myapp.ear contains
    myappEJB.jar
    myappWEB.war
    META-INF/application.xml
    and application.xml looks like this :
    <application xmlns="http://java.sun.com/xml/ns/j2ee" version="1.4"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com /xml/ns/j2ee
                            http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
        <display-name>myapp</display-name>
        <description>Demo application</description>
        <module>
            <ejb>myappEJB.jar</ejb>
        </module>
        <module>
          <web>
             <web-uri>myappWAR.war</web-uri>
             <context-root>/myapp</context-root>
          </web>
        </module>
    </application>Good luck

  • How to run JSP/Servlet in AIX?

    how to run JSP/Servlet in AIX?
    I am no ideas about it,
    can anyone tell me?
    what webserver i should use?
    have to install JDK?

    The only successful way that I have been able to run servlets in an AIX environment is with the IBM Http Server (specific version of Apache)/WebSphere combination, with WebSphere as the servlet engine. I have tried (unsuccessfully) to use JRun and Apache in AIX environment, but could never get JRun to function properly.

  • How to run .exe files with Virtual PC for Mac

    Hey Guys, I'm new around here and with mac technology as well. Anyway, I have an iMac OS X 10.5.1 Leopard and I've recently purchased the Virtual PC for Mac 7.0.2 software. So I'd like to know how to use this program properly, because I need to run some executable files in my computer. It is confusing for me because I don't know how to get started, and I only get to the part when it says "OS not found, Install an OS on this hard drive".
    Honestly I've no idea of what an OS is or where do I get that. So I'd really appreciate if one of you guys could tell me, step by step, what to do to use Virtual PC properly, and finally learn how to run .exe files on mac.
    Thanks in advance!
    Have a nice day!

    Always nice to see new faces
    Honestly I've no idea of what an OS is or where do I get that.
    This brings up the second part of your problem. The first part is setting up either a proper Virtual Machine program like Parallels or VMfusion, or setting up a Boot Camp partition on your drive.
    http://www.parallels.com/
    http://www.vmware.com/products/fusion/
    OS stands for Operating System. You are running Leopard 10.5.7 as an operating system on your Mac (MacOS X).
    The second part of your problem - You will need a copy of Windows XP or Vista if you want to run Windows on your Mac.
    There is at least one other solution for running Windows programs on a Mac. It's called "CrossOver" by a company named 'Codeweavers'. It's based on a project for "Wine" to be able to run PC programs on a Mac or Linux, without having to buy or install Windows. It works with a narrow subset of Windows programs so you would want to make sure the program you want to run is compatible with CrossOver before you buy it.
    http://www.codeweavers.com/products/cxmac/
    In addition to all the above information, you need to upgrade your Mac to the latest 10.5.7 from 10.5.1. "Software Update" is located under the black Apple icon in the Menu Bar at the top left corner of your monitor. After you are updated you will want to update your Profile here so that it shows the proper OS version.
    With your level of experience with MacOS X and the Windows OS's you should probably get some help from a local Apple store. They have an appointment system and do offer many types of help and training, and they can offer assistance with choosing the proper programs for you to purchase for your machine.
    You are also welcome to continue to ask questions here, of course. You will want to ask your questions with different issues that come up in different threads so that the answers stay focused on the title of the thread.
    Message was edited by: dechamp to try to be more accurate with a fairly complicated issue...

  • How to run JSP pages in weblogic 8.1 sp2

    hi frnzs,
    plese give me some idea about how to run JSP pages in weblogic server.

    enen i dont know hw to fly palne otherwise i can definitely give u sm guides abt that......

  • How to run .exe files in mac pro?

    how to run .exe files in mac pro?
    i am looking for this to play games in my mac pro.
    if someone got a answer, just let me know
    cheers.

    mailking wrote:
    And I fail to see why you are attacking me...
    My comment is Valid...  " .exe files will not run natively on Mac OS X..."
    I am sorry. I had the false impression that it was commonly known that .exe files did not run on Mac OSX natively and failed to see any constructive critique you were bringing. Maybe I am wrong. Again deepest apologies.
    Unfortunately... these days... not every one is aware of this .exe  fact..
    Apology accepted.. and Thank You..

  • How to precompile jsp file in jdeveloper before deployment....

    Hi
    thank you for reading my post
    how i compile jsp file in my web application , is it doable in jdeveloper 10.1.3.0.4?
    even if i could precompile the application before deployment is OK for me.
    thanks

    1. Highlight your web project or the individual file
    2. Right click
    3. Select Rebuild to build all jsp files or Make to rebuilt only changed files

  • How to run script file ( unix script file like ksh or sh file) using Java

    How to run script file ( unix script file like ksh or sh file) using Java Program?.
    I am using the following code snippet to run the simple commands like top or ls ,etc....
    Runtime runtime = Runtime.getRuntime();
    Process proc = runtime.exec("top");
    Thanks In Adavance
    -Siva

    String [] { "ksh" , "-c" , "script", "arg 1", "arg 2", "arg 3"}

  • How to run jsp in weblogic server

    hi,
    how to run jsp application in weblogic server,plz send the procedure how to deploy..
    Thanks

    How to run JSP and EJB program using weblogic server

  • How to run .sql file in tsql or powershell

    Hi All,
    HOw to run .sql file inside the TSQL or powershell using with IF else condition. This below query works fine but when i executing through the SQL Agent it's geeting an error.Please could help how to run through the SQL agent already using execution type
    in agent as 'Operating system(CmdExec)'
    Declare @computerName varchar(100), @InstanceName varchar(50)                             
    SET @ComputerName = REPLACE(CAST(SERVERPROPERTY('ComputerNamePhysicalNetBIOS') AS varchar),'\','$')  
    SET @InstanceName = REPLACE(CAST(SERVERPROPERTY('instancename') AS varchar),'\','$')
    IF (@InstanceName = 'SQL2008R2')
    Begin  
    :r C:\BackupFolder\Test1.sql    
    :r C:\BackupFolder\Test2.sql    
    End
    IF (@InstanceName = 'SQLINS2')
    BEGIN
    :r C:\BackupFolder\Test3.sql
    END
    IF (@InstanceName = 'SQL2012')
    BEGIN
    :r C:\BackupFolder\Test4.sql
    END
    Thansk in Advance
    A-ZSQL

    In T-SQL, you can try using sqlcmd to invoke sql file
    if @@SERVERNAME='abcd'
    begin
    Master..xp_cmdshell 'sqlcmd -S <ServerName> -i BackupDetails.sql -E'
    end
    OR 
     PowerShell 
    Load the snapins
    Add-PSSnapin SqlServerCmdletSnapin100
    Add-PSSnapin SqlServerProviderSnapin100
    Function Get-SqlInstances {
    Param($ServerName = '.')
    $localInstances = @()
    [array]$captions = gwmi win32_service -computerName $ServerName | ?{$_.Name -match "mssql*" -and $_.PathName -match "sqlservr.exe"} | %{$_.Caption}
    foreach ($caption in $captions) {
    if ($caption -like "MSSQLSERVER") {
    $localInstances += $ServerName
    } else {
    $temp = $caption | %{$_.split(" ")[-1]} | %{$_.trimStart("(")} | %{$_.trimEnd(")")}
    $localInstances += "$ServerName\$temp"
    $localInstances
    $instance=Get-SqlInstances -ServerName HQDBSP17
    foreach($i in $instance)
    if($i -like 'CRM2011')
    write-host 'CRM Database'
    invoke-sqlcmd -inputfile 'F:\PowerSQL\test.sql' -ServerInstance 'abcd'
    if( $i -like 'SQL2012')
    write-host 'SQL 2012 instance'
    invoke-sqlcmd -inputfile 'F:\PowerSQL\test.sql' -ServerInstance 'abcd'
    --Prashanth

Maybe you are looking for

  • Error while passing date parameters in procedure and commit issue

    Hi 1) I am doing a archiveing records and pls find my code below and i have couple of issue,pls find my code and want to ensure the commit is happening every 100000 rows inserted but i am archeiving a huge table but when i checks the table frequently

  • Email Not Working At All Please Help!

    hey, i just got my black berry today and the email is not working. I go to the email set up page and it brings me to the terms of service but when i click next it says that this black berry already has an account? i do not know what to do. I also hav

  • Web service available in SAP Solution Manager

    Hi, Which are the Webservices available in SAP Solution Manager. I want to Integrate HP Openview change request process with SAP Solution Manager ChaRM. Regards PK Edited by: PK on Aug 9, 2010 3:37 PM

  • How to use Page to type fraction?

    I don't know how to type fraction, can anyone help me? I need the verticle style, not 1/2. Thanks in advance.

  • J2EE Packaging and manifest Class-Path:

    Does anyone know if Weblogic 6.0 supports the redefined deployment extension mechanism that makes use of the 'Class-Path:' entry in the manifest files? In our project we have one single .ear file containing a couple of EJB's (.jar files) and a Web Ap