|
StrutsCX Intro
Overview
Installation
Publications
History
FAQ
Samples
Resources
Licencing
Mailinglist
Downloads
|
 |
| StrutsCX - History |
 |
|
[Status 2003.12.04]
Version
0.9.5
- The strutscx-config.xml no longer demands the project's context name to be set:
the <param> and <project> Elements are obsolete;
NOTE:
The StrutsPlugIn does no longer set the projectName parameter to the ServletContext.
The former consumer of this parameter - StrutsCXStandardTransformer, StrutsCXFOPTransformer
and StrutsCXDocumentBuilder - do use the request.getContextPath() for this purpose.
Hint for Upgraders: If you build your application on top of the StrutsCX samples do the following:
BaseAction: set the projectName attribute to the session by getting it with
help of the request.getContextPath().
inc_variables.xsl: remove the <xsl:variable name="this_project"/> and
use <xsl:value-of select="//session/projectName"/> instead
- the following parameters you can now set to the HttpServletRequest as Attribut and
not just as Parameter:
StrutsCXConstants.DEBUGXML_PARAM
StrutsCXConstants.XSL_CLIENTSIDE
StrutsCXConstants.FOP_PARAM
StrutsCXConstants.FOP_PDF_PARAM
StrutsCXConstants.FOP_AWT_PARAM
StrutsCXConstants.FOP_SVG_PARAM
StrutsCXConstants.FOP_PCL_PARAM
StrutsCXConstants.FOP_PS_PARAM
StrutsCXConstants.FOP_PRINT_PARAM
StrutsCXConstants.FOP_RTF_PARAM
StrutsCXConstants.FOP_XML_PARAM
StrutsCXConstants.FOP_MIF_PARAM
StrutsCXConstants.FOP_TXT_PARAM
- the (experimental) StrutsCXConstants.FOP_BASEDIR_PARAM can
now set as Attribute to the ServletContext or to the Request
- strutscx-demo.war:
- Included XDoclet comments in the Actions and the ActionForm
of the strutscx-demo.war
- Refactored out the session creation code from the BaseAction into
a Filter in the strutscx-demo.war; updated the web.xml appropriatly.
Up
Version
0.9.4
- Separation of StrutsCX and the sample applications. StrutsCX is now a 80KB JAR and
a couple of configuration files. See under
install
for details.
- 5 sample applications are available: a super simple one, the one showing the CRUD cycle,
one for FOP-PDF, one for client-side transformation and one showing a transformation pipeline
(multiple transformation in a row).
- StrutsCXDocumentBuilder and StrutsCXTransformer are now implemented using a Factory.
You can create your own, too and announce them in the strutscx-config.xml. It's even possible to
switch them dynamically by setting a parameter to the Request.
- The StrutsCXStandardDocumentBuilder now serializes
every ActionForm, ActionErrors and data object (ArrayList filled with JavaBeans, DOM, JDOM, dom4j)
it can find in the Request
- Its now possible to add null as datasource - this means no XML or ArrayList obejct.
Then the XML-Output-Document will be created with just the data out of the HttpServletRequest,
the HttpSession, the ServletContext and - if proviede - the ActionForm and ActionErrors objects.
- java.util.Date, java.sql.Date, java.sql.Timestamp, java.sql.Time
is serialized with help of java.util.Calendar:
<publishingDate>
<string>Sun May 07 00:00:00 CEST 2006</string>
<era>118</era>
<year>2006</year>
<month>5</month>
<week_of_year/>
<week_of_month>1</week_of_month>
<date>7</date>
<day_of_month>7</day_of_month>
<day_of_year>127</day_of_year>
<day_of_week>1</day_of_week>
<day_of_week_in_month>1
</day_of_week_in_month>
<am_pm>0</am_pm>
<hour>0</hour>
<hour_of_day>0</hour_of_day>
<minute>0</minute>
<second>0</second>
<millisecond>0</millisecond>
<zone_offset>1</zone_offset>
<dst_offset>1</dst_offset>
</publishingDate>
- Clean up of the StrutsCXConstants. See this
parameter overview
for a list of parameters you should know while using StrutsCX.
- strutscx-config.xml: <viewtype> and <persisttype> Elements are no longer mandatory.
<variables> Element is deprecated. Use <resources-properties> instead. There are two new
Elements <transformer> and <documentbuilder> to setup the StrutsCXTransformer and the
StrutsCXDocumentBuilder.
Feel free to use these parameters anyways.
- The use of the applications resources (variables_xx.xml files) can switched of by setting
a parameter in the strutscx-config.xml.
- StrutsCX now supports the commons-logging package.
- The XML-Output-Document format changed slightly in this version. Check out the next step
to keep backward compatibility.
- Upgraders should do the following:
add this elements to your strutscx-config.xml
<!-- ========== StrutsCXDocumentBuilder
============== -->
<documentbuilder>
<!-- the documentbuilder we do use;
replace it with your own version -->
<!--<class id="standard">
....StrutsCXStandardDocumentBuilder</class>-->
<!-- DocumentBuilder to keep
XML-Output-Document backward compatible up
to StrutsCX v0.9.3 -->
<class id="standard">
...StrutsCXClassicDocumentBuilder</class>
</documentbuilder>
<!-- ========== StrutsCXTransformer
============== -->
<transformer>
<!-- the transformer we do use;
replace it with your own version -->
<class id="standard">
...StrutsCXStandardTransformer</class>
<class id="fop">
...StrutsCXFOPTransformer</class>
</transformer>
make sure the StrutsCXClassicDocumentBuilder is uncommented, not the advanced
StrutsCXStandardDocumentBuilder.
- The invocation of validate() method of the ActionForm in the Action class is now optional.
You can also set attributes of the struts-config.xml to let Struts handle the validation automatically.
See details...
Up
Version
0.9.3
-
This release focuses on separation of the core StrutsCX and the prototype
sample application. Therefore the following classes are deprecated and copies
are moved and/or renamed (see below):
- com.cappuccinonet.strutscx.action.StrutsCXBaseAction
- com.cappuccinonet.strutscx.action.StrutsCXBaseActionHelper
- com.cappuccinonet.strutscx.actionform.StrutsCXFormReader
- com.cappuccinonet.strutscx.actionform.StrutsCXFormWriter
- com.cappuccinonet.strutscx.util.Log4jInitServlet
- com.cappuccinonet.strutscx.util.StrutsCXDateString
- com.cappuccinonet.strutscx.util.StrutsCXPropertiesReader (since v0.9.2)
- Due to user request the FOP feature can now pluged in or out
by setting a switch in the strutcx-config.xml. If the switch is OFF,
the StrutsCX won't look for the FOP user-config.xml and won't initialize FOP.
- All FOP transformation logic is now separated to the StrutsCXFOPTransformer which extends
the StrutsCXTransformer. Its just used in case the FOP switch is set to ON.
- StrutsCX gets now initialized by the StrutsCXPlugIn.
This class reads in the StrutsCX properties file (strutscx-config.xml) as
well as FOP's userconfig.xml, in case the FOP switch parameter is set
ON (check the strutscx-config.xml).
- Moved and renamed the StrutsCXBaseAction in the
com.cappuccinonet.prototype.action.BaseAction.
Its use is optional.
To make 'Declarative Exception Handling' possible the BaseAction
no longer throws an IOException and ServletException but just an Exception.
(Thanks to David Stabel for this hint).
- StrutsCXBaseActionHelper got renamed and moved to
com.cappuccinonet.strutscx.util.StrutsCXHelper.
Its getLocale() methods defaults now to locale "en" and country "US";
before it defaulted to locale "en"
and country "EN" which caused trouble in some environments.
In addition implemented some bug fixes, too.
-
Log4j is now initialized by a new StrutsCXLog4JInitPlugIn, a
Struts PlugIn class. This class can take Log4j parameters as Java
Properties or as XML file. It also works in a deployed WAR file environment
as well as in a expanded directory structure.
- The com.cappuccinonet.util.StrutsCXDateString deprecated. A copy is renamed
into StrutsCXStringUtils.
- Reviewed some of the code in StrutsCXDocumentBuilder and
StrutsCXTransformer: Refactored out the common code into a utility class called
StrutsCXXSLTUtil. The other two classes call those refactored methods.
Also added a test for missing stylesheet resource in order to throw a more
descriptive error than NullPointerException in StrutsCXTransformer.createXSLTemplate.
(Thanks to Ed Trembicki-Guy for this contribution).
- The StrutsCXDocumentBuilder is now able to consume dom4j
Document objects for the data as well as for the StrutsCXProperties (variables_xx.xml), too.
Note: The dom4j feature is implemented not very elegant but it should work.
Dom4j documents are converted to org.w3c.dom.Document and these to
org.jdom.Document into jdom. Anyways, you can pass org.jdom.Document, org.dom4.Document,
org.w3c.dom.Documents or ArrayLists with JavaBeans (data only) to it.
- Security: Its possible to disable the debugxml=true HttpServletRequest parameter
which sends the untransformed XML-Output-Document.
- Users are no longer forced to provide the StrutsCXResourcesProperties
'variables_xx.xml'. If not provided an empty Element is added by the
StrutsCXDocumentBuilder to the XML-Output-Document. Anyways, it's
recommended to provide these files.
- StrutsCXConstants contains some new parameters.
- Updated the jars in the WEB-INF/lib folder with the latest releases. Currently
the strutscx.war contains the following jars:
| Struts |
|
struts-1.1.jar |
| JDOM |
|
jdom-b9.jar |
| Castor XML |
|
castor-0.9.5-xml.jar |
| Log4j |
|
log4j-1.2.8.jar |
| Jakarta Commons |
|
commons-jxpath-1.1.jar
commons-digester-1.5.jar
commons-beanutils-1.6.1.jar
commons-collections-2.1.jar
commons-logging-1.0.3.jar
commons-validator-1.0.2.jar
|
| Jakarta ORO |
|
jakarta-oro-2.0.7.jar |
| dom4j |
|
dom4j-full-1.4.jar |
| Avalon |
|
avalon-framework-cvs-20020806.jar |
| Batik |
|
batik.jar |
| FOP |
|
fop-0.20.5.rc3a.jar |
Note: In addition to that make sure you have copies of the following JAR files in the
%TOMCAT_HOME%/common/endorsed folder:
- xercesImpl.jar
- xml-apis.jar
- xalan.jar
Putting JAR files in this folder will instruct the Tomcat class loader to
use these XML APIs in favor of the ones shipped with the JVM.
- Upgraders should do the folling:
Make sure you do have the following parameters copied to your
strutscx-config:
<!-- version -->
<version>v0.9.3
<!-- apache FOP -->
<fop>
<!-- switch use of apache FOP ON|OFF-->
<on>ON</on>
<!-- point to the location of the fop
configuration file: userconfig.xml -->
<config>/WEB-INF/userconfig.xml</config>
</fop>
<!-- debug -->
<debugxml>
<!-- switch accepting debugxml=true in
the HttpRequest ON|OFF
If OFF, the StrutsCXServlet won't send
the untransformed XML document to the
client. For security reasons this flag
should just set to ON in production
environments. -->
<on>ON</on>
</debugxml>
Add the following element to the end of the struts-config.xml:
<!-- StrutsCXLog4jInitPlugIn -->
<plug-in
className="com.cappuccinonet.strutscx.util.
StrutsCXLog4jInitPlugIn">
<set-property property="config"
value="/WEB-INF/strutscx-log4j-config.xml" />
</plug-in>
<!-- StrutsCXPlugIn -->
<plug-in
className="com.cappuccinonet.strutscx.util.
StrutsCXPlugIn">
<set-property
property="config"
value="/WEB-INF/strutscx-config.xml" />
</plug-in>
Copy these new files into the /WEB-INF folder:
- strutscx-log4j-config.xml
- log4j.dtd
In the web.xml you can remove the unnecessary FOP config-parameter of the
StrutsCXServlet.
Take care on the deprecated StrutsCXBaseAction and StrutsCXBaseActionHelper which
are moved under new names in other packages - see above.
- Added a
Ant script for deployment in Tomcat 4.1.24.
- See the Version
0.9.3 API
Up
Version 0.9.2
- Data can be handed over in the following object types to the StrutsCXServlet,
precisely the StrutsCXDocumentBuilder:
- ArrayList filled with JavaBeans
- org.jdom.Document
- org.w3c.dom.Document
The InfoIntroAction of the prototype sample application
demonstrates how this works.
- XSL Stylesheet for FOP-PDF example uses standard fonts.
- StrutsCXTransformer: pulled out all the deprecated methods. StrutsCX v0.9.1 and before
users: The XMLProperties are no longer supported!
- StrutsCXBaseActionHelper: pulled out all the deprecatred methods.
- JavaDoc: The com.cappuccinonet.strutscx.xslt is now considered as
the only 'core' StrutsCX package. The StrutsCXBaseActions and the
ActionForms are considered as part of the StrutsCX prototype sample
application. This means: The use of them was/is optional.
- See the Version
0.9.2 API
Up
Version
0.9.1
- Added the (optional ) concept of strutscx-definitions.
Check out the FAQ for details.
- Implemented multiple transformations for 'pure'
server side XSL Stylesheets (no yet FOP or client side XSL). Therefore
the replacement of the XMLProperties with an JDOM Document object
was necessary. There is more flexibility now to handle the properties.
StrutsCX v0.9 and before users: Changes have been made to the
following classes:
- StrutsCXBaseAction
- StrutsCXBaseActionHelper
- StrutsCXPropertiesReader
- All Actions classes
Because we do handle a Document object and not longer an XMLProperties
object you should to the following in your Actions:
Everywhere you try to read properties out of the strutscx-config.xml
use JXPath. This allows you to read in the properties with a simple
XPath statement. Here an example: Do this
JXPathContext props =
JXPathContext.newContext(properties);
String xslFile = (String)
props.getValue("/properties/section/info/xsl/"
+ viewtype + "/" + activity);
instead of
String xslFile =
properties.getProperty("section.info.xsl."
+ viewtype + "." + activity);
When you pass the lang property to the InfoDelegate use
(String) props.getValue("/properties/lang")
instead of
properties.getProperty("lang")
Thats pretty much straight forward.
- The use of com.oreily.javaxml2.XMLProperties is deprecated
and not supported any longer.
- All the Struts classes are packaged in the strutscx.jar
now an you'll find them in the /WEB-INF/lib/ folder.
So the /WEB-INF/classes folder is empty. Added the JXPath
Jar to the /WEB-INF/lib folder. So this are the new jar entries:
| StrutsCX |
|
strutscx-v0.9.1.jar |
| JXPath |
|
commons-jxpath-1.1b1.jar |
- Changes to the strutscx-config.xml are now
possible during runtime, too.
- In the StrutsCXConstants a parameter for the strutscx-config.xml
has been added.
- Implemented these changes in the StrutsCX prototype.
- See the Version
0.9.1 API
Up
Version
0.9
- Inclusion of the Struts Validator framework:
added a new package com.cappuccinonet.strutscx.validator.
This contains the following modified classes from the org.apache.struts.validator
package:
- ValidatorForm,
- ValidatorActionForm,
- DynaValidatorForm,
- DynaValidatorActionForm
- Resources
Just little changes have been made: In the Resources the ActionError
object includes now just a fake string and bypasses the the ApplicationResources.properties.
The other classes are modified just to call the com.cappuccinonet.strutscx.validator.Resources
class and not the one of Struts. No changes to the overall architecture
of StrutsCX have been necessary.
- The following package has been added to the /WEB-INF/lib folder
to enable the Validator:
| Validator |
|
commons-validator.jar |
- strutscx-config.xml/ properties.xml: Renamed
the properties.xml to strutscx-config.xml. Changed element charset
to encoding
- StrutsCXConstants: added ENCODING_KEY="encoding"
- StrutsCXBaseActionHelper: Deprecated method
getCharset(); added analogous method getEncoding().
- StrutsCXTransformer: set charset to encoding
whereever possible
- Interface StrutsCXFormWriter: Added Object
instead of concret ValueObject to all the methods: Decoupling
Interface from implementation. Added an ActionForm parameter to
all the methods to support DynaBeans.
- Included all these changes in the StrutsCX prototype.
- See the Version
0.9 API
Up
Version
0.8.4
- Version 0.8.4 contains a switch to enable client side
XSL transformation. Therefore its possible to use an
optional xsl_clientside=true parameter in your request.
To make this possible the StrutsCXDocumentBuilder
then integrates an XSL-Stylesheet ProcessingInstruction with a
link to the XSL Stylesheet and forwards the pure XML file to the
client.
- No need to supply a standardXSL any more. (Read
on for reasons why.)
- The StrutsCXTransformer got its sendXML() method
introduced in v0.8.3 renamed to makeNoTransformation()! The parameters
this private method contains have been cleaned up, too.
Inside this method the response.setContentType() now sets the
encoding as well. Instead of "text/xml" it uses "text/xml;
charset="+charset. This little change let the browser know
which encoding to use. This way encodings outside the ISO-8859-1
can get displayed correctly. This makes the workaround with the
standardXSL unnecessary!
In consequence of this, inside transform() the parameter
String standardXSL has been removed.
Renamed getFopparam() to getFOPParam() and
setFopparam() setFOPParam(). Both methods have private
access now.
- All method calls to the StrutsCXTransformer.transform() have
been updated. Check out StrutsCXServlet and StrutsCXTransformer
itself.
- In the web.xml the init of the StrutsCXServlet
to load the standardXSL has been removed.
- Added a comprehensive client side XSL transformatin example
to the StrutsCX prototype.
- StrutsCXConstants contains some new parameter
- See the Version
0.8.4 API
Up
Version
0.8.3
- Version 0.8.3 supports PDF generation with
Apache FOP. As
input a XSL Stylesheet with embedded fo Tags can be supplied.

