Hi,
I am facing a similar sought of exception, can any one pls suggest me.
I am getting an exception
Exception creating bean of class com.st.csm.it.custsurvey.dao.CusotmerSurveyForm: {1}
My JSP:
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<HTML>
<HEAD>
<TITLE> Struts Application </TITLE>
</HEAD>
<BODY>
<html:form action="Lookup" >
<table width="81%" border="0" cellspacing="2" cellpadding="1">
<tr>
<td width="33%" align="left"><a href="CS-PartB.html" >Prev </a></td>
<td align="center" width="33%">
<a href="CS-PartC.html"><b>Save</b></a>
</td>
<td align="right" width="33%">
<a> </a>
</td>
</tr>
</table>
<br>
<%
System.out.println("Hi at Login.jsp");
%>
<table width="68%" border="1" cellspacing="2" cellpadding="1">
<tr>
<td>
<div align="left"><font face="Arial, Helvetica, sans-serif" size="3"><b>Part
C Focus Summary</b></font></div>
</td>
</tr>
<tr>
<td><font face="Arial, Helvetica, sans-serif" size="2">1. List the things
you would like Chartered to improve on to make our products/Services betterfor
you. Rank them by priorities.</font></td>
</tr>
<table width="45%" border="0">
<tr>
<td><html:text property="comments" /></td><br>
<td align="center"><html:submit /></td>
</tr>
</html:form>
</BODY>
</HTML>
CustomerSurveyForm
package com.st.csm.it.custsurvey.dao;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
public class CustomerSurveyForm extends ActionForm
{
private
String comments = null;
public CustomerSurveyForm () {
System.out.println("Inside CustomerSurveyForm 000 : ");
}
public String getcomments() {
System.out.println("Inside CustomerSurveyForm 111 : ");
return comments;
}
public void setcomments(String comments) {
System.out.println("Inside CustomerSurveyForm 222: ");
this.comments = comments;
}
public void reset(ActionMapping mapping,HttpServletRequest request){
this.comments = null;
}
}
LookupActionBean
ActionClass)
package com.st.csm.it.custsurvey.dao;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
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.st.csm.it.custsurvey.dao.CustomerSurveyForm;
public class LookupActionBean extends Action
{
public ActionForward execute(ActionMapping mapping,ActionForm form,
HttpServletRequest request,
HttpServletRequest response)
throws IOException,ServletException {
System.out.println("target:");
String target = new String("success");
System.out.println("target:"+target);
System.out.println("form:"+form);
if(form != null) {
CustomerSurveyForm csForm = (CustomerSurveyForm)form;
String message = csForm.getcomments();
System.out.println("message:"+message);
System.out.println("form:"+form);
String comments = request.getParameter("comments");
System.out.println("comments:"+comments);
if(comments == null){
target = new String("failure");
}
}
return(mapping.findForward(target));
}
}
struts-config.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Copyright 2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!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>
<!-- Form Bean Definitions -->
<form-beans>
<form-bean name="CustomerSurveyForm" type="com.st.csm.it.custsurvey.dao.CustomerSurveyForm"/>
</form-beans>
<form-beans>
<form-bean name="LookupActionBean" type="com.st.csm.it.custsurvey.dao.LookupActionBean"/>
</form-beans>
<!-- Action Mapping Definitions -->
<action-mappings>
<action path="/Lookup"
type="com.st.csm.it.custsurvey.dao.LookupActionBean"
name="CustomerSurveyForm"
input="/login.jsp">
<forward name="success" path="/mytest.jsp"/>
<forward name="failure" path="/index.jsp"/>
</action>
</action-mappings>
<!-- message resources -->
<message-resources parameter="com.st.csm.it.custsurvey.ApplicationResources" />
</struts-config>
web-xml file
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Copyright 2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
<display-name>Welcome to Tomcat</display-name>
<description>
Welcome to Tomcat
</description>
<!-- JSPC servlet mappings start -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>org.apache.jsp.index_jsp</servlet-name>
<servlet-class>org.apache.jsp.index_jsp</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>org.apache.jsp.index_jsp</servlet-name>
<url-pattern>/index.jsp</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>org.apache.jsp.mytest_jsp</servlet-name>
<servlet-class>org.apache.jsp.mytest_jsp</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>org.apache.jsp.mytest_jsp</servlet-name>
<url-pattern>/mytest.jsp</url-pattern>
</servlet-mapping>
<!-- JSPC servlet mappings end -->
<taglib>
<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
</web-app>
Can any one pls help me.