| Author |
Error in creation of bean
|
Vijay Bhore
Greenhorn
Joined: May 15, 2006
Posts: 12
|
|
Hi friends I am consistently getting this error javax.servlet.ServletException: Exception creating bean of class JavaSource.forms.registerform: I have created a jsp file register.jsp as follow, <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="form" %> <form:html> <body> <form:form action="/register.do"> User Name:<form:text property="username"/><br> Enter Password:<form assword property="password1"/><br> Re-Enter Password:<form assword property="password2"/><br> <form:submit value="Register"/> </form:form> </body> </form:html> I am using Eclipse to create Dynamic web project. For the above created register.jsp I have created a bean registerform.java in forms folder under Javasource folder as.. package forms; import org.apache.struts.action.*; import org.apache.struts.action.ActionForm; public class registerform extends ActionForm { public String username=null; public String password1=null; public String password2=null; public void setUsername(String aUsername) { username=aUsername; } public String getUsername() { return(username); } public void setPassword1(String aPassword1) { password1=aPassword1; } public String getPassword1() { return(password1); } public void setPassword2(String apassword2) { password2=apassword2; } public String getPassword2() { return(password2); } } My struts-config.xml is as follows.. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts-config PUBLIC "-Apache Softaware Foundation 1.0//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd"> <struts-config> <form-beans> <form-bean name="registerForm" type="JavaSource.forms.registerform"/> </form-beans> <action-mappings> <action path="/register" type="JavaSource.actions.registerAction" name="registerForm" input="/register.jsp" > <forward name="success" path="/success.html"/> <forward name="failure" path="/failure.html"/> </action> </action-mappings> </struts-config> Why the error javax.servlet.ServletException: Exception creating bean of class JavaSource.forms.registerform is coming ? Can anybody help immediately..?
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
Change <form-bean name="registerForm" type="JavaSource.forms.registerform"/> to <form-bean name="registerForm" type="forms.registerform"/> The source code you provoded indicates that the registerForm class is in package forms, not JavaSource.forms. Also, just a note on style: Standard Java naming conventions dictate that a class name should start with an upper-case letter. You will want to change registerForm to RegisterForm.
|
Merrill
Consultant, Sima Solutions
|
 |
 |
|
|
subject: Error in creation of bean
|
|
|