Hello.. I have a problem
I'm using the following files to do some basic input checking from a form:
register.htm gathers input and submits to process.jsp
process.jsp calls FormBean.class which does some basic error checking, control goes back to process.jsp
[IF] FormBean's validate method() comes back valid, the user is directed to success jsp and his information is copied to a database handler bean
[ELSE]
redirect user to retry.jsp
____________________________________
I get the following error message (I get the same thing deploying under websphere)
An error occurred at line: 10 in the JSP file: /process.jsp
Generated servlet error:
C:\Sun\studio5_se\appserver7\domains\domain1\server1\generated\jsp\j2ee-modules\Forms\_jasper\_process_jsp.java:76: Class _jasper.FormBean not found.
FormBean formHandler = null;
^
________________________________________________
FormBean.class
import java.util.*;
public class FormBean {
private String email;
private String userName;
private String password1;
private String password2;
private String displayname;
private Hashtable errors;
public boolean validate() {
boolean allOk=true;
if (email.equals("") || (email.indexOf('@') == -1)) {
errors.put("email","Please enter a valid email address");
email="";
allOk=false;
}
if (userName.equals("")) {
errors.put("userName","Please enter a username");
userName="";
allOk=false;
}
if (password1.equals("")) {
errors.put("password1","Please enter a valid password");
password1="";
allOk=false;
}
if (!password1.equals("") && (password2.equals("") || !password1.equals(password2))) {
errors.put("password2","Please confirm your password");
password2="";
allOk=false;
}
if (displayname.equals("") ) {
errors.put("displayname", "Please enter a display name");
displayname="";
allOk=false;
}
return allOk;
}
public FormBean() {
email="";
password1="";
password2="";
displayname="";
errors = new Hashtable();
}
public String getEmail() {
return email;
}
public String getPassword1() {
return password1;
}
public String getPassword2() {
return password2;
}
public String displayname() {
return displayname;
}
public void setEmail(String eml) {
email=eml;
}
public void setPassword1(String p1) {
password1=p1;
}
public void setPassword2(String p2) {
password2=p2;
}
public void setdisplayname(String dp) {
displayname=dp;
}
}
_________________________________________________
register.htm
<html>
<body>
<form action="process.jsp" method=post>
<center>
<table cellpadding=4 cellspacing=2 border=0>
<th bgcolor="#CCCCFF" colspan=2>
<font size=5>Pollmeister.com - Tell us who you are!</font>
<br>
<font size=1><sup>*</sup> Required Fields</font>
</th>
<tr bgcolor="#c8d8f8">
<td valign=top>
<b>Your email address<sup>*</sup></b>
<br>
<input type="text" name="email" value="" size=60 maxlength=20></td>
<tr bgcolor="#c8d8f8">
<td valign=top>
<b>Password<sup>*</sup></b>
<br>
<input type="password" name="password1" size=10 value="" maxlength=10></td>
<td valign=top>
<b>Confirm Password<sup>*</sup></b>
<br>
<input type="password" name="password2" size=10 value="" maxlength=10></td>
<br>
</tr>
<tr>
<tr bgcolor="#c8d8f8">
<td valign=top>
<b>Desired Display name (This is what will be seen by other users)<sup>*</sup></b>
<br>
<input type="text" name="displayname" size=12 value="" maxlength=12></td>
<br>
</tr>
<tr bgcolor="#c8d8f8">
<td align=center colspan=2>
<input type="submit" value="Submit"> <input type="reset" value="Reset">
</td>
</tr>
</table>
</center>
</form>
</body>
</html>
_____________________________________________
process.jsp
<%@ page import="java.util.*" %>
<%!
ResourceBundle bundle =null;
public void jspInit() {
bundle = ResourceBundle.getBundle("forms");
}
%>
<jsp:useBean id="formHandler" class="FormBean" scope="request">
<jsp:setProperty name="formHandler" property="*"/>
</jsp:useBean>
<% if (formHandler.validate()) {
%>
<%--
<jsp:forward page="<%=bundle.getString(\"process.success\")%>"/>
--%>
<jsp:forward page="/DBHandler"/>
<%
} else {
%>
<jsp:forward page="<%=bundle.getString(\"process.retry\")%>"/>
<%
}
%>
_________________________________________________
I've deployed this application as an EAR file under websphere as well as Sun App server. Neither work. Here is the directory structure:
/project/ <- html and jsp files
/project/WEB-INF/classes <- bean
/project/WEB-INF/ <- web.xml
I got the source code from this tutorial:
http://www.javaworld.com/javaworld/jw-03-2000/jw-0331-ssj-forms-p4.html
Thanks for any help!!!
Dinesh the one
I'm using the following files to do some basic input checking from a form:
register.htm gathers input and submits to process.jsp
process.jsp calls FormBean.class which does some basic error checking, control goes back to process.jsp
[IF] FormBean's validate method() comes back valid, the user is directed to success jsp and his information is copied to a database handler bean
[ELSE]
redirect user to retry.jsp
____________________________________
I get the following error message (I get the same thing deploying under websphere)
An error occurred at line: 10 in the JSP file: /process.jsp
Generated servlet error:
C:\Sun\studio5_se\appserver7\domains\domain1\server1\generated\jsp\j2ee-modules\Forms\_jasper\_process_jsp.java:76: Class _jasper.FormBean not found.
FormBean formHandler = null;
^
________________________________________________
FormBean.class
import java.util.*;
public class FormBean {
private String email;
private String userName;
private String password1;
private String password2;
private String displayname;
private Hashtable errors;
public boolean validate() {
boolean allOk=true;
if (email.equals("") || (email.indexOf('@') == -1)) {
errors.put("email","Please enter a valid email address");
email="";
allOk=false;
}
if (userName.equals("")) {
errors.put("userName","Please enter a username");
userName="";
allOk=false;
}
if (password1.equals("")) {
errors.put("password1","Please enter a valid password");
password1="";
allOk=false;
}
if (!password1.equals("") && (password2.equals("") || !password1.equals(password2))) {
errors.put("password2","Please confirm your password");
password2="";
allOk=false;
}
if (displayname.equals("") ) {
errors.put("displayname", "Please enter a display name");
displayname="";
allOk=false;
}
return allOk;
}
public FormBean() {
email="";
password1="";
password2="";
displayname="";
errors = new Hashtable();
}
public String getEmail() {
return email;
}
public String getPassword1() {
return password1;
}
public String getPassword2() {
return password2;
}
public String displayname() {
return displayname;
}
public void setEmail(String eml) {
email=eml;
}
public void setPassword1(String p1) {
password1=p1;
}
public void setPassword2(String p2) {
password2=p2;
}
public void setdisplayname(String dp) {
displayname=dp;
}
}
_________________________________________________
register.htm
<html>
<body>
<form action="process.jsp" method=post>
<center>
<table cellpadding=4 cellspacing=2 border=0>
<th bgcolor="#CCCCFF" colspan=2>
<font size=5>Pollmeister.com - Tell us who you are!</font>
<br>
<font size=1><sup>*</sup> Required Fields</font>
</th>
<tr bgcolor="#c8d8f8">
<td valign=top>
<b>Your email address<sup>*</sup></b>
<br>
<input type="text" name="email" value="" size=60 maxlength=20></td>
<tr bgcolor="#c8d8f8">
<td valign=top>
<b>Password<sup>*</sup></b>
<br>
<input type="password" name="password1" size=10 value="" maxlength=10></td>
<td valign=top>
<b>Confirm Password<sup>*</sup></b>
<br>
<input type="password" name="password2" size=10 value="" maxlength=10></td>
<br>
</tr>
<tr>
<tr bgcolor="#c8d8f8">
<td valign=top>
<b>Desired Display name (This is what will be seen by other users)<sup>*</sup></b>
<br>
<input type="text" name="displayname" size=12 value="" maxlength=12></td>
<br>
</tr>
<tr bgcolor="#c8d8f8">
<td align=center colspan=2>
<input type="submit" value="Submit"> <input type="reset" value="Reset">
</td>
</tr>
</table>
</center>
</form>
</body>
</html>
_____________________________________________
process.jsp
<%@ page import="java.util.*" %>
<%!
ResourceBundle bundle =null;
public void jspInit() {
bundle = ResourceBundle.getBundle("forms");
}
%>
<jsp:useBean id="formHandler" class="FormBean" scope="request">
<jsp:setProperty name="formHandler" property="*"/>
</jsp:useBean>
<% if (formHandler.validate()) {
%>
<%--
<jsp:forward page="<%=bundle.getString(\"process.success\")%>"/>
--%>
<jsp:forward page="/DBHandler"/>
<%
} else {
%>
<jsp:forward page="<%=bundle.getString(\"process.retry\")%>"/>
<%
}
%>
_________________________________________________
I've deployed this application as an EAR file under websphere as well as Sun App server. Neither work. Here is the directory structure:
/project/ <- html and jsp files
/project/WEB-INF/classes <- bean
/project/WEB-INF/ <- web.xml
I got the source code from this tutorial:
http://www.javaworld.com/javaworld/jw-03-2000/jw-0331-ssj-forms-p4.html
Thanks for any help!!!
Dinesh the one