Summary:
How to install SweetDEV RIA in your project
On this page:
- Introduction
- How to download
- Create the RIA configuration file
- Installation of graphical static resources served by a tier static server (IHS)
- Setting up the web deployment file
- Declare the AJAX Controller Servlet
- Declare SweetDEV RIA Session Listener
- Static Resources Cache Control
- SweetDEV RIA Resources Provider Servlet
- JSO Minimised Javascript File Generator
- Samples of Web.xml
- Code to add in your JSP
- What's new ?
- Links
Linked pages:
Introduction
SweetDEV RIA is a complete set of world-class Ajax tags in Java/J2EE. It helps you to design Rich GUI in a thin client. SweetDEV RIA provides you Out-Of-The-Box Ajax components. Continue to develop your application with frameworks like Struts. SweetDEV RIA tags can be easily plugged into your JSP pages. The SweetDEV RIA solution allows enterprises to move forward to the Ajax world, without having to choose "blackbox" solution or to trash all of their existing frameworks.
SweetDEV RIA is compatible with Java 1.4.
How to download
You can download all the needed files from the Nexus repository, but the better way is to add the following dependency to your Maven Project:
The downloaded JAR file contains all the Java class files, Javascript files and static resources needed. Maven retrieves all the Java dependencies :
Tree dependency (Version 3.3.12)
- commons-beanutils:commons-beanutils:jar:1.7.0
- commons-collections:commons-collections:jar:3.2
- commons-digester:commons-digester:jar:1.6
- commons-fileupload:commons-fileupload:jar:1.0
- commons-io:commons-io:jar:1.2
- commons-lang:commons-lang:jar:2.1
- commons-logging:commons-logging:jar:1.0.4
- dom4j:dom4j:jar:1.6.1
- xml-apis:xml-apis:jar:1.0.b2
- hsqldb:hsqldb:jar:1.8.0
- js-optimizer:js-optimizer-core:jar:2.2.1
- log4j:log4j:jar:1.2.9
- commons-io:commons-io:jar:1.2
- yui:yuicompressor:jar:2.3.5
- jdom:jdom:jar:1.0
- json:json-lib:jar:2.1-jdk13
- log4j:log4j:jar:1.2.9
- net.sf.ezmorph:ezmorph:jar:1.0.1
- oro:oro:jar:2.0.8
- org.apache.poi:poi:jar:3.1-FINAL
- rome:rome:jar:0.9
- jdom:jdom:jar:1.0
- velocity:velocity:jar:1.5
- commons-lang:commons-lang:jar:2.1
- oro:oro:jar:2.0.8
- velocity-tools:velocity-tools-generic:jar:1.2
- xom:xom:jar:1.1
- xerces:xmlParserAPIs:jar:2.6.2
- xerces:xercesImpl:jar:2.6.2
- xalan:xalan:jar:2.7.0
- jaxen:jaxen:jar:1.1-beta-8
- dom4j:dom4j:jar:1.6.1
- jdom:jdom:jar:1.0
- xerces:xmlParserAPIs:jar:2.6.2
- xerces:xercesImpl:jar:2.6.2
Create the RIA configuration file
Create a file "ria-config.xml" at the root of your java sources (src/main/resources in a Maven project) with the following code:
Installation of graphical static resources served by a tier static server (IHS)
The possibility to extract static resources from the JAR file for a better performance is explained in the chapter Outsource the static resources.
Setting up the web deployment file
Declare the AJAX Controller Servlet
Declare the RiaController servlet. Its job is to manage AJAX commands between browser and server.Add following lines into the web.xml file of your application :
<servlet>
<servlet-name>SweetDevRiaServlet</servlet-name>
<servlet-class>com.ideo.sweetdevria.servlet.SweetDevRiaServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SweetDevRiaServlet</servlet-name>
<url-pattern>/RiaController</url-pattern>
</servlet-mapping>
Declare SweetDEV RIA Session Listener
This Listener has two jobs :
- Load SweetDEV RIA configuration at startup.
- Manage SweetDevRia models life in sessions.
Add the following lines to the web.xml file of your application :
<listener>
<listener-class>com.ideo.sweetdevria.webapp.RiaLoaderListener</listener-class>
</listener>
Static Resources Cache Control
Highly recommended if your static resources are local.If your project use local resources and you want to avoid that the browser use obsolete version of static file (image, javscript, css, etc) when they change, this filter could be added to your application.
To add a Browser Cache management add the following lines to your web.xml file :
<filter>
<filter-name>BrowserCacheFilter</filter-name>
<filter-class>com.ideo.jso.filter.BrowserCacheFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>BrowserCacheFilter</filter-name>
<url-pattern>*.js</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>BrowserCacheFilter</filter-name>
<url-pattern>*.css</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>BrowserCacheFilter</filter-name>
<url-pattern>*.jpg</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>BrowserCacheFilter</filter-name>
<url-pattern>*.gif</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>BrowserCacheFilter</filter-name>
<url-pattern>*.png</url-pattern>
</filter-mapping>
SweetDEV RIA Resources Provider Servlet
Only necessary if some of your static resources are in jar dependencies (not recommended).
To add a Resources Provider functionality add the following lines to your web.xml file :
<servlet>
<servlet-name>SweetDevRiaResourcesProvider</servlet-name>
<servlet-class>com.ideo.sweetdevria.servlet.SweetDevRiaResourcesProvider</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SweetDevRiaResourcesProvider</servlet-name>
<url-pattern>/resources/*</url-pattern>
</servlet-mapping>
JSO Minimised Javascript File Generator
This servlet job is to generate on the fly a minimized SweetDEV RIA javascript file needed by a page. This servlet isn't necessary if :
- your static resources are served by a tier static server.
- or you have added the minimized files into WebContent/resources/jso folder of your application.
To add a On The Fly Javascript Minimisation functionality add the following lines to your web.xml file :
<servlet>
<servlet-name>jso</servlet-name>
<servlet-class>com.ideo.jso.servlet.JsoServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>jso</servlet-name>
<url-pattern>/jso/*</url-pattern>
</servlet-mapping>
Samples of Web.xml
Sample of Web.xml for application serving their static resources :
<filter>
<filter-name>BrowserCacheFilter</filter-name>
<filter-class>com.ideo.jso.filter.BrowserCacheFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>BrowserCacheFilter</filter-name>
<url-pattern>*.js</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>BrowserCacheFilter</filter-name>
<url-pattern>*.css</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>BrowserCacheFilter</filter-name>
<url-pattern>*.jpg</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>BrowserCacheFilter</filter-name>
<url-pattern>*.gif</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>BrowserCacheFilter</filter-name>
<url-pattern>*.png</url-pattern>
</filter-mapping>
...
<listener>
<listener-class>com.ideo.sweetdevria.webapp.RiaLoaderListener</listener-class>
</listener>
...
<servlet>
<servlet-name>SweetDevRiaServlet</servlet-name>
<servlet-class>com.ideo.sweetdevria.servlet.SweetDevRiaServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SweetDevRiaServlet</servlet-name>
<url-pattern>/RiaController</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>SweetDevRiaResourcesProvider</servlet-name>
<servlet-class>com.ideo.sweetdevria.servlet.SweetDevRiaResourcesProvider</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SweetDevRiaResourcesProvider</servlet-name>
<url-pattern>/resources/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>jso</servlet-name>
<servlet-class>com.ideo.jso.servlet.JsoServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>jso</servlet-name>
<url-pattern>/jso/*</url-pattern>
</servlet-mapping>
Sample of Web.xml for application with static resources served by a tier server (IHS) :
...
<listener>
<listener-class>com.ideo.sweetdevria.webapp.RiaLoaderListener</listener-class>
</listener>
...
<servlet>
<servlet-name>SweetDevRiaServlet</servlet-name>
<servlet-class>com.ideo.sweetdevria.servlet.SweetDevRiaServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SweetDevRiaServlet</servlet-name>
<url-pattern>/RiaController</url-pattern>
</servlet-mapping>
Code to add in your JSP
Declare the RIA taglib at the top of your jsp:
<%@ taglib prefix="ria" uri="http://sweetdev-ria.ideotechnologies.com" %>
Import the RIA resources (js, css, ...) in the header of your jsp using the ria:resourcesImport tag:
<ria:resourcesImport />
Here is the code of a simple page using the component newwindow to test your application:
<%@ taglib prefix="ria" uri="http://sweetdev-ria.ideotechnologies.com" %>
<%@ page contentType="text/html;charset=iso-8859-1" language="java" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Window test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="Pragma" content="no-cache" />
<ria:resourcesImport skinName="BleuF"/>
</head>
<body>
<ria:newwindow id="myWindowId" title="My Window" openAtStartup="false" loadAtStartup="false">
My text in the window !
</ria:newwindow>
<input type="button" onclick="SweetDevRia.$('myWindowId').open()" value="Open window"/>
</body>
</html>
What's new ?
Bug fixes
| Component | Corrected Issue Description | Fix Version |
| Reader | Reader Title aren't i18n compliant. | v3.3.12 |
| Accordion | Accordion title isn't i18n compliant. | v3.3.12 |
| Window | Modal newwindow component : With tab key, element behind modal panel could be selected. | v3.3.12 |
| Window | message attribute of the tag isn't i18n compliant. | v3.3.12 |
| Grid | Multi header title isn't i18n compliant. | v3.3.12 |
| Grid | Edition of list : current value isn't applied to the select box | v3.3.12 |
| Grid | Edition of date : issue with date format | v3.3.12 |
| AjaxForm | AjaxForm concatenates values of form attribute with same name, instead of sending them separately | v3.3.12 |
New Features
| Component | Description | Version |
| Network | New config property to set the public URL of server for RIA components | v3.3.12 |
| js-optimizer | version 2.2.1 of js-optimizer is integrated within SweetDEV RIA | v3.3.12 |
| Zone | "Referer" request attribut is no more used by Zone component | v3.3.12 |
Known issues :
| Component | Issue version | Fix Version | Issue Description | Temporary Fix |
| Reader | v3.4.0.1 | v3.4.0.2 | Reader Title aren't i18n compliant. | none |
Links
- Ideotechnologies web site (javadoc, jsdoc, tlddoc, ...): http://sweetdev-ria.sourceforge.net