wood burning stoves 2.0*
The moose likes JSP and the fly likes problem with JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "problem with JSP" Watch "problem with JSP" New topic
Author

problem with JSP

kanna prasanth
Greenhorn

Joined: Aug 20, 2008
Posts: 8
Hi ,

i want to know about following pgm please:

The problem is in process.jsp the line is if()).IT SHOWS ERROR MSG IN (idHandler.validate()) (as attached)

please help me with it

(----------------html page----------------------------------------)
<html>
<head>
<title>Nouman Rashid page </title>
</head>

<body>
<br>
<p> <h3><center>Please enter your user name and
password</center></h3></p>

<br>
<br>
<form action="process2.jsp " method = "post" >
<center>username</center>
<center><input type = "text" name=
"username"></center>
<center>password</center>
<center><input type = "password" name =
"password"></center>
<center><input type="submit" name="Submit"
value="Login"></center>


</form>

</body>
</html>
(-------------------------------------------------------------------------)





(------------------------------jsp page----------------------------------)


---------process2.jsp-----------------------

<%@ page import="java.util.*" %>
<jsp:useBean id="idHandler" class="foo.Login" scope="request">
<jsp:setProperty name="idHandler" property="*"/>
</jsp:useBean>

<%
if (idHandler.validate()) {
%>
<jsp:forward page="success.jsp"/>
<%
} else {
%>
<jsp:forward page="retry.jsp"/>
<%
}
%>


(-------------------------------------------------------------------------)



(----------------------------------java-----------------------------------)



package foo;
import java.sql.*;

public class Login {

private String username = "";
private String password = "";

public Login() {
}

public void setUsername(String username) {
this.username = username;
}

public void setPassword(String password) {
this.password = password;
}


public boolean authenticate(String username2,
String password2) {
String query="select * from Registration;";
String DbUserName="";
String DbPassword="";
String finalUser="";
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbcdbc:register");
Statement stat=con.createStatement();
ResultSet rst=stat.executeQuery(query);
while(rst.next())

{
DbUserName=rst.getString("UserName");

DbPassword=rst.getString("password");

if (username2.equals(DbUserName) &&
password2.equals(DbPassword)) {

break;
}


}
return true;
}catch(Exception e){

e.printStackTrace();
return false;
}
}}



(-------------------------------------------------------------------------)
[ September 16, 2008: Message edited by: Bear Bibeault ]
Sagar Birari
Greenhorn

Joined: Sep 05, 2008
Posts: 11
hello

your are accessing Login bean through jsp:usebean direcive
and your trying to call validate() function of login bean which is not exist.
Add validate function toyour login class or try to call existed function.

Regards


Sagar Birari
Development & Technical Blog
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60822
    
  65

Originally posted by kanna prasanth:
i want to know about following pgm please:

A few things to help you get answers an JavaRanch:

Firstly, please use real words when posting to the forums. Abbreviations such as "pgm" in place of "program" only serve to make your posts more difficult to read and less likely to generate useful responses. Please read this for more information.

Secondly, please avoid posting in all uppercase. It's considered shouting and rude. Please read this for more information. I have adjusted the topic title for you.

And lastly, please be sure to take the time to compose descriptive subjects for your posts; read this for more information.

Using a title of "problem with jsp" in a forum completely dedicated to questions on JSP isn't very helpful.

Please go back and change your post to add a more meaningful subject by clicking the .


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
jQuery in Action, 2nd edition
 
subject: problem with JSP
 
Similar Threads
problem with jsp page and java bean
JSP validation
creating a Loginpage.jsp in JSP with LOGIN id and Password.
JSP page wont call other jsp page!!
Help with this code!