Announcement Announcement Module
No announcement yet.
JSP Renderers Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • JSP Renderers

    Does Spring Surf support the JSP Renderers documented for Alfresco Surf here:

    I have done some investigating and I do not see any Spring Surf documentation or examples on JSP Renderers. In fact, I was a bit alarmed to see that the ervice.renderJspPage() method is commented out in the source code (on the trunk).


    Last edited by BoJo; Aug 26th, 2010, 09:09 PM.

  • #2
    spring-travel sample app uses a JSP Renderer

    I see a JSP Renderer configured for the spring-surf-application-spring-travel sample project provided with the source ( The login-dialog.xml component-type declaration (under spring-surf-applications/spring-surf-application-spring-travel/src/main/webapp/WEB-INF/classes/surf/site/component-types) contains the following:

    <!-- Define the rendering processors for this component type -->
    <processor mode="view">

    The login page (spring-surf-applications/spring-surf-application-spring-travel/src/main/webapp/WEB-INF/pages/login.xml) then defines the following component:


    Makes sense. I see the login-dialog.jsp page as weil.

    I'm now looking into:

    1) How do I wire-in a Java controller?

    Using the "root objects" the Surf MVC framework wires in. The equivalent to "context", "page", "url" in the Web Scripts redering framework.

    2) Accessing the model created in the Java controller in the JSP


    • #3

      Yes you can still use JSP pages in Surf, as you have noted there is an example in one of the sample apps, also Alfresco Share uses a single JSP based site-index page. The JSPProcessor class still exists - that commented out code you can see has been refactored out and I will remove the detritus for the RC1 release.

      You can retrieve the Surf RequestContext object thus:

      RequestContext context = (RequestContext)request.getAttribute(RequestContext.ATTR_REQUEST_CONTEXT);
      The support for other model objects needs to be improved for JSP (and other languages such as Groovy), but you can retrieve a lot from the RequestContext.




      • #4

        Indeed. Reference THIS post to see how I got JSPs working.

        Thanks Kev!


        • #5
          I am curious what "support for other model objects needs to be improved" means in the above response. It is true that you can retrieve a lot of information from the RequestContext. However, I need to pass specific ("custom") information to the JSP.

          You state that I can access the RequestContext in the JSP:

          RequestContext context = (RequestContext)request.getAttribute(RequestContext.ATTR_REQUEST_CONTEXT);
          The JavaDoc for RequestContext lists a getValuesMap() method:
          Returns the underlying map of the custom key/values pairs stored on this RequestContext instance.

          I was hoping this would access the Map returned from the executeImp() method in a DeclarativeWebScript implementation. Is this not the case?

          If not, what is the best practice for passing data between a Java DeclarativeWebScript an a JSP Renderer?



          P.S. I can't test JSP model access at the moment because I don't have a working example of combining a JSP Renderer with a Java DeclarativeWebScript (see THIS post))