• 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

uable to execute jsps

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
i getting the problem while excuting the jsp page
i am creating the user regisration form and storing the datials i database
for this i created one html page and next excuting jsp page ang bean class

the program paths are

C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\honey\urf.html

C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\honey\WEB-INF\classes\reguser.jsp

C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\honey\WEB-INF\classes\UMBean.java

C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\honey\WEB-INF\web.xml

urf.html

<html>
<head><title>User Registration</title></head>
<body>
<form action="reguser.jsp">
User Name
<input type="text" name="usernmae"><br>

Password
<input type="text" name="pwd"><br>

Age
<input type="text" name="age"><br>

Email
<input type="text" name="email"><br>


<input type="submit" name="register"><br>
</form>
</body>
</html>


reguser.jsp

<jsp:useBean id="umb" scope="page" class="org.students.UMBean"/>
<jsp:setProperty name="umb" property="*"/>
<%
umb.registerUser();
%>
following data is stored in d/b


<jsp:getProperty name="umb" property="username"/><br>
<jsp:getProperty name="umb" property="pwd"/><br>
<jsp:getProperty name="umb" property="age"/><br>
<jsp:getProperty name="umb" property="email"/><br>




package org.students;

import java.sql.*;
import java.io.*;

public class UMBean{

private String uname;

private String pwd;

private String email;

private int age;

//setters


public void registerUser()throws Exception
{

Class.forName("oracle.jdbc.driver.OracleDriver");

Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","SYSTEM","remora");

System.out.println("connceted----->"+con.getClass());


String vsql="insert into app_users values(?,?,?,?)";

PreparedStatement psmt=con.prepareStatement(vsql);

psmt.setString(1,this.uname);
psmt.setString(2,this.pwd);
psmt.setInt(3,this.age);
psmt.setString(4,this.email);

psmt.executeUpdate();
con.close();
}


public void setUsername(String uname)
{
System.out.println("set username---"+uname);
this.uname=uname;
}

public void setPassword(String pwd)
{
System.out.println("set username---"+pwd);
this.pwd=pwd;
}

public void setEmail(String email)
{
System.out.println("set username---"+email);
this.email=email;
}

public void setAge(int age)
{
System.out.println("set age---"+age);
this.age=age;
}
//getters
public String getUsername(String uname)
{
System.out.println("get username---"+uname);
return this.uname;
}

public String getPassword(String pwd)
{
System.out.println("get username---"+pwd);
return this.pwd;
}

public String getEmail(String email)
{
System.out.println("get username---"+email);
return this.email;
}

public int getAge(int age)
{
System.out.println("get age---"+age);
return this.age;
}

public UMBean()
{
System.out.println("Executed........");
}
}


web.xml

<web-app>
<servlet>
<servlet-name>Simple</servlet-name>
<servlet-class>reguser.jsp</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Simple</servlet-name>
<url-pattern>/reguser.jsp</url-pattern>
</servlet-mapping>
</web-app>




my url path is http://localhost:8082/honey/urf.html
after that it goes to reguser.jsp
but here i am getting following error


HTTP Status 500 -

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

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Wrapper cannot find servlet class reguser.jsp or a class it depends on
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:793)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:702)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:571)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644)
java.lang.Thread.run(Thread.java:595)


root cause

java.lang.ClassNotFoundException: reguser.jsp
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1340)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:793)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:702)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:571)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644)
java.lang.Thread.run(Thread.java:595)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.25 logs.


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

Apache Tomcat/5.0

please tell me where did i mistake
i did every thing correct in my view
but i am unable to rectify error
[ April 15, 2008: Message edited by: Bear Bibeault ]
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Geeta Ravikanti,
Welcome to JavaRanch!

In an effort to help you get the most from our forums, we've compiled a
list of tips for asking questions here. You can find the list in our
FAQ section here.
In particular please see:
UBB CODE tags
Unformatted code is tiring to read so, many people won't read it.

Also, please see:
UseRealWords
Abbreviations such as "u" or "ur" in
place of "you" and "you are" or "you're" confound language translation software making
it hard for our non-English speaking members to read your posts.
"plz" is not a word in the English language.

Again, welcome to JavaRanch and good luck with your question.
-Ben
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you want to create a servlet entry for a JSP, don't use the servlet-class attribute.
<servlet-class>reguser.jsp</servlet-class>

Use the jsp-file attribute instead.
 
Geeta Ravikanti
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry,
I din't get you where the changes i made in the program
can you tell me in detail
 
Geeta Ravikanti
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i changed the code like following
<web-app>
<servlet>
<servlet-name>Simple</servlet-name>
<jsp-file>/reguser.jsp</jsp-file>
<load-on-startup>1</load-on-stratup>
</servlet>

<servlet-mapping>
<servlet-name>Simple</servlet-name>
<url-pattern>/simple</url-pattern>
</servlet-mapping>
</web-app>

but when ever i am execuitng this code in tomcat server,its giving "Running" option as false

what to do,how can i change the code
please let me know the solution
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Geeta Ravikanti:
<web-app>
<servlet>
<servlet-name>Simple</servlet-name>
<jsp-file>/reguser.jsp</jsp-file>
<load-on-startup>1</load-on-stratup>
</servlet>



According to your first post, this is not where reguser.jsp is.

C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\honey\WEB-INF\classes\reguser.jsp




Try:
<jsp-file>/WEB-INF/classes/reguser.jsp</jsp-file>

Or, better, move your jsp out of the classes directory.
There is no need for it to be in there.
[ April 15, 2008: Message edited by: Ben Souther ]
 
Geeta Ravikanti
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
tahnQ for the response

i moved the reguser.jsp file in honey directory

here my paths are like folowing
C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\honey\urf.html--->HTML file
C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\honey\reguser.jsp---->jsp file
C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\honey\weh-inf\classes\UMbean.class---->bean class

my url apth is http://localhost:8082/honey/urf.html

here i entered following things
username :geeta
pwd:geeta
Age:24
Email:geeta@yahoo.com
after that i click on submit button
but here its not fingind reguser.jsp
its giving folloeing error
where can i change
type Status report

message /reguser.jsp

description The requested resource (/reguser.jsp) is not available.


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

Apache Tomcat/5.0.25

how can i get the solution
 
Ranch Hand
Posts: 1514
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Should you not be accesing it with the associated name "Simple" defined in web.xml?
 
Sheriff
Posts: 67746
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
I'd like to know why you're going through all these hoops and hassle in the first place.

Just move the JSP out of WEB-INF and address it directly.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Geeta Ravikanti:
tahnQ for the response



Please read this.
 
Geeta Ravikanti
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanQ for all giving the reply
In my program i am inserting the data from html page,it will call jsp page and it call Bean(UMBean.java) class what i wrote the code in program

But what i ahve one dought

I need to validate whether a user name has already been registered when creating an online account

for this i dont know how to write the code and where to write the code

can any one help in this
 
Bear Bibeault
Sheriff
Posts: 67746
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

Originally posted by Geeta Ravikanti:
thanQ for all giving the reply



Please read this.
 
You can't have everything. Where would you put it?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic