Announcement Announcement Module
Collapse
No announcement yet.
Spring Webflow - How to get the request parameters from query string in my form Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Webflow - How to get the request parameters from query string in my form

    Hi experts,
    I have searched through the community and didn't find a solution that worked for me so posting it here.

    I am using SPRING MVC webflow 1.0.5 using FlowController. When I submit a request using input page with same parameters

    myid and zip code I get the response properly. but when I send the request using url like shown below it does not find the parameter values



    localhost : 8080/myapp/myapp.htm?_flowId=main-flow&page=mystatus&myid=148745849&zip=94404


    I tried using following method call but the value is null


    (String) context.getExternalContext().getApplicationMap().g et("myid");


    Let me know if I am doing something wrong here. Why spring MVC doesn't recognize query string parameters but works for normal form based submissions.

    I would want to open my page to all kind of requests, and thats why I want to allow query String parameters.

    One alternative I am thinking to consider is to create simple JSP page with all required form fields and populate those fields from request.getParameter() call and the submit the page automatically to my page.

    Not sure if this would be the right approach?

    Let me know your comments/ suggesttion

  • #2
    I don't think getApplicationMap() is what you want. Try getRequestMap() instead, if it's available in version 1.0.x. If your URL is starting a new flow, then request parameters are exposed in the input map for the flow.

    Comment


    • #3
      getRequestMap() Not available

      I dont see context.getRequestMap() method here .... looks like we are way behind on framework version.

      I also tried context.getRequestParameters().get("myid") , that doesn't work either... when debug and browse the context object I don't see any entry for "myid" in it.

      Do you think upgrading to webflow 2.0 would help? I can try that too...

      Comment


      • #4
        Got the solution

        I figured out the issue and here is the solution for others benifit

        Add a action state instead of view state in the flow xml like below

        Code:
        <action-state id="MyAction">
        		<action bean="myForm" method="bindAndValidate"/>
        		<transition to="mypage" />
        	</action-state>
        I still don't understand the reason why it doesn't get the request parameters from query string when I am using view state though. Let me know if you have some clue.

        Comment


        • #5
          Please find the solutions here

          use this
          reqContext.getExternalContext().getRequestParamete rMap().get("url")

          Comment

          Working...
          X