Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Spring weblflow

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"spyboost",
Please check your private messages.
 
Come have lunch with me Arthur. Adventure will follow. This tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!