Results 1 to 4 of 4

Thread: _currentStateId in PR3 (using Velocity)

  1. #1
    Join Date
    May 2005
    Location
    Fallbrook, CA
    Posts
    22

    Default _currentStateId in PR3 (using Velocity)

    I just upgraded to PR3 and found what seems to be an incompatibility with PR2 that wasn't mentioned in any of the posts found here so far.

    In PR2 I had a line in my views that set a hidden input tag with the name of "_currentStateId" to the value of ${flowExecution.currentStateId}. In PR3 the org.apache.velocity.app.VelocityEngine was throwing a warning that ${flowExecution.currentStateId} was not a valid reference. Looking at the source HTML for the generated page, I noticed that the page had indeed been generated without a proper value for _currentStateId.

    I loaded up the source code for the FlowExecution class and noticed that there was no method in FlowExecution (or its parent FlowContext) that would allow such a reference as flowExecution.currentStateId to exist (such as getCurrentStateId()). However, I noticed a method called getCurrentState() that returns a State object. The State class has a method called getId().

    So I am now using ${flowExecution.currentState.id} (notice the inserted "." and the lower case "i" that follows it) with success.

    Did I find something that you missed or do I not have the whole picture?

  2. #2
    Join Date
    Sep 2004
    Location
    Leuven, Belgium
    Posts
    1,853

    Default

    You're right, that's a change from PR2. However, note that the "currentStateId" was and still is directly available in the request parameters since it is put there by the FlowExecutionManager.prepareViewDescriptor() method. So a "change proof" way of doing what you need would be: ${currentStateId}

    Erwin

  3. #3
    Join Date
    May 2005
    Location
    Fallbrook, CA
    Posts
    22

    Default

    Thanks. I wasn't aware that currentStateId is placed in the request parameters. I've taken your suggestion to make my views more change proof and it works great.

    I was using ${flowExecution.currentStateId} based in step 7 of the quick start. There's one other thing that should be changed in step 7 of the quick start. It uses ${flowExecution.id} which doesn't seem to exist (at least not in a Velocity template).

  4. #4
    Join Date
    Sep 2004
    Location
    Leuven, Belgium
    Posts
    1,853

    Default

    I've updated the quick start guide.

    Erwin

Similar Threads

  1. Velocity and Classpath Mega-woes
    By jopaki in forum Web
    Replies: 2
    Last Post: May 9th, 2007, 03:21 AM
  2. How to configure Velocity tools?
    By alr in forum Web
    Replies: 7
    Last Post: Jan 31st, 2007, 09:38 AM
  3. FreeMarker vs Velocity
    By Martin Kersten in forum Architecture
    Replies: 8
    Last Post: May 30th, 2005, 09:21 AM
  4. Velocity OutOfMemoryError during UnitTests
    By camach in forum Container
    Replies: 2
    Last Post: May 26th, 2005, 05:28 PM
  5. Exposing velocity context
    By masum in forum Web
    Replies: 1
    Last Post: Oct 28th, 2004, 02:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •