File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Application Frameworks and the fly likes Spring weblflow Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Spring weblflow" Watch "Spring weblflow" New topic
Author

Spring weblflow

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" />
<bean id="member" class="com.example.MemberForm"/>

<!-- 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
Sergey Chunayev
Greenhorn

Joined: Jan 24, 2008
Posts: 6
Hi, you set incorrect value for the "prefix" property of your view resolver. It must start with /WEB-INF/. In your case it should be the /WEB-INF/jsp/ value
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

"spyboost",
Please check your private messages.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
 
subject: Spring weblflow
 
Similar Threads
collection getting appended on refresh of page
Spring web flow: Not proceeding from first page to second page
spring webflow
"Document root element "beans", must match DOCTYPE root" problem
Encountering server internal error while running the local application in the tomcat server.