History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEADEV-25454
Type: New Feature New Feature
Status: Resolved Resolved
Resolution: Fixed
Priority: Normal Normal
Assignee: Peter Gromov
Reporter: Chris Sherratt
Votes: 0
Watchers: 3
Operations

If you were logged in you would be able to see more operations.
IDEA: Development

Freemarker - support default variables from web frameworks

Created: 21 Mar 08 18:26   Updated: 04 Sep 08 21:08
Component/s: Code Analysis. Inspection
Fix Version/s: Diana 8792

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
Environment: WinXp

Build: 8,243
Fixed in build: 8,770
Severity: Low

Sub-Tasks  All   Open   
 Sub-Task Progress: 

 Description  « Hide
When freemarker is used with web frameworks (e.g. WebWork, Struts2) there are several variables that are always available.
Currently these are highlighed as "cannot resolve variable..." but it would be good if when using a Struts2 facet these were recognised.

For example for Struts2 (http://struts.apache.org/2.x/docs/freemarker.html)

Name Description
stack The value stack itself, useful for calls like ${stack.findString('ognl expr')}
action The action most recently executed
response The HttpServletResponse
res Same as response
request The HttpServletRequest
req Same as request
session The HttpSession
application The ServletContext
base The request's context path


 All   Comments   Work Log   Change History      Sort Order:
Yann Cébron - 08 Apr 08 10:58
there should probably be something like FreemarkerDefaultVariableProvider-EP which can be implemented to provide those predefined names

Peter Gromov - 08 Apr 08 17:27
As for Struts2, yes. But in general I believe that some user-editable table in UI will be sufficient.

Taras Tielkes - 20 Jul 08 21:46
For Spring MVC, there's "springMacroRequestContext" with type "org.springframework.web.servlet.support.RequestContext" (applies to both Freemarker as well as Velocity).

Max Ishchenko - 15 Aug 08 14:19
Spring MVC puts some more variables in model in org.springframework.web.servlet.view.freemarker.FreeMarkerView#doRender method.
These are:
JspTaglibs        - freemarker.ext.jsp.TaglibFactory
Application       - freemarker.ext.servlet.ServletContextHashModel
Session           - freemarker.ext.servlet.HttpSessionHashModel
Request           - freemarker.ext.servlet.HttpRequestHashModel
RequestParameters - freemarker.ext.servlet.HttpRequestParametersHashModel