Note that there are some explanatory texts on larger screens.

plurals
  1. POSpring Web Flow: How do I pass values from one flow to another flow
    primarykey
    data
    text
    <p>I have a Java web application using spring web flow. </p> <p>How do I pass values from one flow to another flow?</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;flow xmlns="http://www.springframework.org/schema/webflow" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd"&gt; &lt;persistence-context /&gt; &lt;var name="editBean" class="jp.co.anicom.domain.User" /&gt; &lt;var name="deleteBean" class="jp.co.anicom.domain.User" /&gt; &lt;var name="authorityBean" class="jp.co.anicom.domain.Authority" /&gt; &lt;on-start&gt; &lt;set name="flowScope.username" value="requestParameters.username" /&gt; &lt;/on-start&gt; &lt;action-state id="queryAll"&gt; &lt;evaluate expression="employeeAction.GetAuthority(flowScope.username)" result="authorityBean" /&gt; &lt;transition to="editForm" /&gt; &lt;/action-state&gt; &lt;view-state id="editForm" model="editBean" view="../xhtml/framework/edit"&gt; &lt;transition on="editButton" to="validateAccount" /&gt; &lt;transition on="delete" to="getId" /&gt; &lt;transition on="back" to="editSuccessful" /&gt; &lt;/view-state&gt; &lt;action-state id="validateAccount"&gt; &lt;evaluate expression="employeeAction.GetEmployee(flowScope.username, oldPassword)" result="editBean" /&gt; &lt;transition to="checkUserAccount" /&gt; &lt;/action-state&gt; &lt;action-state id="getId"&gt; &lt;evaluate expression="employeeAction.GetEmployee(flowScope.username)" result="deleteBean" /&gt; &lt;transition to="deleteUser" /&gt; &lt;/action-state&gt; &lt;decision-state id="checkUserAccount"&gt; &lt;if test="editBean == null" then="queryAll" else="confirmPassword" /&gt; &lt;/decision-state&gt; &lt;decision-state id="confirmPassword"&gt; &lt;if test="newPassword.equals(confirmPassword)" then="editUser1" else="queryAll" /&gt; &lt;/decision-state&gt; &lt;action-state id="editUser1"&gt; &lt;set name="editBean.password" value="newPassword" /&gt; &lt;transition to="editUser2" /&gt; &lt;/action-state&gt; &lt;action-state id="editUser2"&gt; &lt;evaluate expression="employeeAction.editEmployee(editBean, authorityBean.authority)" /&gt; &lt;transition to="editSuccessful" /&gt; &lt;/action-state&gt; &lt;action-state id="deleteUser"&gt; &lt;evaluate expression="employeeAction.deleteEmployee(deleteBean)" /&gt; &lt;transition to="editSuccessful" /&gt; &lt;/action-state&gt; &lt;end-state id="editSuccessful" view="externalRedirect:contextRelative:/admin_main.do" commit="true" /&gt; &lt;end-state id="displayError" view="../xhtml/framework/displayError" /&gt; &lt;end-state id="dummy1" view="../xhtml/framework/dummy" /&gt; &lt;global-transitions&gt; &lt;transition on-exception="java.lang.Exception" to="displayError" /&gt; &lt;/global-transitions&gt; &lt;/flow&gt; </code></pre> <p>I am having a problem with the edit functionality here. In my edit page I have username, oldpassword, newpassword and confirm password fields. </p> <p>First in validateAccount state I check if the username and oldpassword exists in the database, if it it doesn't exist I forward it to queryall state. </p> <p>If it exists I check if the new password and confirmpassword values are the same, if they are the same I proceed with the editing. </p> <p>If not I return again to queryAll. </p> <p>QueryAll state gets the authority of the user to populate it in the form upon re-displaying the page. When I leave the password fields blank and the first time I click edit button It throws a java.lang.NullPointerException. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload