Announcement Announcement Module
Collapse
No announcement yet.
Return value from Button-click in view-state Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Return value from Button-click in view-state

    Hello,
    I'm developing an webapp using mvc and webflow.
    I have an Flow which contains a view-state whose view (using JSP-Pages) contains a dynamically generated table.
    Every row in this table has a button and an ID field, which I have. I now want to return this ID to the Flow and process it in an subsequently entered decision-state and action-state.
    I also would be if it would work with Browsers which have JavaScript disabled.

    Also I want to access the last state the user was in in my JSP, such that I can print a message when the user comes from isValid, but not when he just entered the flow.
    How can I solve that?

    So this is a minimal example of my flow:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <flow xmlns="http://www.springframework.org/schema/webflow"
    	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.4.xsd "
    	start-state="GetId">
    
    <view-state id="GetId" view="GetId">
          <!-- How  to read the rowId in ID ?-->
          <transition on="ButtonPressed" to="isValid" />
    </view>
    
    <decision-state id="isValid">
          <if test="IdValidator.isValidId(ID)" then="congratz" else="GetId" />
    </decision-state>
    
    <end-state id="congratz" />
    </flow>
    And this is something like my GetId.jsp:
    Code:
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
    	xmlns:form="http://www.springframework.org/tags/form" version="2.0">
    	<jsp:directive.page language="java"
    		contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" />
    
    	<table border="1" cellspacing="0" cellpadding="0">
                    <form:form>
                    <input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}" />
    		<c:forEach items="${Object.getStuff()}"
    			var="Item">
    			<tr>
    				<td>${Item.getID()}</td>
    				<td>${Item.getDescription()}</td>
    				<td>
    					<form:button id="${Item.getID()}"
    						value="Choose this one"
    						name="_eventId_ButtonPressed" />
    				</td>
    			</tr>
    		</c:forEach>
                    </form:form>
    	</table>
    </jsp:root>
Working...
X