Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New to Struts

Status
Not open for further replies.

difrad76

Programmer
Mar 19, 2006
1
CA
Hello,

I am brand spanking new to struts.

I am trying to build a very simple application with struts. In fact I am trying to replicate one available here
This is my struts-config.xml

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

<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
"
<struts-config>

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

<form-bean name="submitForm"
type="hansen.playground.SubmitForm"/>

</form-beans>

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

<action path="/submit"
type="hansen.playground.SubmitAction"
name="submitForm"
input="/submit.jsp"
scope="request">
<forward name="success" path="/submit.jsp"/>
<forward name="failure" path="/submit.jsp"/>
</action>

</action-mappings>

</struts-config>



In web-inf directory I have 2 classes
WEB-INF\classes\hansen\playground\SubmitAction.java
and
WEB-INF\classes\hansen\playground\SubmitForm.java

In my application root (for luck of the better term) directory

I have submit.jsp file and this is the code

<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<html>
<head><title>Submit example</title></head>
<body>

<h3>Example Submit Page</h3>

<html:errors/>

<html:form action="submit.do">
Last Name: <html:text property="lastName"/><br>
Address: <html:textarea property="address"/><br>
Sex: <html:radio property="sex" value="M"/>Male
<html:radio property="sex" value="F"/>Female<br>
Married: <html:checkbox property="married"/><br>
Age: <html:select property="age">
<html:eek:ption value="a">0-19</html:eek:ption>
<html:eek:ption value="b">20-49</html:eek:ption>
<html:eek:ption value="c">50-</html:eek:ption>
</html:select><br>
<html:submit/>
</html:form>

</body>
</html>



When I tried to run the app I got exception

org.apache.jasper.JasperException: Exception creating bean of class hansen.playground.SubmitForm: {1}

Does it mean that I set something wrong in my struts-config.xml or does it mean that there is something wrong with the file ?

Thanks
 
It doesn't appear that the structure of your program is incorrect. Is your SubmitForm extending ActionForm etc...
Could you provide the code for this as well ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top