my dog learned polymorphism*
The moose likes Servlets and the fly likes Problem with jsp:useBean tag...URGENT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Problem with jsp:useBean tag...URGENT" Watch "Problem with jsp:useBean tag...URGENT" New topic
Author

Problem with jsp:useBean tag...URGENT

Raukutam Sandeep
Ranch Hand

Joined: Nov 15, 2000
Posts: 61
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

Joined: Nov 26, 2000
Posts: 202
Hi
Could you please post your jsp & bean class code ?

------------------
Suneel


Suneel
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12809
    
    5
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

Joined: Nov 15, 2000
Posts: 61
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

Joined: Nov 26, 2000
Posts: 202
Hi Sandeep
Some errors basically.

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


------------------
Suneel
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with jsp:useBean tag...URGENT