Child pages
  • Application, Session, Request objects in vm
Skip to end of metadata
Go to start of metadata

To get parameters from the QueryString or from a POSTed form, do not use getAttribute, use:

But that's quite obvious, since $req is the request object and we all know how it works.

Example:

_test.jsp_:

_test.vm_:

  • No labels

4 Comments

  1. Anonymous

    How do I set a request scoped object in an Interceptor and access it from a Velocity template?

    I've tried every combination and find it too difficult to switch from Struts and Servlets to Webwork. The documentation could include a section which describes the application, session and request scopes in more detail. Three lines of documentation is not enough.

  2. Anonymous

    This does not work. Should it?

    ActionContext.getContext().put("keyx", "valuex");

    $stack.findValue("keyx")

  3. Anonymous

    Found the problem. I have to put # in front of the key.

    $stack.findValue("#keyx")

  4. From the JavaDocs of the class com.opensymphony.webwork.views.velocity.VelocityManager

    This method is responsible for creating the standard VelocityContext used by all WW2 velocity views. The following context parameters are defined:

    • req - the current HttpServletRequest
    • res - the current HttpServletResponse
    • stack - the current OgnlValueStack
    • ognl - an OgnlTool
    • webwork - an instance of WebWorkUtil
    • action - the current WebWork action