• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Exception creating bean of class

 
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi List[],

I am getting following exception in struts.And using MyEclipse ID.
Please help me.

org.apache.jasper.JasperException: Exception creating bean of class com.yourcompany.struts.form.SupdateForm: {1}
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:476)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:371)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax





















My Action Class

/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.yourcompany.struts.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.yourcompany.struts.form.SupdateForm;

/**
* MyEclipse Struts
* Creation date: 11-21-2008
*
* XDoclet definition:
* @struts.action path="/supdate" name="supdateForm" input="/form/supdate.jsp" scope="request" validate="true"
* @struts.action-forward name="sucess" path="supdate.jsp"
*/
public class SupdateAction extends Action {
/*
* Generated Methods
*/

/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
SupdateForm supdateForm = (SupdateForm) form;// TODO Auto-generated method stub
return null;
}
}

My Action Form clas

/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.yourcompany.struts.form;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.validator.ValidatorForm;

/**
* MyEclipse Struts
* Creation date: 11-21-2008
*
* XDoclet definition:
* @struts.form name="supdateForm"
*/
public class SupdateForm extends ValidatorForm {
/*
* Generated fields
*/

/** name property */
private String name;

/*
* Generated Methods
*/

/**
* Method validate
* @param mapping
* @param request
* @return ActionErrors
*/
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
// TODO Auto-generated method stub
return null;
}

/**
* Method reset
* @param mapping
* @param request
*/
public void reset(ActionMapping mapping, HttpServletRequest request) {
// TODO Auto-generated method stub
}

/**
* Returns the name.
* @return String
*/
public String getName() {
return name;
}

/**
* Set the name.
* @param name The name to set
*/
public void setName(String name) {
this.name = name;
}
}

My Strut config file

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">

<struts-config>
<data-sources />
<form-beans >
<form-bean name="studRegForm" type="com.yourcompany.struts.form.StudRegForm" />
<form-bean name="searchForm" type="com.yourcompany.struts.form.SearchForm" />
<form-bean name="supdateForm" type="com.yourcompany.struts.form.SupdateForm" />

</form-beans>

<global-exceptions />
<global-forwards />
<action-mappings >
<action
attribute="studRegForm"
input="/form/studReg.jsp"
name="studRegForm"
path="/studReg"
scope="request"
type="com.yourcompany.struts.action.StudRegAction">
<forward name="sucess" path="/form/studReg.jsp" />
</action>
<action
attribute="searchForm"
input="/form/search.jsp"
name="searchForm"
path="/search"
scope="request"
type="com.yourcompany.struts.action.SearchAction">
<forward name="sucess" path="/form/search.jsp" />
</action>
<action
attribute="supdateForm"
input="/form/supdate.jsp"
name="supdateForm"
path="/supdate"
scope="request"
type="com.yourcompany.struts.action.SupdateAction">
<forward name="sucess" path="/supdate.jsp" />
</action>



</action-mappings>

<message-resources parameter="com.yourcompany.struts.ApplicationResources" />
</struts-config>

and My Input page is

<%@ page language="java" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>

<html>
<head>
<title>JSP for SupdateForm form</title>
</head>
<body>
<html:form action="/supdate">
name : <html:text property="name"/><html:errors property="name"/><br/>
<html:submit/><html:cancel/>
</html:form>
</body>
</html>
 
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the URL you are submitting when you get this request? Are you calling an action or going straight to a jsp?
 
pankaj semwal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am calling jsp page.And My URL is

http://localhost:1982/StudentPotral/form/supdate.jsp
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you request a JSP directly you are bypassing the Struts framework. Struts will not create the form bean for you, thus the Struts form tags will fail.
 
pankaj semwal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Then how i can show this page.
Please help me.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Go through an action. If you're using Struts form tags, you have to have an action form. To get an action form you can't bypass Struts by going directly to a JSP (which is generally frowned-upon anyway).
 
pankaj semwal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Still i am getting the same error.Even i use action .

But at the console i am getting this error.

java.lang.ClassNotFoundException: com.yourcompany.struts.form.UpdateForm


at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1340)
at org.apache.catalina.loader.WebappClassLoader.loadClass(W
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you have an UpdateForm class? You also need to include the actual mapping for the action you're accessing; it wouldn't be trying to access an UpdateForm class if you didn't tell it to.

The errors you're getting provide all the information you need to solve your problem. When you provide source and configurations please use the UBB code tags so it's formatted in a readable fashion.
 
pankaj semwal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Sir i got and find the solutions.
 
Don't play dumb with me! But you can try this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic