[Webwork-devel] velocity predefined context
Brought to you by:
baldree,
rickardoberg
From: Marc L. <dev...@lo...> - 2002-07-08 22:33:02
|
Hi, as WW uses the VelocityServlet as base class for its own WebWorkVelocityServlet for rendering the html, i wonder if its too good to have the pre-defined ServletRequest ($req) and ServletResponse ($res) in the velocityContext, because this will interfere with the WW marker interfaces RequestAware and ResponseAware. Even i like the predefined objects in context in velocity standalone mode, i want to question them in WW-context. In detail, even if you dont implement one of those markers, you can easily get the full request object in the view via $req, so the designer can do things like $req.getParameter("myparm") or whatever without knowledge of the backend-programmer (cause he never implemented RequestAware). This violates the "give the designer a predefined API" rule, cause the API is no longer clearly defined. So basically i am speaking of: protected Context createContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) { Context ctx = new WebWorkVelocityContext(ValueStack.getStack(request)); ctx.put(REQUEST, request); ctx.put(RESPONSE, response); return ctx; } its about these 2 puts.... --- Marc Logemann (see him @ www.logemann.info) |