November 6, 2009
In the Apache Struts2 Documentation Performance Tuning page one of the recommended tips for improving the performance of the framework is to avoid Struts serving the static content.
Struts tags and themes include a set of static resources – javascript libraries, CSS, Freemarker templates – which are included inside the Struts jar file. The framework, via a filter (org.apache.struts2.dispatcher.FilterDispatcher which then delegates to a “staticLoader” class), retrieves those resources from the jar files (unjar them on the fly) and serves them on request.
Although this works quite neatly – nice to have all classes and resources contained together – it adds an unnecessary overhead upon serving the http request.
Read the rest of this entry »
Leave a Comment » |
Java, Open Source |
Permalink
Posted by Beppe Catanese
September 6, 2009
Simple steps to create a JSP taglib which (internally) uses the FreeMarker engine for generating the output .
The JSP taglib is responsible for defining the name, attributes and behavior of the tag whilst the generation of the output (i.e. html code, predefined text template) is delegated to the FreeMarker engine.
This technique brings various advantages such as the separation of responsibilities (“presentation-designer” vs “business-programmer”), better maintenance and extendibility.
The approach is similar to the Struts2 JSP tags: this is just a simpler implementation to see what happens behind the scene.
Read the rest of this entry »
Leave a Comment » |
Java |
Permalink
Posted by Beppe Catanese
March 13, 2009
Here is a possible way to customise the JSP taglib provided by the Struts2 framework.
The topics covered in this post are:
- add a custom attribute to a given tag (e.g. TextField)
- customise the Freemarker template to modify the generated HTML code
- define new themes and templates
- generate the new TLD for the customised version of the taglib
- deploy it in a web application (WAR file)
The sample I have created implements a read-only version of the Struts2 JSP taglib: if a given attribute (i.e. viewMode) is set to true then a simple label (plain text) is rendered, instead of the html code for the input type, making the information on the form not editable.
This, in principle, achieves the same purpose as the disabled attribute but it looks much nicer on the web form.
Read the rest of this entry »
4 Comments |
Java, Open Source, Web 2.0 |
Permalink
Posted by Beppe Catanese
February 18, 2009
An archetype in Maven is a template (predefined package structure, resources, configuration files, source files, etc…) which can be used to start the development of a new application.
Amongst various benefits I like the possibility to provide the developers with a set of resources and classes (implementations!) which are going to be needed in the new project. This speeds up the project-setup time and facilitates the adoption of best practises employed within the team.
BTW Maven has few out-of-the-box archetypes (quickstart application, web application, mojo plugin), plus you can find a variety of archetype for lots of frameworks/technology (Struts2, Spring, GWT, etc…).
Here is a list of available archetypes (docs.codehaus.org).
Create a new archetype
The following sections go through the steps of creating a Maven archetype for a web application based on Struts2, Spring and Hibernate (and set of other utilities).
Read the rest of this entry »
Leave a Comment » |
Java, Maven |
Permalink
Posted by Beppe Catanese
October 15, 2008
XWiki is a popular Java-based wiki software offering a good variety of features and plugins. It is pretty advanced, therefore ideal for any enterprise requiring a content management tool which is flexible, professional and free
Installation and configuration come in different flavors, starting with the standalone distribution (Jetty container on HSQLDB db), by far the easiest option. Alternatively the XWiki WAR file can be deployed on any servlet container and any database of your choice (Oracle 10.1.2 RDBMS and OC4J 10.1.3 in my case).
Read the rest of this entry »
8 Comments |
Java, Open Source, SSO |
Permalink
Posted by Beppe Catanese