• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with jsp:useBean tag...URGENT

 
Raukutam Sandeep
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi everybody,

I'm facing a problem while using <jsp:useBean> tag. When i'm using this tag in a jsp page, it is giving a compile time error.
When I opened the java file(which is present in tmpdir\...), i found that there is no _jspService method.
Would anybody pls tell me the solution and correct syntax.
I'm using JWS2.0 and i'm copying the bean class to classes directory.
Pls reply me asap..
regds,
Sandeep.
 
Suneel Setlur
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Could you please post your jsp & bean class code ?

------------------
Suneel
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13073
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want help, DON'T just say "it is giving a compile time error" - post the ACTUAL ERROR MESSAGE! Java compiler error messages will frequently lead you directly to the problem but if you don't post the actual message, we can't help.
Posting the code in the vicinity of where the error occurred is a big help too.
Bill

------------------
author of:
 
Raukutam Sandeep
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

sorry for causing inconvenience.
Here is the bean class code:

import java.io.*;
public class UserInfobean implements Serializable
{
private String uname;
public UserInfobean()
{
}
public void setUserName(String newName)
{
uname=newName;
}
public String getUserName()
{
return uname;
}
} //end of class
And here is the JSP code:
<html>
<body>
<%@ page import="java.sql.*" %>
<%@ page import="UserInfobean.class" %>
<%! Connection con;
PreparedStatement ps;
ResultSet rs;
Statement st;
//String title,fname,lname,usrname,pwd,dob,sex,address,city,state,country,zipcode;
String usrname,passwd,uname,pwd;
//int ret;
public void jspInit()
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc dbc:sanemp");
}
catch(Exception e)
{
out.println(e);
}
}
%>
<%
try
{
usrname=request.getParameter("username");
passwd=request.getParameter("password");
ps=con.prepareStatement("select * from registeredusers where username=? and password=?");
ps.setString(1,usrname);
ps.setString(2,passwd);
rs=ps.executeQuery();
if(rs.next())
{
%>
<jsp:useBean id="userinfo" class="UserInfobean">
<jsp:setProperty name="userinfo" property="*"/>
</jsp:useBean>
<jsp:forward page="/inbox.jsp" />
<%
}
else
{
%>
<jsp:forward page="/sanmail1.jsp" />
<%
}
}
catch(Exception e1)
{
out.println("<b>"+e1+"</b");
}
%>
</body>
</html>
When I run the above JSP page, i found that there is no _jspService method in the JAVA file(which is present in the tmpdir\...). I'm getting an error that - there is no _jspService method.
Where did I go wrong?
I'm a newbie to this JSP concept.
Please help me out...
regds,
Sandeep.....
 
Suneel Setlur
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sandeep
Some errors basically.

This is your jsp file.
And this is the generated java file in tmpdir of JWS.


------------------
Suneel
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic