Results 1 to 5 of 5

Thread: Redirect and Parameters

  1. #1
    Join Date
    Dec 2004
    Location
    CA
    Posts
    208

    Default Redirect and Parameters

    Greetings!

    I have a flow where I need to modify a parameter then do a redirect with the new value of the parameter. I am using this parameter as a flag in my JSP page. Is such a thing possible with web flow?

    I know I can easily set an attribute in the flowscope, but I am thinking for such a thing it would be best to use parameters.


    A Java-base flow example would be appreciated. :wink:

    Thanks,

    Curtney
    Curtney Jacobs

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

    Default

    You mean modify an event parameter? Event's are immutable, you can't modify them. You could set somthing in request scope. What are you trying to do exactly?
    Keith Donald
    Core Spring Development Team

  3. #3
    Join Date
    Dec 2004
    Location
    CA
    Posts
    208

    Default

    I have categories that are dynamically displayed in a table. Users have an option of adding a category dynamically within the table cell (inline) or through a category template (separate input form). Adding a category inline requires that my users Click an " Add Row" button (action=add) that subsequently creates a default category within the database. On the return trip back from the server, so to speak, I need to set a flag (action=edit) that informs my jsp page to display an input field for that row in my table so my users can change the default values.

    Essentially, I need to change my action parameter value from "addRow" to "edit".

    The "action" parameter is the flag that needs to be set by my web flow.


    Usually, in a jsp page the markup would look something like the following:

    Code:
    //get the parameter from the request.
    String action = request.getParameter("action");
    .
    .
    
    if (action.equals (edit)) {
    .
    .
    .//cannot change the parameter directly, so do a redirect with what you need
    <c&#58;redirect url="xxxxxxx">
                <c&#58;param name="id" value="$&#123;id&#125;"/>
                <c&#58;param name="action" value="edit"/>
     </c&#58;redirect>
    &#125;
    .
    .
    .
    //display the input field
    <c&#58;choose>
            <c&#58;when test="$&#123;param.action == 'edit' and param.id == category.id&#125;">
                <input type="text" name="name" style="padding&#58; 0"
                    value="<c&#58;out value="$&#123;category.name&#125;"/>" />
            </c&#58;when>
            <c&#58;otherwise><c&#58;out value="$&#123;category.name&#125;"/></c&#58;otherwise>
    </c&#58;choose>

    Curtney
    Curtney Jacobs

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

    Default

    Why not just have an action put the "action parameter" in the request scope? That way it will be put in the model that is exposed to the JSP and you can use it there to do the conditional logic. Note that request scope is only for 1 request, so the value won't "hang around" in the flow.

    Erwin

  5. #5
    Join Date
    Dec 2004
    Location
    CA
    Posts
    208

    Default

    Thanks Erwin, that is what I did.

    Curtney
    Curtney Jacobs

Similar Threads

  1. success messages - redirect after post
    By Keith Donald in forum Web
    Replies: 12
    Last Post: Jan 31st, 2010, 06:02 AM
  2. Replies: 3
    Last Post: Oct 30th, 2006, 11:35 PM
  3. SimpleFormController doesn't redirect
    By AndyAtHome in forum Web
    Replies: 2
    Last Post: Jun 21st, 2005, 10:30 AM
  4. GET parameters and Velocity context
    By brianstclair in forum Web
    Replies: 2
    Last Post: Sep 25th, 2004, 10:15 PM
  5. Replies: 0
    Last Post: Sep 24th, 2004, 08:03 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
  •