All the other FOP features are not yet supported. It possible
to include your own fonts, too. The StrutsCX prototype shows how
this works. It contains all necessary JARs in its /lib directory.
No support for Korean EUC-KR font yet.
This feature does not affect the overall StrutsCX architecture.
Changes have been made to the following classes: StrutsCXServlet,
StrutsCXTransformer, StrutsCXContants.
- StrutsCX v0.8.2 and before users: If you won't use FOP you should
supply a default FOP userconfig.xml in the /WEB-INF
folder anyways. The StrutsCXServlet is looking for it.
- The following packages have been added to the /WEB-INF/lib folder
to enable FOP:
| Avalon |
|
avalon-framework-cvs-20020806.jar |
| Batik |
|
batik.jar |
| FOP |
|
fop-0.20.5.rc.jar |
- The new isEmpty method() of the Struts ActionErrors
object is used in favor of the deprecated empty() method.
- Added a comprehensive PDF output example to the StrutsCX
prototype.
- See the Version
0.8.3 API
Up
Version
0.8.2
- Version 0.8.2 adds changes to the StrutsCXBaseAction,
the StrutsCXBaseActionHelper and all Action
classes of the prototype package. There, because of Thread safety
reasons, the following fields where moved out of the StrutsCXBaseAction
into the execute() of each Action:
HttpSession session
Locale locale
int entryId
String charset
String viewtype
String persisttype
StrutsCXBaseActionHelper domainparam
A look in the Struts documentation explains this issue nicely:
"Design issues to remember when coding Action classes include
the following:
- The controller servlet creates only one instance of your Action
class, and uses it for all requests. Thus, you need to code your
Action class so that it operates correctly in a multi-threaded
environment, just as you must code a servlet's service() method
safely.
- The most important principle that aids in thread-safe coding
is to use only local variables, not instance variables, in your
Action class. Local variables are created on a stack that is assigned
(by your JVM) to each request thread, so there is no need to worry
about sharing them."
- In the StrutsCXFormReader the return value
of the method getValueObject() changed from InfoPresentationVO
to Object. So there is no coupling of Interface with the implementation
any more.
- In the StrutsCXDocumentBuilder the method getRequestElement()
now outputs the HttpRequest Parameters, too.
- In the XSL Stylesheets a wrong name attribute
of the Submit buttons got corrected.
- A couple of obsolete JAR files from the WEB-INF/lib
folder got removed and added the most most recent (Feb.
1st 2003) versions of the remaining JARs. StrutsCX v0.8.2 depends
on the following libraries. You can find in them in the WEB-INF/lib
folder, too:
| Struts |
|
struts-1.1-b3.jar |
| JDOM |
|
jdom-b8.jar |
| Castor XML |
|
castor-0.9.4.2-xml.jar |
| Log4j |
|
log4j-1.2.7.jar |
| Xerces |
|
xerces-1_4_4.jar |
| Jakarta Commons |
|
commons-beanutils-1.5.jar
commons-collections-2.1_rc2.jar
commons-dbcp_1.0.jar
commons-digester-1.3.jar
commons-logging-1.0.1.jar |
| Jakarta ORO |
|
jakarta-oro-2.0.7.jar |
- Some ambiguous constant values in the StrutsCXConstants.java
as well as their references in several classes got changed.
- An additional Log4jInitServlet to handle proper
Log4j initialization was added to StrutsCX v0.8.2. The level the
Logger should output is best set through the new log4j.lcf configuration
file you can find in the WEB-INF/ folder. There you can set the
level for a specific package. Nice! Using Log4j there is no need
to set the Log level through the properties.xml and through parameters
inside a file. More information about the settings you can find
here.
- All the Castor XML data beans got upgraded
to the actual Castor XML version 0.9.4.2. This version allows
us to set the encoding much more easily with the setEncoding()
method of the org.exolab.castor.xml.Marshaller class. So there
is a code change in the writeDataSource() method of the InfoCastorDAO,
too.
- See the Version
0.8.2 API
Up
Version 0.8.1
- Version 0.8.1 removes the JDK 1.4 Logger with the one from Apache's
Log4j package. StrutsCX now runs with JDK 1.3,
too.
- See the Version
0.8.1 API
Up
Version 0.8
- Version 0.8 adds a layering concept according the J2EE
tiered approach and is ready to use with Enterprise JavaBeans.
- The ActionForm is no longer considered as part of the Struts
model but as a kind of Value Object in between the View and the
Controller! Therefore the scetches for the StrutsCX architecture
got updated, too.
- The desing includes some J2EE
Design patterns:
- Business Delegate: Decouples presentation and service tiers,
and provides a facade to the service layer
- ValueObject: Exchanges data between tiers.
- Data Access Objects: Abstracts data sources, provides transparent
access to data
- The ActionForm helper classes (StrutsCXFormReader and StrutsCXFormWriter)
as well as the ActionForm itself are now clearly considered as
part of the presentation layer. They are strictly separated from
the persistence layers and only know how to copy data of the ActionForm
into a Value Object vice versa.
- The StrutsCXDocumentBuilder now consumes an ArrayList
with JavaBeans - one for each Dataset in the Datasource!! Therefore
the Action simply passes on the Value Object/ Collections of Value
Objects it gets from the Business Delegate. - The Actions no longer
has to use the StrutsCXXMLReader to read in the XML data nor do
they need to create a org.jdom.Document Object with the Datasource
data in advance.
- Packages follow the new layer concept. Therefore the a refactoring
of the package structure was necessary:
There are three main packages now:
- strutscx.xslt,
- strutscx.action,
- strutscx.actionform,
- sturtscx.exception,
- strutscx.util and
- strutscx.protptype.
The strutscx.xslt, strutscx.action, strutscx.actionform and strutscx.util
didn't change. New is the strutscx.exception package which bundles
all the exceptions. In the strutscx.prototype package most changes
took place. It now contains all classes of the prototype sample
application and ist structured according the J2EE tier names:
- strutscx.prototype.presentation: contains all packages
and classes of the presentation tier: presentation.action
package (formerly strutscx.action), presentation.actionform
package (formerly strutscx.actionform)
- strutscx.prototype.business: contains the newly created
business delegate and value object classes
- strutscx.prototype.integration: contains the packages
and classes for the data integration and persistence. strutscx.prototype.integration.data.castor
(formerly strutscx.prototype.persist.databean), strutscx.prototype.integration.data.entity
- new for Entity Bean support.
- These packages are removed: strutscx.persist, strutscx.prototype.info
as well as some interfaces these packages contained like the StrutsCXDataAdapter,
StrutsCXJAXBAdapter, StrutsCXJDOMAdapter, StrutsCXFormReader,
StrutsCXFormWriter as well as their implementations; check out
the new strutscx.prototype package for the class.
- These classes got renamed and/or removed:
- strutscx.persist.StrutsCXXMLReader moved from strutscx.persist
to strutscx.util.StrutsCXXMLReader
- strutscx.action.StrutsCXParameters renamed to strutscx.action.StrutsCXBaseActionHelper
- and all the exceptions are moved to the strutscx.exception
package
- The Locale now uses a java.util.Locale and no String anymore.
- The application runs and is tested under Tomcat 1.1b and Orion
Application Server 1.5.4.
- StrutsCXBeanToElement can now handle nested Objects, too.
Up
Version 0.7
- First public release
- Published in the JavaMagazin 09.2002
- See the Version
0.7 API
Up
|
|
|
|