Results 1 to 3 of 3

Thread: Common Action classes behaviour

  1. #1
    Join Date
    Apr 2005
    Location
    Spain
    Posts
    5

    Default Common Action classes behaviour

    Hi,

    Most of the Action classes we are developing get or set an object from/to one of the two scopes, request or flow. Also, we like to be able to configure the name of the attribute and which scope to use, much like the FormAction.

    First we were going to move this common code to a parent Action class which inherited from AbstractAction, but as we also have MultiActions, we created a separated helper class. Then, we define our actions like this:

    Code:
      
    <bean id="MyAction" 
            class="com.disid.MyAction">
        <property name="attributeName">
          <value>MyObject</value>
        </property>
        <property name="objectScopeAsString">
          <value>flow</value>
        </property>
    </bean>
    And then, from my action class, I can get or set the object from the scope like this:

    Code:
    Object object = getScopeHelper&#40;&#41;.getScopeObject&#40;context&#41;;
    getScopeHelper&#40;&#41;.storeScopeObject&#40;element, context&#41;;
    Maybe this functionality could be moved to the AbstractAction class, as I think it is going to be very common in general. What do you think?


    Cèsar

  2. #2
    Join Date
    Aug 2004
    Location
    Melbourne, FL
    Posts
    2,794

    Default

    Cesar,

    Create a JIRA issue and attach the code and we'll take a look at it and see how we can integrate it.

    Thanks,
    Keith
    Keith Donald
    Core Spring Development Team

  3. #3
    Join Date
    Apr 2005
    Location
    Spain
    Posts
    5

    Default Jira issue SPR-901 created

    Hi Keith,

    I have created the Jira issue SPR-901 with the related code. I hope you find it useful.

    Thanks!

    Cèsar

Similar Threads

  1. Replies: 3
    Last Post: Jun 8th, 2010, 03:27 AM
  2. Replies: 1
    Last Post: Oct 6th, 2006, 10:18 AM
  3. Exit action from view state
    By pglezen in forum Web Flow
    Replies: 5
    Last Post: Oct 7th, 2005, 02:23 PM
  4. Replies: 4
    Last Post: Aug 1st, 2005, 03:45 PM
  5. Question about Action
    By snpe in forum Swing
    Replies: 3
    Last Post: Nov 8th, 2004, 08:58 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
  •