Gar04
asked on
User Login bean SQL
hey Kennethxu and rrz
hey guys
again it is Gaz
i have used the code from before for a couple of forms successfully
i am working on a login page for the application
i can get the data from the user and validate it but i want to be able to check the entered
email,username and password against those in the database table
here is what i have so far but i am a bit lost, can you help out?:
public void userlogCheck() throws ClassNotFoundException, SQLException {
Class.forName("sun.jdbc.od bc.JdbcOdb cDriver");
Connection conn = null;
PreparedStatement ps = null;
try {
conn = DriverManager.getConnectio n( "jdbc:odbc:BillboardCompan y");
ps = conn.prepareStatement( "SELECT EmailAddress, Username, Password FROM UserRegInformation WHERE EmailAddress = ?" + "AND Username = ? AND Password = ?)" );
ps.getString( 1, emailAddress);
ps.getString( 2, userName );
ps.getString( 3, repassWord );
}
finally {
if( ps != null )
try {ps.close(); }
catch( Throwable t ) { t.printStackTrace(); }
if( conn!=null)
try {conn.close(); }
catch( Throwable t ) { t.printStackTrace(); }
}
}
hey guys
again it is Gaz
i have used the code from before for a couple of forms successfully
i am working on a login page for the application
i can get the data from the user and validate it but i want to be able to check the entered
email,username and password against those in the database table
here is what i have so far but i am a bit lost, can you help out?:
public void userlogCheck() throws ClassNotFoundException, SQLException {
Class.forName("sun.jdbc.od
Connection conn = null;
PreparedStatement ps = null;
try {
conn = DriverManager.getConnectio
ps = conn.prepareStatement( "SELECT EmailAddress, Username, Password FROM UserRegInformation WHERE EmailAddress = ?" + "AND Username = ? AND Password = ?)" );
ps.getString( 1, emailAddress);
ps.getString( 2, userName );
ps.getString( 3, repassWord );
}
finally {
if( ps != null )
try {ps.close(); }
catch( Throwable t ) { t.printStackTrace(); }
if( conn!=null)
try {conn.close(); }
catch( Throwable t ) { t.printStackTrace(); }
}
}
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i think that i have confused myself with the isValid method and how i would go about using these emthod in the jsp page
essentially if the data is valid(i.e. the correct type of data and is entered) i want it then to check if the data matches the data in the database, moreover, if the data matches i would like to redirect to the appropriate page if not return to the login page with the appropriate message from propertyStatusMsg.
should i make userlogCheck() a boolean, is this possible??
the isValid() method looks like so:
public boolean isValid() {
return firstName != null &&
lastName != null && orgName != null &&
StringFormat.isValidEmailA ddr(emailA ddress) && userName != null &&
passWord != null && repassWord != null && repassWord.equals(passWord );
}
if this is not valid it goes to the propertyStatusMsg() method:
public String getPropertyStatusMsg() {
String msg ="Thank you for registering!";
if (!isInitialized ()) {
msg ="Please enter values in all fields";
}
else if (!isValid()) {
msg ="The Following data is missing or invalid: ";
}
return msg;
}
public String[] getPropertyStatusDetails() {
Vector details = new Vector();
if (isInitialized() && !isValid()) {
if (emailAddress == null) {
details.addElement("An Email Address is Missing");
}
else if (!StringFormat.isValidEmai lAddr(emai lAddress)) {
details.addElement("Invali d Email Format:"+emailAddress+",tr y this format:'bob@name.com'");
}
if (userName == null) {
details.addElement("A User Name is Missing");
}
if (passWord == null) {
details.addElement("A Password is Missing");
}
}
String[] arr = new String[details.size()];
details.copyInto(arr);
return arr;
}
essentially if the data is valid(i.e. the correct type of data and is entered) i want it then to check if the data matches the data in the database, moreover, if the data matches i would like to redirect to the appropriate page if not return to the login page with the appropriate message from propertyStatusMsg.
should i make userlogCheck() a boolean, is this possible??
the isValid() method looks like so:
public boolean isValid() {
return firstName != null &&
lastName != null && orgName != null &&
StringFormat.isValidEmailA
passWord != null && repassWord != null && repassWord.equals(passWord
}
if this is not valid it goes to the propertyStatusMsg() method:
public String getPropertyStatusMsg() {
String msg ="Thank you for registering!";
if (!isInitialized ()) {
msg ="Please enter values in all fields";
}
else if (!isValid()) {
msg ="The Following data is missing or invalid: ";
}
return msg;
}
public String[] getPropertyStatusDetails()
Vector details = new Vector();
if (isInitialized() && !isValid()) {
if (emailAddress == null) {
details.addElement("An Email Address is Missing");
}
else if (!StringFormat.isValidEmai
details.addElement("Invali
}
if (userName == null) {
details.addElement("A User Name is Missing");
}
if (passWord == null) {
details.addElement("A Password is Missing");
}
}
String[] arr = new String[details.size()];
details.copyInto(arr);
return arr;
}
ASKER
this compiles fine but i need to test it to see if it works
is it correct to make this a boolean??
is it correct to make this a boolean??
ASKER
hey there seems to be a problem with this
ps.getString( 1, emailAddress);
ps.getString( 2, userName );
ps.getString( 3, repassWord );
ResultSet rs = ps.executeQuery();
the compiler doesn't like the getString() it cannot resolve symbol??
sos about before i had setString() by mistake and it compiled but i don't think that would work in ru time??
gaz
ps.getString( 1, emailAddress);
ps.getString( 2, userName );
ps.getString( 3, repassWord );
ResultSet rs = ps.executeQuery();
the compiler doesn't like the getString() it cannot resolve symbol??
sos about before i had setString() by mistake and it compiled but i don't think that would work in ru time??
gaz
you need to use ps.setString, not getString. that's the problem
for sure you can make it boolean and you did it very well ;-)
ASKER
cheers
i'll test it and should i require your(pl) assistance i know where to find yee
slan
Gaz
i'll test it and should i require your(pl) assistance i know where to find yee
slan
Gaz
ASKER
hey guys
<% if(Bean2.isValid())
Bean.isUser();%>
how can i get this to forward to the appropriate page if isUser() is true
can i nestle a <jsp:forward: page "main.jsp"/> into it like this :
<% if(Bean2.isValid())
Bean.isUser <jsp:forward: page "main.jsp"/>;%>
or shall i i just call it seperately
like:
<% if(Bean2.isUser())
<jsp:forward: page "main.jsp"/>;%>
????
i can't find a good example
<% if(Bean2.isValid())
Bean.isUser();%>
how can i get this to forward to the appropriate page if isUser() is true
can i nestle a <jsp:forward: page "main.jsp"/> into it like this :
<% if(Bean2.isValid())
Bean.isUser <jsp:forward: page "main.jsp"/>;%>
or shall i i just call it seperately
like:
<% if(Bean2.isUser())
<jsp:forward: page "main.jsp"/>;%>
????
i can't find a good example
ASKER
another general question but relative
if a user registers and his data is correct is there a way to send them to a conformation page
that loads for like 10 second
and says "thanks for registering" and displays their registration details and then forwards the user to the main page
i guess it would be like a pop up page or someting
and would that mean that i have to have session scope for all???
if a user registers and his data is correct is there a way to send them to a conformation page
that loads for like 10 second
and says "thanks for registering" and displays their registration details and then forwards the user to the main page
i guess it would be like a pop up page or someting
and would that mean that i have to have session scope for all???
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Yes, the confirmation page should have:
<% response.setHeader( "Refresh", "10; main.jsp" ); %>
<% response.setHeader( "Refresh", "10; main.jsp" ); %>
ASKER
hey thats great!
however, i am having a bit of bother with the same thing on another page:
obviously i can't do this??
<% if(Bean1.isValid())
Bean1.insertData(); %>
<% if( Bean1.isValid() && Bean1.insertData() ) { %>
<jsp:forward: page "Success.jsp"/>
<% } %>
how do i get it to forward even though it has already called the methods
and the buffer has been flushed
i hope that i understood that right and that you do too??
gaz
however, i am having a bit of bother with the same thing on another page:
obviously i can't do this??
<% if(Bean1.isValid())
Bean1.insertData(); %>
<% if( Bean1.isValid() && Bean1.insertData() ) { %>
<jsp:forward: page "Success.jsp"/>
<% } %>
how do i get it to forward even though it has already called the methods
and the buffer has been flushed
i hope that i understood that right and that you do too??
gaz
you need to put the code in the beginning of your jsp page. can you show me the page?
ASKER
i will show you the login.jsp as it is a little smaller but has the same problem
i thought the code would have to go into the form because that is where the two functions are being process
i guess i won't get good marks for layout, it is all over the shop!!!
sorry
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" %>
<jsp:useBean id="Bean2" class="com.ora.jsp.beans.u serinfo.Us erLoginBea n" scope="request"/>
<jsp:setProperty name="Bean2" property="*"/>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>User Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript"func tion mmLoadMenus() {
if (window.mm_menu_1_0) return;
window.mm_menu_1_0 = new Menu("root",181,16,"Times New Roman, Times, serif",10,"#000000","#FFFF FF","#0000 84","cente r","middle ",1,0,500, -5,7,true, true,true, 0,true,tru e);
mm_menu_1_0.addMenuItem("4 8 Sheet Bi llboard Fo rmat"Shopp erlite"Com muterlites ");
mm_menu_1_0.hideOnMouseOut =true;
mm_menu_1_0.bgColor='#3366 66';
mm_menu_1_0.menuBorder=1;
mm_menu_1_0.menuLiteBgColo r='#336666 '
mm_menu_1_0.menuBorderBgCo lor='#0000 00'
window.mm_menu_0309135707_ 0 = new
mm_menu_0309135707_0.addMe nuItem("48 Shee t Bil lboard&nbs p;Format"S hopperlite s");
mm_menu_0309135707_0.hideO nMouseOut= true;
mm_menu_0309135707_0.bgCol or='#33666 6'
mm_menu_0309135707_0.menuB order=1;
mm_menu_0309135707_0.menuL iteBgColor ='#336666'
mm_menu_0309135707_0.menuB orderBgCol or='#00000 0'
window.mm_menu_0309140128_ 0 = new
mm_menu_0309140128_0.addMe nuItem("Be lfast  ;City  ;Area"Nort hern Ireland");
mm_menu_0309140128_0.hideO nMouseOut= true;
mm_menu_0309140128_0.bgCol or='#33666 6'
mm_menu_0309140128_0.menuB order=1;
mm_menu_0309140128_0.menuL iteBgColor ='#336666'
mm_menu_0309140128_0.menuB orderBgCol or='#00000 0'
window.mm_menu_0309133610_ 0 = new
mm_menu_0309133610_0.addMe nuItem(");
mm_menu_0309133610_0.hideO nMouseOut= true;
mm_menu_0309133610_0.bgCol or='#33666 6'
mm_menu_0309133610_0.menuB order=1;
mm_menu_0309133610_0.menuL iteBgColor ='#336666'
mm_menu_0309133610_0.menuB orderBgCol or='#00000 0'
window.mm_menu_0316175720_ 0 = new
mm_menu_0316175720_0.addMe nuItem(");
mm_menu_0316175720_0.hideO nMouseOut= true;
mm_menu_0316175720_0.bgCol or='#33666 6'
mm_menu_0316175720_0.menuB order=1;
mm_menu_0316175720_0.menuL iteBgColor ='#336666'
mm_menu_0316175720_0.menuB orderBgCol or='#00000 0'
mm_menu_0316175720_0.write Menus();
} // mmLoadMenus()ogin></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript"func tion mmLoadMenus() {
if (window.mm_menu_1_0) return;
window.mm_menu_1_0 = new Menu("root",181,16,"Times New Roman, Times, serif",10,"#000000","#FFFF FF","#0000 84","cente r","middle ",1,0,500, -5,7,true, true,true, 0,true,tru e);
mm_menu_1_0.addMenuItem("4 8 Sheet Bi llboard Fo rmat"Shopp erlite"Com muterlites ");
mm_menu_1_0.hideOnMouseOut =true;
mm_menu_1_0.bgColor='#3366 66';
mm_menu_1_0.menuBorder=1;
mm_menu_1_0.menuLiteBgColo r='#336666 '
mm_menu_1_0.menuBorderBgCo lor='#0000 00'
window.mm_menu_0309135707_ 0 = new
mm_menu_0309135707_0.addMe nuItem("48 Shee t Bil lboard&nbs p;Format"S hopperlite s");
mm_menu_0309135707_0.hideO nMouseOut= true;
mm_menu_0309135707_0.bgCol or='#33666 6'
mm_menu_0309135707_0.menuB order=1;
mm_menu_0309135707_0.menuL iteBgColor ='#336666'
mm_menu_0309135707_0.menuB orderBgCol or='#00000 0'
window.mm_menu_0309140128_ 0 = new
mm_menu_0309140128_0.addMe nuItem("Be lfast  ;City  ;Area"Nort hern Ireland");
mm_menu_0309140128_0.hideO nMouseOut= true;
mm_menu_0309140128_0.bgCol or='#33666 6'
mm_menu_0309140128_0.menuB order=1;
mm_menu_0309140128_0.menuL iteBgColor ='#336666'
mm_menu_0309140128_0.menuB orderBgCol or='#00000 0'
mm_menu_0309140128_0.write Menus();
}
>
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_pre loadImages .arguments ; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</script>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(p arseInt(ap pVersion)= =4)) {
document.MM_pgW=innerWidth ; document.MM_pgH=innerHeigh t; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_p gW || innerHeight!=document.MM_p gH) location.reload();
}
MM_reloadPage(true);
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x= a[i])&&x.o Src;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&p arent.fram es.length) {
d=parent.frames[n.substrin g(p+1)].do cument; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length; i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d. layers.len gth;i++) x=MM_findObj(n,d.layers[i] .document) ;
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arg uments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+= 3)
if ((x=MM_findObj(a[i]))!=nul l){documen t.MM_sr[j+ +]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<script language="JavaScript" src="mm_menu.js"></script>
</head>
<body onLoad="MM_preloadImages(' images/hom e2.gif','i mages/comp any2.gif', 'images/co ntact2.gif ','images/ yboards2.g if','image s/campaign 2.gif','im ages/forma ts2.gif',' images/reg ister2.gif ','images/ links2.gif ')">
<script language="JavaScript1.2">m mLoadMenus ();</scrip t>
<table width="702" border="1" align="center" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
<!--DWLayoutTable-->
<tr>
<td width="602" height="123" rowspan="2" align="center" valign="bottom" bgcolor="#FFFFFF">
<div align="left"><img src="graphic3.gif" width="90" height="123"></div>
<div align="right"></div>
<div align="right"></div></td>
<td width="602" height="42" align="left" valign="bottom" bgcolor="#FFFFFF"><img src="topnavbar/toplogin.gi f" width="600" height="40"></td>
</tr>
<tr>
<td height="73" align="left" valign="bottom" bgcolor="#FFFFFF"><img src="banner.gif" width="600" height="80"></td>
</tr>
<tr align="center" valign="top">
<td rowspan="2" bordercolor="#0099CC" bgcolor="#0099CC"> </ td>
<td height="42" valign="bottom" bgcolor="#FFFFFF"><font color="#0033CC" size="5" face="Times New Roman, Times, serif">Welcome
to the Look-See Login Page</font></td>
</tr>
<tr align="center" valign="top">
<td bgcolor="#FFFFFF"><img src="RegBar.gif" width="600" height="20"></td>
</tr>
<tr align="center" valign="top">
<td rowspan="5" bordercolor="#0099CC" bgcolor="#0099CC"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="top"><a href="main.htm" onMouseOut="MM_swapImgRest ore()" onMouseOver="MM_swapImage( 'Home','', 'images/ho me2.gif',1 )"><img src="images/home1.gif" alt="Home" name="Home" width="90" height="21" border="0"></a></td>
</tr>
<tr>
<td><a href="CompanyInformation.h tm" onMouseOut="MM_swapImgRest ore()" onMouseOver="MM_swapImage( 'Company Information','','images/co mpany2.gif ',1)"><img src="images/company1.gif" alt="Company Information" name="Company Information" width="90" height="21" border="0"></a></td>
</tr>
<tr>
<td><a href="ContactUs.htm" onMouseOut="MM_swapImgRest ore()" onMouseOver="MM_swapImage( 'Contact Us','','images/contact2.gi f',1)"><im g src="images/contact1.gif" alt="Contact Us" name="Contact Us" width="90" height="21" border="0"></a></td>
</tr>
<tr>
<td height="21"><a href="#" onMouseOut="MM_swapImgRest ore()" onMouseOver="MM_swapImage( 'Why Billboards?','','images/yb oards2.gif ',1)"><img src="images/yboards1.gif" alt="Why Use Billboards?" name="Why Billboards?" width="90" height="21" border="0"></a></td>
</tr>
<tr>
<td height="21"><a href="#" onMouseOut="MM_swapImgRest ore();MM_s tartTimeou t()" onMouseOver="MM_swapImage( 'Campaign Information','','images/ca mpaign2.gi f',1);MM_s howMenu(wi ndow.mm_me nu_0309133 610_0,90,0 ,null,'Cam paign Information')"><img src="images/campaign1.gif" alt="Campaign Information" name="Campaign Information" width="90" height="21" border="0"></a></td>
</tr>
<tr>
<td height="21"><a href="#" onMouseOut="MM_swapImgRest ore();MM_s tartTimeou t()" onMouseOver="MM_swapImage( 'Billboard Formats','','images/format s2.gif',1) ;MM_showMe nu(window. mm_menu_03 16175720_0 ,90,0,null ,'Billboar d Formats')"><img src="images/formats1.gif" alt="Billboard Format Information" name="Billboard Formats" width="90" height="21" border="0"></a></td>
</tr>
<tr>
<td height="21"><a href="#" onMouseOut="MM_swapImgRest ore()" onMouseOver="MM_swapImage( 'Register' ,'','image s/register 2.gif',1)" ><img src="images/register.gif" alt="Register" name="Register" width="90" height="21" border="0"></a></td>
</tr>
<tr>
<td height="21"><img src="images/loginused.gif" alt="This page!" width="90" height="21"></td>
</tr>
<tr>
<td height="21"><a href="#" onMouseOut="MM_swapImgRest ore()" onMouseOver="MM_swapImage( 'Links','' ,'images/l inks2.gif' ,1)"><img src="images/links1.gif" alt="Links" name="Links" width="90" height="21" border="0"></a></td>
</tr>
</table></td>
<td height="17" valign="bottom" bgcolor="#FFFFFF"><font color="#336699" size="2" face="Times New Roman, Times, serif">Please
Enter Your Valid Email Address, Username and Password in the Fields Below</font></td>
</tr>
<tr align="center" valign="top">
<td height="21" valign="bottom" bgcolor="#FFFFFF"><font color="#993300" size="2" face="Times New Roman, Times, serif">Note*
All Fields Required</font></td>
</tr>
<tr align="center" valign="top">
<td height="208" valign="top" bgcolor="#FFFFFF">
<form method="POST" name="UserLoginForm" id="UserLoginForm" action="UserLogin.jsp">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr align="center" valign="middle">
<td height="21" colspan="2">
<ul>
<font color="#CC3300"> </font></ul></td>
</tr>
<tr align="center">
<td height="13" colspan="2">
<%-- Output a list of values that are invalid, if any --%>
<font color="#FF0000">
<jsp:getProperty name="Bean2" property="propertyStatusMs g"/>
</font>
<%-- List continues with propertyStatusDetails() call --%>
</td>
</tr>
<tr align="center" valign="top">
<td height="50" colspan="2"><font color="#CC3300">
<% String[] details= Bean2.getPropertyStatusDet ails();
for(int j=0; j<details.length;j++) {
out.print("<li>"+ details[j] +"</li>");
}
%>
</font></td>
</tr>
<tr align="center">
<td height="11" colspan="2"> </td>
</tr>
<tr>
<td height="21" align="center">Enter Email Address</td>
<td><input name="emailAddress" type="text" id="emailAddress" value="<jsp:getProperty name="Bean2" property="emailAddress"/>" size="25%">
</td>
</tr>
<tr>
<td height="21" align="center"> </td>
<td width="50%"> </td>
</tr>
<tr>
<td width="50%" height="21" align="center">Enter Username</td>
<td><input name="userName" type="text" id="Username2" value="<jsp:getProperty name="Bean2" property="userName"/>" size="25%">
</td>
</tr>
<tr>
<td height="21"> </td>
<td> </td>
</tr>
<tr>
<td height="21" align="center">Enter Password</td>
<td><input name="passWord" type="password" id="passWord" value="<jsp:getProperty name="Bean2" property="passWord"/>" size="25%"></td>
</tr>
<tr>
<td height="21"> </td>
<td> </td>
</tr>
<tr>
<td height="21" align="center"> <input type="submit" name="Submit" value="Submit"></td>
<td align="center"><input name="Reset" type="button" id="Reset" value="Reset"
onClick="if (confirm('Are you sure you want to clear the form ?')) formCleanUp(document.UserL oginForm); "></td>
</tr>
<script language="JavaScript" type="text/JavaScript">
function formCleanUp(frm){
var i
for(i=0; i<frm.elements.length; i++) {
var elt = frm.elements[i]
var t = elt.type;
switch(t) {
case "text":
case "hidden":
case "password":
case "textarea":
elt.value="" ;
break;
case "checkbox":
elt.checked=false;
break;
case "option":
elt.selected=false;
break;
}
}
}
</script>
</table>
</form></td>
</tr>
<tr>
<td height="24" align="center" valign="bottom" bgcolor="#FFFFFF"> </ td>
</tr>
<tr valign="top">
<td height="25" align="center" bgcolor="#FFFFFF"><font color="#336699" size="2" face="Times New Roman, Times, serif">Look-See©2004< /font></td >
</tr>
</table>
</body>
</html>
i thought the code would have to go into the form because that is where the two functions are being process
i guess i won't get good marks for layout, it is all over the shop!!!
sorry
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" %>
<jsp:useBean id="Bean2" class="com.ora.jsp.beans.u
<jsp:setProperty name="Bean2" property="*"/>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>User Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript"func
if (window.mm_menu_1_0) return;
window.mm_menu_1_0 = new Menu("root",181,16,"Times New Roman, Times, serif",10,"#000000","#FFFF
mm_menu_1_0.addMenuItem("4
mm_menu_1_0.hideOnMouseOut
mm_menu_1_0.bgColor='#3366
mm_menu_1_0.menuBorder=1;
mm_menu_1_0.menuLiteBgColo
mm_menu_1_0.menuBorderBgCo
window.mm_menu_0309135707_
mm_menu_0309135707_0.addMe
mm_menu_0309135707_0.hideO
mm_menu_0309135707_0.bgCol
mm_menu_0309135707_0.menuB
mm_menu_0309135707_0.menuL
mm_menu_0309135707_0.menuB
window.mm_menu_0309140128_
mm_menu_0309140128_0.addMe
mm_menu_0309140128_0.hideO
mm_menu_0309140128_0.bgCol
mm_menu_0309140128_0.menuB
mm_menu_0309140128_0.menuL
mm_menu_0309140128_0.menuB
window.mm_menu_0309133610_
mm_menu_0309133610_0.addMe
mm_menu_0309133610_0.hideO
mm_menu_0309133610_0.bgCol
mm_menu_0309133610_0.menuB
mm_menu_0309133610_0.menuL
mm_menu_0309133610_0.menuB
window.mm_menu_0316175720_
mm_menu_0316175720_0.addMe
mm_menu_0316175720_0.hideO
mm_menu_0316175720_0.bgCol
mm_menu_0316175720_0.menuB
mm_menu_0316175720_0.menuL
mm_menu_0316175720_0.menuB
mm_menu_0316175720_0.write
} // mmLoadMenus()ogin></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript"func
if (window.mm_menu_1_0) return;
window.mm_menu_1_0 = new Menu("root",181,16,"Times New Roman, Times, serif",10,"#000000","#FFFF
mm_menu_1_0.addMenuItem("4
mm_menu_1_0.hideOnMouseOut
mm_menu_1_0.bgColor='#3366
mm_menu_1_0.menuBorder=1;
mm_menu_1_0.menuLiteBgColo
mm_menu_1_0.menuBorderBgCo
window.mm_menu_0309135707_
mm_menu_0309135707_0.addMe
mm_menu_0309135707_0.hideO
mm_menu_0309135707_0.bgCol
mm_menu_0309135707_0.menuB
mm_menu_0309135707_0.menuL
mm_menu_0309135707_0.menuB
window.mm_menu_0309140128_
mm_menu_0309140128_0.addMe
mm_menu_0309140128_0.hideO
mm_menu_0309140128_0.bgCol
mm_menu_0309140128_0.menuB
mm_menu_0309140128_0.menuL
mm_menu_0309140128_0.menuB
mm_menu_0309140128_0.write
}
>
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_pre
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</script>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(p
document.MM_pgW=innerWidth
else if (innerWidth!=document.MM_p
}
MM_reloadPage(true);
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&p
d=parent.frames[n.substrin
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;
for(i=0;!x&&d.layers&&i<d.
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arg
if ((x=MM_findObj(a[i]))!=nul
}
//-->
</script>
<script language="JavaScript" src="mm_menu.js"></script>
</head>
<body onLoad="MM_preloadImages('
<script language="JavaScript1.2">m
<table width="702" border="1" align="center" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
<!--DWLayoutTable-->
<tr>
<td width="602" height="123" rowspan="2" align="center" valign="bottom" bgcolor="#FFFFFF">
<div align="left"><img src="graphic3.gif" width="90" height="123"></div>
<div align="right"></div>
<div align="right"></div></td>
<td width="602" height="42" align="left" valign="bottom" bgcolor="#FFFFFF"><img src="topnavbar/toplogin.gi
</tr>
<tr>
<td height="73" align="left" valign="bottom" bgcolor="#FFFFFF"><img src="banner.gif" width="600" height="80"></td>
</tr>
<tr align="center" valign="top">
<td rowspan="2" bordercolor="#0099CC" bgcolor="#0099CC"> </
<td height="42" valign="bottom" bgcolor="#FFFFFF"><font color="#0033CC" size="5" face="Times New Roman, Times, serif">Welcome
to the Look-See Login Page</font></td>
</tr>
<tr align="center" valign="top">
<td bgcolor="#FFFFFF"><img src="RegBar.gif" width="600" height="20"></td>
</tr>
<tr align="center" valign="top">
<td rowspan="5" bordercolor="#0099CC" bgcolor="#0099CC"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="top"><a href="main.htm" onMouseOut="MM_swapImgRest
</tr>
<tr>
<td><a href="CompanyInformation.h
</tr>
<tr>
<td><a href="ContactUs.htm" onMouseOut="MM_swapImgRest
</tr>
<tr>
<td height="21"><a href="#" onMouseOut="MM_swapImgRest
</tr>
<tr>
<td height="21"><a href="#" onMouseOut="MM_swapImgRest
</tr>
<tr>
<td height="21"><a href="#" onMouseOut="MM_swapImgRest
</tr>
<tr>
<td height="21"><a href="#" onMouseOut="MM_swapImgRest
</tr>
<tr>
<td height="21"><img src="images/loginused.gif"
</tr>
<tr>
<td height="21"><a href="#" onMouseOut="MM_swapImgRest
</tr>
</table></td>
<td height="17" valign="bottom" bgcolor="#FFFFFF"><font color="#336699" size="2" face="Times New Roman, Times, serif">Please
Enter Your Valid Email Address, Username and Password in the Fields Below</font></td>
</tr>
<tr align="center" valign="top">
<td height="21" valign="bottom" bgcolor="#FFFFFF"><font color="#993300" size="2" face="Times New Roman, Times, serif">Note*
All Fields Required</font></td>
</tr>
<tr align="center" valign="top">
<td height="208" valign="top" bgcolor="#FFFFFF">
<form method="POST" name="UserLoginForm" id="UserLoginForm" action="UserLogin.jsp">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr align="center" valign="middle">
<td height="21" colspan="2">
<ul>
<font color="#CC3300"> </font></ul></td>
</tr>
<tr align="center">
<td height="13" colspan="2">
<%-- Output a list of values that are invalid, if any --%>
<font color="#FF0000">
<jsp:getProperty name="Bean2" property="propertyStatusMs
</font>
<%-- List continues with propertyStatusDetails() call --%>
</td>
</tr>
<tr align="center" valign="top">
<td height="50" colspan="2"><font color="#CC3300">
<% String[] details= Bean2.getPropertyStatusDet
for(int j=0; j<details.length;j++) {
out.print("<li>"+ details[j] +"</li>");
}
%>
</font></td>
</tr>
<tr align="center">
<td height="11" colspan="2"> </td>
</tr>
<tr>
<td height="21" align="center">Enter Email Address</td>
<td><input name="emailAddress" type="text" id="emailAddress" value="<jsp:getProperty name="Bean2" property="emailAddress"/>"
</td>
</tr>
<tr>
<td height="21" align="center"> </td>
<td width="50%"> </td>
</tr>
<tr>
<td width="50%" height="21" align="center">Enter Username</td>
<td><input name="userName" type="text" id="Username2" value="<jsp:getProperty name="Bean2" property="userName"/>" size="25%">
</td>
</tr>
<tr>
<td height="21"> </td>
<td> </td>
</tr>
<tr>
<td height="21" align="center">Enter Password</td>
<td><input name="passWord" type="password" id="passWord" value="<jsp:getProperty name="Bean2" property="passWord"/>" size="25%"></td>
</tr>
<tr>
<td height="21"> </td>
<td> </td>
</tr>
<tr>
<td height="21" align="center"> <input type="submit" name="Submit" value="Submit"></td>
<td align="center"><input name="Reset" type="button" id="Reset" value="Reset"
onClick="if (confirm('Are you sure you want to clear the form ?')) formCleanUp(document.UserL
</tr>
<script language="JavaScript" type="text/JavaScript">
function formCleanUp(frm){
var i
for(i=0; i<frm.elements.length; i++) {
var elt = frm.elements[i]
var t = elt.type;
switch(t) {
case "text":
case "hidden":
case "password":
case "textarea":
elt.value="" ;
break;
case "checkbox":
elt.checked=false;
break;
case "option":
elt.selected=false;
break;
}
}
}
</script>
</table>
</form></td>
</tr>
<tr>
<td height="24" align="center" valign="bottom" bgcolor="#FFFFFF"> </
</tr>
<tr valign="top">
<td height="25" align="center" bgcolor="#FFFFFF"><font color="#336699" size="2" face="Times New Roman, Times, serif">Look-See©2004<
</tr>
</table>
</body>
</html>
ASKER
hey Kennethxu
i hope that you meant the jsp page and not the error page
if the latter, i am sorry for sending you the jsp
have you any more ideas as to what i need to do?
i hope that you meant the jsp page and not the error page
if the latter, i am sorry for sending you the jsp
have you any more ideas as to what i need to do?
ASKER
this is the error message that i most frequently get:
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.JasperEx ception: /TMPdlv5nv3ktf.jsp(264,16) equal symbol expected
at org.apache.jasper.compiler .DefaultEr rorHandler .jspError( DefaultErr orHandler. java:94)
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.JasperEx
at org.apache.jasper.compiler
the forward code should go right after <jsp:setProperty>
ASKER
so like this:
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" %>
<jsp:useBean id="Bean2" class="com.ora.jsp.beans.u serinfo.Us erLoginBea n" scope="request"/>
<jsp:setProperty name="Bean2" property="*"/><% if( Bean2.isValid() && Bean2.isUser() ) { %>
<jsp:forward: page "main.jsp"/>
<% } %>
???
i tried it and it gave the same error, but i guess that i am wrong!
gaz
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" %>
<jsp:useBean id="Bean2" class="com.ora.jsp.beans.u
<jsp:setProperty name="Bean2" property="*"/><% if( Bean2.isValid() && Bean2.isUser() ) { %>
<jsp:forward: page "main.jsp"/>
<% } %>
???
i tried it and it gave the same error, but i guess that i am wrong!
gaz
what does isValid() and isUser() return, boolean?
which line of the jsp page that the error pointing to? can you post the line arround that number?
ASKER
yeah they have boolean return values
in the bean isValid() looks like this:
public boolean isValid() {
return StringFormat.isValidEmailA ddr(emailA ddress) && userName != null &&
passWord != null;
}
isUser() looks like this:
public boolean isUser() throws ClassNotFoundException, SQLException {
Class.forName("sun.jdbc.od bc.JdbcOdb cDriver");
// initialise connection, statement and result set variables
Connection conn = null;
PreparedStatement ps = null;
try {
if (!isValid() ){
throw new SQLException( "invalid data - from UserRegBean.insertData" );
}
else {
// make a connection to the BillBoardCompany Database
conn = DriverManager.getConnectio n( "jdbc:odbc:BillboardCompan y");
// create statement object to interface with the SQL engine in database
ps = conn.prepareStatement( "SELECT EmailAddress, Username, Password FROM UserRegInformation UserRegInformation WHERE"
+ "EmailAddress = ? AND Username = ? AND Password = ?)" );
ps.setString( 1, emailAddress);
ps.setString( 2, userName );
ps.setString( 3, passWord );
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return true;
}
else {
return false;
}
}
}
finally {
if( ps != null )
try {ps.close(); }
catch( Throwable t ) { t.printStackTrace(); }
if( conn!=null)
try {conn.close(); }
catch( Throwable t ) { t.printStackTrace(); }
}
}
in the bean isValid() looks like this:
public boolean isValid() {
return StringFormat.isValidEmailA
passWord != null;
}
isUser() looks like this:
public boolean isUser() throws ClassNotFoundException, SQLException {
Class.forName("sun.jdbc.od
// initialise connection, statement and result set variables
Connection conn = null;
PreparedStatement ps = null;
try {
if (!isValid() ){
throw new SQLException( "invalid data - from UserRegBean.insertData" );
}
else {
// make a connection to the BillBoardCompany Database
conn = DriverManager.getConnectio
// create statement object to interface with the SQL engine in database
ps = conn.prepareStatement( "SELECT EmailAddress, Username, Password FROM UserRegInformation UserRegInformation WHERE"
+ "EmailAddress = ? AND Username = ? AND Password = ?)" );
ps.setString( 1, emailAddress);
ps.setString( 2, userName );
ps.setString( 3, passWord );
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return true;
}
else {
return false;
}
}
}
finally {
if( ps != null )
try {ps.close(); }
catch( Throwable t ) { t.printStackTrace(); }
if( conn!=null)
try {conn.close(); }
catch( Throwable t ) { t.printStackTrace(); }
}
}
it must be something else in the jsp page, try the login jsp that you have posted and let me the error is pointing to which line.
ASKER
the error doesn't seem to be pointing to any line
but here is the error:
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.JasperEx ception: /TMPkzut4v3ue5.jsp(4,16) equal symbol expected
at org.apache.jasper.compiler .DefaultEr rorHandler .jspError( DefaultErr orHandler. java:94)
at org.apache.jasper.compiler .ErrorDisp atcher.dis patch(Erro rDispatche r.java:428 )
at org.apache.jasper.compiler .ErrorDisp atcher.jsp Error(Erro rDispatche r.java:126 )
at org.apache.jasper.compiler .Parser.pa rseAttribu te(Parser. java:169)
at org.apache.jasper.compiler .Parser.pa rseAttribu tes(Parser .java:136)
at org.apache.jasper.compiler .Parser.pa rseForward (Parser.ja va:517)
at org.apache.jasper.compiler .Parser.pa rseAction( Parser.jav a:661)
at org.apache.jasper.compiler .Parser.pa rseElement s(Parser.j ava:803)
at org.apache.jasper.compiler .Parser.pa rse(Parser .java:122)
at org.apache.jasper.compiler .ParserCon troller.pa rse(Parser Controller .java:199)
at org.apache.jasper.compiler .ParserCon troller.pa rse(Parser Controller .java:153)
at org.apache.jasper.compiler .Compiler. generateJa va(Compile r.java:227 )
at org.apache.jasper.compiler .Compiler. compile(Co mpiler.jav a:369)
at org.apache.jasper.JspCompi lationCont ext.compil e(JspCompi lationCont ext.java:4 73)
at org.apache.jasper.servlet. JspServlet Wrapper.se rvice(JspS ervletWrap per.java:1 90)
at org.apache.jasper.servlet. JspServlet .serviceJs pFile(JspS ervlet.jav a:295)
at org.apache.jasper.servlet. JspServlet .service(J spServlet. java:241)
at javax.servlet.http.HttpSer vlet.servi ce(HttpSer vlet.java: 853)
at org.apache.catalina.core.A pplication FilterChai n.internal DoFilter(A pplication FilterChai n.java:247 )
at org.apache.catalina.core.A pplication FilterChai n.doFilter (Applicati onFilterCh ain.java:1 93)
at org.apache.catalina.core.S tandardWra pperValve. invoke(Sta ndardWrapp erValve.ja va:256)
at org.apache.catalina.core.S tandardPip eline$Stan dardPipeli neValveCon text.invok eNext(Stan dardPipeli ne.java:64 3)
at org.apache.catalina.core.S tandardPip eline.invo ke(Standar dPipeline. java:480)
at org.apache.catalina.core.C ontainerBa se.invoke( ContainerB ase.java:9 95)
at org.apache.catalina.core.S tandardCon textValve. invoke(Sta ndardConte xtValve.ja va:191)
at org.apache.catalina.core.S tandardPip eline$Stan dardPipeli neValveCon text.invok eNext(Stan dardPipeli ne.java:64 3)
at org.apache.catalina.core.S tandardPip eline.invo ke(Standar dPipeline. java:480)
at org.apache.catalina.core.C ontainerBa se.invoke( ContainerB ase.java:9 95)
at org.apache.catalina.core.S tandardCon text.invok e(Standard Context.ja va:2416)
at org.apache.catalina.core.S tandardHos tValve.inv oke(Standa rdHostValv e.java:180 )
at org.apache.catalina.core.S tandardPip eline$Stan dardPipeli neValveCon text.invok eNext(Stan dardPipeli ne.java:64 3)
at org.apache.catalina.valves .ErrorDisp atcherValv e.invoke(E rrorDispat cherValve. java:171)
at org.apache.catalina.core.S tandardPip eline$Stan dardPipeli neValveCon text.invok eNext(Stan dardPipeli ne.java:64 1)
at org.apache.catalina.valves .ErrorRepo rtValve.in voke(Error ReportValv e.java:172 )
at org.apache.catalina.core.S tandardPip eline$Stan dardPipeli neValveCon text.invok eNext(Stan dardPipeli ne.java:64 1)
at org.apache.catalina.core.S tandardPip eline.invo ke(Standar dPipeline. java:480)
at org.apache.catalina.core.C ontainerBa se.invoke( ContainerB ase.java:9 95)
at org.apache.catalina.core.S tandardEng ineValve.i nvoke(Stan dardEngine Valve.java :174)
at org.apache.catalina.core.S tandardPip eline$Stan dardPipeli neValveCon text.invok eNext(Stan dardPipeli ne.java:64 3)
at org.apache.catalina.core.S tandardPip eline.invo ke(Standar dPipeline. java:480)
at org.apache.catalina.core.C ontainerBa se.invoke( ContainerB ase.java:9 95)
at org.apache.coyote.tomcat4. CoyoteAdap ter.servic e(CoyoteAd apter.java :223)
at org.apache.coyote.http11.H ttp11Proce ssor.proce ss(Http11P rocessor.j ava:601)
at org.apache.coyote.http11.H ttp11Proto col$Http11 Connection Handler.pr ocessConne ction(Http 11Protocol .java:392)
at org.apache.tomcat.util.net .TcpWorker Thread.run It(PoolTcp Endpoint.j ava:565)
at org.apache.tomcat.util.thr eads.Threa dPool$Cont rolRunnabl e.run(Thre adPool.jav a:619)
at java.lang.Thread.run(Threa d.java:479 )
but here is the error:
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.JasperEx
at org.apache.jasper.compiler
at org.apache.jasper.compiler
at org.apache.jasper.compiler
at org.apache.jasper.compiler
at org.apache.jasper.compiler
at org.apache.jasper.compiler
at org.apache.jasper.compiler
at org.apache.jasper.compiler
at org.apache.jasper.compiler
at org.apache.jasper.compiler
at org.apache.jasper.compiler
at org.apache.jasper.compiler
at org.apache.jasper.compiler
at org.apache.jasper.JspCompi
at org.apache.jasper.servlet.
at org.apache.jasper.servlet.
at org.apache.jasper.servlet.
at javax.servlet.http.HttpSer
at org.apache.catalina.core.A
at org.apache.catalina.core.A
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.C
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.C
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.valves
at org.apache.catalina.core.S
at org.apache.catalina.valves
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.C
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.S
at org.apache.catalina.core.C
at org.apache.coyote.tomcat4.
at org.apache.coyote.http11.H
at org.apache.coyote.http11.H
at org.apache.tomcat.util.net
at org.apache.tomcat.util.thr
at java.lang.Thread.run(Threa
>> org.apache.jasper.JasperEx ception: /TMPkzut4v3ue5.jsp(4,16) equal symbol expected
it is pointing to line 4 of TMPkzut4v3ue5.jsp
it is pointing to line 4 of TMPkzut4v3ue5.jsp
eh, here it is:
<jsp:forward: page "main.jsp"/>
should be
<jsp:forward: page="main.jsp"/>
you are missing the equal symble.
<jsp:forward: page "main.jsp"/>
should be
<jsp:forward: page="main.jsp"/>
you are missing the equal symble.
ASKER
hey well spotted
but i am still getting the same error!!
it does say equal sign??
what could it be ...
but i am still getting the same error!!
it does say equal sign??
what could it be ...
take the line number that's reported and see if there is any syntax error.
ASKER
<jsp:useBean id="Bean2" class="com.ora.jsp.beans.u serinfo.Us erLoginBea n" scope="request"/>
<jsp:setProperty name="Bean2" property="*"/><% if( Bean2.isValid() && Bean2.isUser() ) { %>
<jsp:forward page="main.jsp"/>
<% } %>
when i test the page, it opens the login.jsp and when i enter the data it returns the same error as above
<jsp:setProperty name="Bean2" property="*"/><% if( Bean2.isValid() && Bean2.isUser() ) { %>
<jsp:forward page="main.jsp"/>
<% } %>
when i test the page, it opens the login.jsp and when i enter the data it returns the same error as above
could the error be in the forwarded page? you need to check the jsp page name in the error message
find the exact line in exact jsp file mentioned in the error message.
ASKER
so it reports
/UserLogin.jsp(4,16) equal symbol expected
i checked line 4 and there are no syntax errors that i can see
i am not sure what the 16 refers to cos it doesn't refer to any of the jsp
gaz
16 referes to the 16 the character in the line.
do a refresh, or delete your IE's temp files.
ASKER
i guess that it is the jsp if statement
why wouldn't it work....?
line 4 = <jsp:setProperty name="Bean2" property="*"/><% if( Bean2.isValid() && Bean2.isUser() ) { %>
line 5 = <jsp:forward page="Success.jsp"/>
line 6 = <% } %>
why wouldn't it work....?
line 4 = <jsp:setProperty name="Bean2" property="*"/><% if( Bean2.isValid() && Bean2.isUser() ) { %>
line 5 = <jsp:forward page="Success.jsp"/>
line 6 = <% } %>
you Bean2 is com.ora.jsp.beans.userinfo .UserLogin Bean, make sure the both method are returning boolean.
you can test it by changing the code to:
<%=Bean2.isValid() %><p>
<%=Bean2.isUser() %><p>
also, try to break and add space to see if the line number changes:
<jsp:setProperty name="Bean2" property="*"/>
<% if( Bean2.isValid() && Bean2.isUser() ) { %>
<jsp:forward page="Success.jsp"/>
you can test it by changing the code to:
<%=Bean2.isValid() %><p>
<%=Bean2.isUser() %><p>
also, try to break and add space to see if the line number changes:
<jsp:setProperty name="Bean2" property="*"/>
<% if( Bean2.isValid() && Bean2.isUser() ) { %>
<jsp:forward page="Success.jsp"/>
ASKER
this is what i tried and i got a bizarre error
i used some of the old code from UserRegBean and its method insertData
to produce the isUser() for UserLoginBean and this method seems to be using it
i am confused
can you shed any light?????
<jsp:setProperty name="Bean2" property="*"/>
<% if( Bean2.isUser() ) { %>
<jsp:forward page="Success.jsp"/>
javax.servlet.ServletExcep tion: invalid data - from UserRegBean.insertData
at org.apache.jasper.runtime. PageContex tImpl.hand lePageExce ption(Page ContextImp l.java:536 )
at org.apache.jsp.TMPnp0qdv3x w2_jsp._js pService
i used some of the old code from UserRegBean and its method insertData
to produce the isUser() for UserLoginBean and this method seems to be using it
i am confused
can you shed any light?????
<jsp:setProperty name="Bean2" property="*"/>
<% if( Bean2.isUser() ) { %>
<jsp:forward page="Success.jsp"/>
javax.servlet.ServletExcep
at org.apache.jasper.runtime.
at org.apache.jsp.TMPnp0qdv3x
ASKER
should i give the class a different package folder & recompile it??
this is weird
this is weird
ken, i admire you a lot....
ASKER
thanks Kuching
thats nice
thats nice
ASKER
hey ken i
have a different error now that mucked about with the bean
any ideas?????
i have a : org.apache.jasper.JasperEx ception: [Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause.
i checked the sql but can't see ought??
ps = conn.prepareStatement( "SELECT EmailAddress, Username, Password FROM UserRegInformation WHERE"
+ "EmailAddress = ? AND Username = ? AND Password = ?)" );
ps.setString( 1, emailAddress);
ps.setString( 2, userName );
ps.setString( 3, passWord );
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return true;
}
else {
return false;
}
have a different error now that mucked about with the bean
any ideas?????
i have a : org.apache.jasper.JasperEx
i checked the sql but can't see ought??
ps = conn.prepareStatement( "SELECT EmailAddress, Username, Password FROM UserRegInformation WHERE"
+ "EmailAddress = ? AND Username = ? AND Password = ?)" );
ps.setString( 1, emailAddress);
ps.setString( 2, userName );
ps.setString( 3, passWord );
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return true;
}
else {
return false;
}
ASKER
hey ken
i spotted it eventually
there is no space between where and email and there is an extra )
well it works fine now
again you pulled me kicking and screaming through that one
you have the patience of a saint
i appreciate it
i will open another thread to award you more points
thanks
Gaz
i spotted it eventually
there is no space between where and email and there is an extra )
well it works fine now
again you pulled me kicking and screaming through that one
you have the patience of a saint
i appreciate it
i will open another thread to award you more points
thanks
Gaz
I left my office so couldn't get back to you soon. glad to know your problem was resolved eventually.
don't worry about the points.
don't worry about the points.
ASKER
because i think that it would make more sense to me and i think that i could
do the redirection in jsp or is this completely wrong???
gaz
public boolean userlogCheck() throws ClassNotFoundException, SQLException {
Class.forName("sun.jdbc.od
Connection conn = null;
PreparedStatement ps = null;
try {
if (!isValid() ){
throw new SQLException( "invalid data - from UserRegBean.insertData" );
}
else {
conn = DriverManager.getConnectio
ps = conn.prepareStatement( "SELECT EmailAddress, Username, Password FROM UserRegInformation UserRegInformation WHERE"
+ "EmailAddress = ? AND Username = ? AND Password = ?)" );
ps.setString( 1, emailAddress);
ps.setString( 2, userName );
ps.setString( 3, passWord );
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return true; here, i would like to redirect the user to another jsp page
}
else {
return false; here i would like to return the user to the login page and call the propertyStat
}
}
}
finally {
if( ps != null )
try {ps.close(); }
catch( Throwable t ) { t.printStackTrace(); }
if( conn!=null)
try {conn.close(); }
catch( Throwable t ) { t.printStackTrace(); }
}
}