• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Error in creation of bean

Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="form" %>

<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"/>

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)
public String getUsername()

public void setPassword1(String aPassword1)
public String getPassword1()

public void setPassword2(String apassword2)
public String getPassword2()

My struts-config.xml is as follows..

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-Apache Softaware Foundation 1.0//EN"

<form-bean name="registerForm" type="JavaSource.forms.registerform"/>

<action path="/register"
input="/register.jsp" >
<forward name="success" path="/success.html"/>
<forward name="failure" path="/failure.html"/>


Why the error javax.servlet.ServletException: Exception creating bean of class JavaSource.forms.registerform is coming ?
Can anybody help immediately..?
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

<form-bean name="registerForm" type="JavaSource.forms.registerform"/>


<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.
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic