Pawan Payaal

Greenhorn
+ Follow
since Jan 11, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Pawan Payaal

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
now i have written the entire code in one xml file i.e dispatcher-servlet.xml but still the error is same. As per my understaning everything is fine now. I think i am missing something...but i really have no idea what to do next.
16 years ago
Hi sruthi,

Thanks for your immediate reply I have made the required changes but still the problem is same...
16 years ago
Hi sruthi,

Many thanks for your immidiat reply.

I have made the changes but still the problem is same...
16 years ago
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
16 years ago