This is the fourth in our four part training sessions introducing FenixEdu development for new collaborators.
In this last session, we introduce our two presentation frameworks present in fenix, Struts and Faces, the presentation plugin Tiles and our rendering library Renders
4. Struts
Control Layer
● open-source web application framework
● uses and extends the Java Servlet API
● model–view–controller (MVC) architecture
● version 1.2.7
● http://struts.apache.org/release/1.2.x/
14. Struts
Presentation Layer
● Tiles
○ templating system
○ create a common look and feel for a web application
○ create reusable view components
○ bridge to JSPs
○ module aware
● tiles-<module>-definitions.xml
○ template definitions
● tiles-<module>-pages-definitions.xml
○ fill in the template
22. JSPs
without renderers
● publico/executionCourse/marks.jsp
<logic:iterate id="evaluation" name="executionCourse" property="orderedAssociatedEvaluations">
● ExecutionCourseDA.java
public ActionForward marks(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
final String executionCourseOID = request.getParameter("executionCourseID"
);
final ExecutionCourse executionCourse = FenixFramework.
getDomainObject(executionCourseOID);
Map<Attends, Map<Evaluation, Mark>> attendsMap = getAttendsMap(executionCourse);
request
.setAttribute("executionCourse", executionCourse);
request
.setAttribute("attendsMap", attendsMap);
request
.setAttribute("dont-cache-pages-in-search-engines" Boolean.TRUE);
,
return mapping.findForward("execution-course-marks"
);
}
●
●
name - get from request attribute or parameter with that name
property - get property from object
○
●
●
executionCourse .getOrderedAssociatedEvaluations ()
uses Java Bean conventions
id - defines bean in jsp scope
23. JSPs
without renderers
● simple bean example
<h3><bean:write name=
"executionCourse" property="name"></h3>
●
executionCourse.getName()
● Tag libs
○
○
○
○
<bean:*>
<logic:*>
<html:*>
http://struts.apache.org/release/1.2.x/userGuide/
24. JSPs
Renderers
● integration with domain model and fenixframework
● our taglib <fr:*>
○ fr:view - display domain objects
○ fr:create - create domain objects
○ fr:edit - edit domain objects
● renderers-config.xml
○ All renderers definitions
25. JSPs
Renderers
● What is a renderer ?
○ java class used to produce HTML
○ Properties
■ layout
●
logical name for renderer definition
■ mode
●
●
input
output
■ class
●
rendered type
○ String
○ ExecutionCourse
○ int
■ properties
●
render specific properties