aspose file tools*
The moose likes Performance and the fly likes spring webflow Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Performance
Reply locked New topic
Author

spring webflow

Pawan Payaal
Greenhorn

Joined: Jan 11, 2008
Posts: 5
Hi,

I am getting the "http 404 - the requested resource () is not available" error while creating the simple spring webflow application. the snapshot of the code is below

I am using Eclipse Version: 3.2.2 and Tomcat 5.5

Member Action -:
public class MemberAction extends FormAction
{
private static final Logger log = Logger.getLogger(MemberAction.class);

public Event processSubmit(RequestContext context) throws Exception
{
log.debug("MemberAction.setupForm");
MemberForm memberForm = null;
try
{
memberForm = (MemberForm)getFormObject(context);
}
catch (Exception e)
{
log.debug("MemberAction.setupForm -catch");
e.printStackTrace();
}
return success();
}

}

MemberForm -:
public class MemberForm implements Serializable
{
private String firstName;
private String lastName;
public String getFirstName()
{
return firstName;
}
public void setFirstName(String firstName)
{
this.firstName = firstName;
}
public String getLastName()
{
return lastName;
}
public void setLastName(String lastName)
{
this.lastName = lastName;
}
}

myFlow.xml -:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE flow PUBLIC "-//SPRING//DTD WEBFLOW 1.0//EN"
"http://www.springframework.org/dtd/spring-webflow-1.0.dtd">

<flow start-state="displayForm">

<view-state id="displayForm" view="memberForm">
<entry-actions>
<action bean="memberAction"/>
</entry-actions>
<transition on="submit" to="processSubmit">
<action bean="memberAction" method="bindAndValidate"/>
</transition>
</view-state>

<action-state id="processSubmit">
<action bean="memberAction" method="processSubmit"/>
<transition on="success" to="finish"/>
</action-state>

<end-state id="finish" view="success"/>

</flow>


web.xml -:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
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">

<!-- Spring configs-->
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/memberBean.xml,/WEB-INF/webflow.xml
</param-value>
</init-param>
</servlet>

<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
<!-- Spring configs-->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>

memberBean.xml -:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

<!-- Result form action that setups the form and processes form submissions -->

<bean name="/memberApp.htm"
class="org.springframework.webflow.executor.mvc.FlowController">
<property name="flowExecutor" ref="flowExecutor" />
</bean>
<bean id="memberAction" class="com.example.MemberAction" />
<!-- Maps flow view-state view names to JSP templates with JSTL support -->
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/jsp/" />
<property name="suffix" value=".jsp" />
</bean>

</beans>

webflow.xml -:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:flow="http://www.springframework.org/schema/webflow-config"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/webflow-config
http://www.springframework.org/schema/webflow-config/spring-webflow-config-1.0.xsd">

<!-- Launches new flow executions and resumes existing executions. -->
<flow:executor id="flowExecutor" registry-ref="flowRegistry"/>

<!-- Creates the registry of flow definitions for this application -->
<flow:registry id="flowRegistry">
<flow:location path="/WEB-INF/flow/myFlow.xml"/>
</flow:registry>

</beans>


memberForm.jsp -:

<html>
<head>
<title>My Form</title>
</head>
<body>
<table>
<form action="memberApp.htm">
<tr>
<td>First Name:</td>
<td><input type="text" name="firstName" size="25"/></td>
</tr>
<tr>
<td>Last Name:</td>
<td><input type="text" name="lastName" size="25"/></td>
</tr>
<tr>
<td colspan="2" align="right">
<input name="_eventId_submit" type="submit">
<input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}">
</td>
</tr>
</form>
</table>
</body>
</html>



Thanks
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
I don't know what forum this should go in, but it's certainly nothing to do with the Performance forum, so I am closing the thread.

Original poster - please carefully choose the right forum, and re-post if you need to do so.


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: spring webflow