wood burning stoves 2.0*
The moose likes Struts and the fly likes HTTP Status 500 - Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "HTTP Status 500 - " Watch "HTTP Status 500 - " New topic
Author

HTTP Status 500 -

Bacchi Gerem
Ranch Hand

Joined: Jan 23, 2004
Posts: 120
I am getting this error. I have my AddresForm class under roseindia/net/AddressForm.class. I am running on Tomcate.

Thanks

HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Exception creating bean of class roseindia.net.AddressForm: {1}
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.pages.Address_jsp._jspService(Address_jsp.java:88)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

javax.servlet.jsp.JspException: Exception creating bean of class roseindia.net.AddressForm: {1}
org.apache.struts.taglib.html.FormTag.initFormBean(FormTag.java:463)
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:433)
org.apache.jsp.pages.Address_jsp._jspx_meth_html_form_0(Address_jsp.java:155)
org.apache.jsp.pages.Address_jsp._jspx_meth_html_html_0(Address_jsp.java:115)
org.apache.jsp.pages.Address_jsp._jspService(Address_jsp.java:79)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Make sure this class has a public, no-arguments constructor, and that the fully qualified class name is spelled correctly when you define it in the <form-bean> definition in the struts-config.xml file.


Merrill
Consultant, Sima Solutions
Bacchi Gerem
Ranch Hand

Joined: Jan 23, 2004
Posts: 120
Hi ,
Still iam getting the error.I downloaded the source code from the below url.
http://www.roseindia.net/struts/index.shtml.

I did all the change.But still iam getting Exception.

Thanks
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Show us your AddressForm class, your JSP, and the <form-bean> and <action> definitions in your struts-config.xml file.
Bacchi Gerem
Ranch Hand

Joined: Jan 23, 2004
Posts: 120
AddressForm :


package roseindia.net;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.*;

public class AddressForm extends ActionForm
{
private String name=null;
private String address=null;
private String emailAddress=null;

public AddressForm() { }
public void setName(String name){
this.name=name;
}

public String getName(){
return this.name;
}

public void setAddress(String address){
this.address=address;
}

public String getAddress(){
return this.address;
}


public void setEmailAddress(String emailAddress){
this.emailAddress=emailAddress;
}

public String getEmailAddress(){
return this.emailAddress;
}


/**
* Reset all properties to their default values.
*
* @param mapping The mapping used to select this instance
* @param request The servlet request we are processing
*/
public void reset(ActionMapping mapping, HttpServletRequest request) {
this.name=null;
this.address=null;
this.emailAddress=null;
}

/**
* Reset all properties to their default values.
*
* @param mapping The mapping used to select this instance
* @param request The servlet request we are processing
* @return errors
*/
public ActionErrors validate(
ActionMapping mapping, HttpServletRequest request ) {
ActionErrors errors = new ActionErrors();

if( getName() == null || getName().length() < 1 ) {
errors.add("name",new ActionMessage("error.name.required"));
}
if( getAddress() == null || getAddress().length() < 1 ) {
errors.add("address",new ActionMessage("error.address.required"));
}
if( getEmailAddress() == null || getEmailAddress().length() < 1 ) {
errors.add("emailaddress",new ActionMessage("error.emailaddress.required"));
}

return errors;
}

}





Address.jsp:




<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>

<html:html locale="true">
<head>
<title><bean:message key="welcome.title"/></title>
<html:base/>
</head>
<body bgcolor="white">
<html:form action="/Address" method="post">
<html:errors/>
<table>
<tr>
<td align="center" colspan="2">
<font size="4">Please Enter the Following Details</font>
</tr>
<tr>
<td align="right">
Name
</td>
<td align="left">
<html:text property="name" size="30" maxlength="30"/>
</td>
</tr>
<tr>
<td align="right">
Address
</td>
<td align="left">
<html:text property="address" size="30" maxlength="30"/>
</td>
</tr>

<tr>
<td align="right">
E-mail address
</td>
<td align="left">
<html:text property="emailAddress" size="30" maxlength="30"/>
</td>
</tr>

<tr>
<td align="right">
<html:submit>Save</html:submit>
</td>
<td align="left">
<html:cancel>Cancel</html:cancel>
</td>
</tr>
</table>


</html:form>
</body>
</html:html>




Struts-config.xml



<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">

<struts-config>

<!-- ================================================ Form Bean Definitions -->

<form-beans>

<form-bean
name="AddressForm"
type="roseindia.net.AddressForm"/>
</form-beans>




<!-- =========================================== Action Mapping Definitions -->

<action-mappings>
<!-- Default "Welcome" action -->
<!-- Forwards to Welcome.jsp -->
<action
path="/Welcome"
forward="/pages/Welcome.jsp"/>
<action
path="/TestAction"
type="roseindia.net.TestAction">

<forward name="testAction" path="/pages/TestAction.jsp"/>
</action>

<action
path="/Address"
type="roseindia.net.AddressAction"
name="AddressForm"
scope="request"
validate="true"
input="/pages/Address.jsp">

<forward name="success" path="/pages/success.jsp"/>
</action>




<action
path="/AddressJavascriptValidation"
type="roseindia.net.AddressAction"
name="AddressForm"
scope="request"
validate="true"
input="/pages/AddressJavascriptValidation.jsp">
<forward name="success" path="/pages/success.jsp"/>
</action>
</action-mappings>





</struts-config>
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: HTTP Status 500 -
 
Similar Threads
Action mapping error !!
I am getting the follwing Exception in struts
what's the problem ?
Getting an Exception
Error while jsp connecting to database