Announcement Announcement Module
Collapse
No announcement yet.
GET parameters and Velocity context Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • GET parameters and Velocity context

    I am using a RedirectView from one page, supplying a name/value pair as the model as follows:

    Code:
    View redirect = new RedirectView(getSuccessView());
    return new ModelAndView(redirect, "name", "value");
    My Velocity template includes the following line:

    Code:
    The value is $name<br>
    The name/value pair is being added to the URL (http://localhost:8080/webapp/targetPage.htm?name=value) but is not being added to the Velocity context, so my template displays as "The value is $name", not "The value is value".

    I'm assuming that this is by design, I'm just not sure how I can get the name/value pair into the Velocity context so that it is available to the target template. Any help would be appreciated!

    Brian

  • #2
    Velocity itself has no privileged knowledge of the servlet API. The controller that is mapped to 'targetPage.htm' in your example will need to expose the request parameters to the view as model attributes.

    Regards,

    Comment


    • #3
      Thanks for the quick response, Darren! That's pretty much what I figured - I was hoping I was missing something simple, though. 'Preciate the help.

      Brian

      Comment

      Working...
      X