Announcement Announcement Module
Collapse
No announcement yet.
How to set JSP fields using webflow Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to set JSP fields using webflow

    I have created a web subflow. I want to prepopulate the field actname with var1 (to show the value if I come back from next page).

    can not figure out how to do that.

    any help is appreciated.

    thanks
    Shivani
    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.0.xsd">
    <secured attributes="ROLE_USER" />
    	<persistence-context/>
    <on-start>
    <set name="flowScope.var1" value="''"></set>
    <set name="flowScope.var2" value="''"></set>
    </on-start>
    
    <view-state id="startsubflow">
    	<transition on="previous" to="novalue">
    	</transition>
    	<transition on="next" to="nextpage">
    		<set name="var1" value="requestParameters.actname"/>
    	</transition>
    </view-state>
    
    
    <view-state id="nextpage" model="booking">
    	<transition on="previous" to="startsubflow">
    	</transition>
    	<transition on="next" to="backtomain">
    		<set name="var2" value="requestParameters.actaddress"/>
    	</transition>
    </view-state>
    	
    <end-state id="backtomain">
    	<output name="var1" />
    	<output name="var2" />
    </end-state>
    	
    <end-state id="novalue">
    </end-state>
    			
    </flow>
    the corresponding view to startsubflow is
    HTML Code:
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
    <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
    
    
    <form:form  method="post" >
        
       <fieldset>
    	What's your name? <INPUT TYPE=TEXT NAME=actname SIZE=20>
    
    				
    	<div class="buttonGroup">
    		
    		<input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}">
    		<input type="submit" name="_eventId_previous" value="Previous"/>&#160;
    		<input type="submit" name="_eventId_next" value="Next" />
            </div>
       </fieldset>
    </form:form>

  • #2
    How to set JSP fields using webflow

    There are few things i would like to point ..

    In transition to next page you are setting the actname variable in request scope. (U can use flow scope if the variable is going to be alive for entire flow)

    <view-state id="nextpage" model="booking">
    model="booking" is not required

    i am not sure but we should us this in jsp <INPUT TYPE=TEXT NAME=actname SIZE=20 value = ${actname}>

    Comment


    • #3
      Thanx for the valuable info

      Comment

      Working...
      X