Calling a Session Facade from a JSP

Discussions

General J2EE: Calling a Session Facade from a JSP

  1. Calling a Session Facade from a JSP (4 messages)

    Is it OK to call a Session Facade (or a Business Delegate) directly from a JSP (without going through a controller)? Let's say I have a JSP which needs to get some user data to display in a page. Using Struts, I can have an action make the call to my facade and put the resulting value bean into the request and then forward to my JSP. On the other hand, I can just access the JSP directly and have it get the data it needs by calling the facade directly. The latters seems much easier, especially when I don't know who will be linking to my page. Is this approach OK?

    In the JSP I have:

    <logic:iterate id="status"
    collection="<%=sessionFacade.getUserReportList(user)%>">

       ... some html ...

    </logic:iterate>

  2. It will definitely work but is not a good design practice and not a recommended way to do it.
  3. Why? This is called Dispatcher View in the Core J2EE Design patterns book. I'm just trying to figure out when it's better to use Dispatcher View and when to use Service to Worker.

  4. yes I think this is absolutely ok as ATG dynamo has implemented the same thing with their predefined tags.
  5. lol. I dont know if I would look to ATG dynamo as a reference for good programming standards.