Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6000379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:41:05+00:00 2026-05-23T00:41:05+00:00

I’m writing a spring webflow with MVC and persistence scaffolded by Spring Roo. In

  • 0

I’m writing a spring webflow with MVC and persistence scaffolded by Spring Roo. In this flow, the user is supposed to be creating multiple instances of one entity, which in turn is to be referenced from another entity. For simplicity, I’ll dub these entities MyClass1 and MyClass2. I’m having a hard time figuring out how to keep a list of persisted entities, which is needed at confirmation.

I have previously posted a question regarding the same topic. I do feel, however, that editing the original question (even more) in order to further clarify my issue would violate the SO-“protocol”, and so I’ve decided to ask a refined version of the original question. In retrospect, I realize that the original question should’ve been more accurate. I’m probably gonna get some heat for this, but I feel the question is important enough (at least to me!) to take it. 🙂

I’m including my roo-script to let anyone easily reproduce my setup. Here it is:

project --topLevelPackage com.test.webflow
persistence setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY
entity --class ~.domain.Class1 --testAutomatically 
field string --fieldName name
entity --class ~.domain.Class2 --testAutomatically 
field string --fieldName name
field reference --fieldName class1 --type ~.domain.Class1
controller scaffold --class ~.web.Class1Controller --entity ~.domain.Class1
controller scaffold --class ~.web.Class2Controller --entity ~.domain.Class2
web flow --flowName registration

The flow.xml in /WEB-INF/views/registration looks like this:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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">
    <on-start>
        <evaluate expression="new java.util.ArrayList()" result="flowScope.myList" result-type="java.io.Serializable"/>
    </on-start>
    <view-state id="view-state-1" view="registration/view-state-1" model="class1">
        <on-entry>
            <evaluate expression="new com.test.webflow.domain.Class1()" result="flowScope.class1"/>
        </on-entry>
        <transition on="repeat" to="view-state-1"/>
        <transition on="success" to="view-state-2"/>
        <transition on="cancel" to="end-state"/>
        <on-exit>
            <evaluate expression="class1.persist()" result="flowScope.class1"/>
            <evaluate expression="myList.add(class1)"/>
        </on-exit>
    </view-state>    
    <view-state id="view-state-2" view="registration/view-state-2">
        <transition on="cancel" to="end-state"/>
    </view-state>    
    <end-state id="end-state" view="registration/end-state"/>   
</flow>

(In a real-life version of the flow, there would be another view-state in which entities of Class2 would be registered.) The view-state-1.jspx looks like this:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<div xmlns:spring="http://www.springframework.org/tags" xmlns:form="http://www.springframework.org/tags/form" xmlns:fn="http://java.sun.com/jsp/jstl/functions" xmlns:util="urn:jsptagdir:/WEB-INF/tags/util" xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
    <jsp:directive.page contentType="text/html;charset=UTF-8" />
    <jsp:output omit-xml-declaration="yes" />
    <spring:message var="title" code="webflow_state1_title" htmlEscape="false" />
    <util:panel id="title" title="${title}">
        <h1>${fn:escapeXml(title)}</h1>
        <p>
            <spring:message code="webflow_state1_message" />
        </p>
        <form:form commandName="class1">
            <input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}" />
            <p>Enter name: <form:input path="name"/></p>
            <div class="submit">
                <spring:message var="cancel" code="button_cancel" htmlEscape="false" />
                <spring:message var="proceed" code="button_proceed" htmlEscape="false" />
                <spring:message var="repeat" code="button_repeat" htmlEscape="false" />
                <input type="submit" id="cancel" name="_eventId_cancel" value="${fn:escapeXml(cancel)}" />
                <input type="submit" id="success" name="_eventId_success" value="${fn:escapeXml(proceed)}" />
                <input type="submit" id="repeat" name="_eventId_repeat" value="${fn:escapeXml(repeat)}" />
            </div>
        </form:form>
    </util:panel>
</div>

The view-state-2.jspx looks like this:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<div xmlns:spring="http://www.springframework.org/tags" xmlns:fn="http://java.sun.com/jsp/jstl/functions" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:util="urn:jsptagdir:/WEB-INF/tags/util" xmlns:form="http://www.springframework.org/tags/form" xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
    <jsp:directive.page contentType="text/html;charset=UTF-8" />
    <jsp:output omit-xml-declaration="yes" />
    <spring:message var="title" code="webflow_state2_title" htmlEscape="false" />
    <util:panel id="title" title="${title}">
        <h1>${fn:escapeXml(title)}</h1>
        <p>
            <spring:message code="webflow_state2_message" />
        </p>
        <p>
            <c:forEach var="class1" items="${myList}">
                <li><c:out value="${class1.name}"/></li>
            </c:forEach>
        </p>
    </util:panel>
</div>

From all I’ve read so far, I think my solution should work. However, I still don’t get the expected output; i.e. a print out of every name-field. I get the same number of <li>-elements as I put in, but they all seem to be evaluated to null, as explained in my previous post. Can anyone explain to me why this code doesn’t display the contents of the persisted Class1.name-fields? (Btw: they do show up in the CRUD.)

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T00:41:06+00:00Added an answer on May 23, 2026 at 12:41 am

    D-O-(freakin’)-H! The signature of Class1.persist() is public void Class1.persist(). Ahem. So

    <evaluate expression="class1.persist()" result="flowScope.class1"/>
    

    will, apparently, quite effectively set the flowScope.class1 variable to null. By dropping the result-attribute will solve your (and my!) problem. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I need to clean up various Word 'smart' characters in user input, including but
Does anyone know how can I replace this 2 symbol below from the string
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
I am writing an app with both english and french support. The app requests

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.