Announcement Announcement Module
Collapse
No announcement yet.
Redirect and Parameters Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

  • #2
    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?

    Comment


    • #3
      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

      Comment


      • #4
        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

        Comment


        • #5
          Thanks Erwin, that is what I did.

          Curtney

          Comment

          Working...
          X