You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by de...@struts.apache.org on 2004/09/21 02:46:39 UTC

[Apache Struts Wiki] New: StrutsUpgradeNotes11to124

   Date: 2004-09-20T17:46:39
   Editor: NiallPemberton <ni...@apache.org>
   Wiki: Apache Struts Wiki
   Page: StrutsUpgradeNotes11to124
   URL: http://wiki.apache.org/struts/StrutsUpgradeNotes11to124

   no comment

New Page:

= Upgrading Struts 1.1 to Struts 1.2.x =

== jars ==

I guess its obvious to say you need to replace the jars, but the one people might forget is the new commons-validator.jar for version 1.1.3 of validator.

Also if you want to start using the new '''validwhen''' validation rule, then you will need to deploy the antlr.jar as well.

== tlds ==

Remember to deploy the new versions of the tld files for struts tags. If you don't you won't be able to use the new tag attributes added. 

'''NOTE''' The uri's in the struts tlds have changed from jakarta.apache.org/struts to struts.apache.org - however this shouldn't have any impact (see below)

Tag libraries can be configured in one of two ways:

'''A.''' If you have configured the tag libraries using entries in the web.xml (see [http://struts.apache.org/userGuide/configuration.html#dd_config_taglib User Guide]) then these should continue to work.

'''B.''' If you have used the simplified deployment allowed by Servlet 2.3 onwards (see [http://struts.apache.org/userGuide/configuration.html#dd_config_taglib_23 User Guide]) then this should also continue to work as versions of the tld's with the old uri have now been included in the struts.jar (and struts-el.jar). Its recommended that for new development that you use the new uri

            Struts 1.1 {{{ <%@ taglib uri="http://jakarta.apache.org/struts/tags-html prefix="html" %> }}}

            Struts 1.2.x {{{ <%@ taglib uri="http://struts.apache.org/tags-html prefix="html" %> }}}


== validator.xml ==
Change the dtd declaration at the top to refer to the dtd for validator 1.1.3

  <!DOCTYPE form-validation PUBLIC
          "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1.3//EN"
          "http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd">

== validator-rules.xml ==
Upgrade to the new version of validator-rules.xml.

== struts-config.xml ==
Its not absolutely necessary but you should upgrade to the 1.2 version of the dtd (Note that as well as the version number changing so has the url to struts.apache.org).

     <!DOCTYPE struts-config PUBLIC
       "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
       "http://struts.apache.org/dtds/struts-config_1_2.dtd">

If you do upgrade to the 1.2 version dtd then there are a couple of attributes which have been removed and you will need to remove them from your struts-config:
    *    debug has been removed from the "controller" element.
    *    dynamic has been removed from the "form-bean" element

Also the '''''contextRelative''''' attribute in the "forward" element is now considered "deprecated" and a new '''''module''''' attribute added.

== ActionError(s) and ActionMessage(s) ==
There is some confusion over ActionError and ActionErrors and whats deprecated.

'''A.'''  ActionError '''IS''' deprecated and should be replaced by ActionMessage.

'''B.'''  ActionErrors '''IS NOT''' deprecated. The Struts committers would have liked to have deprecated ActionErrors but because too much of core API depend on it (such as the ActionForm's validate method) it hasn't been. However it may be in the future and, where possible, you should now use ActionMessages in place of ActionErrors.

== Custom Tags and Validation ==
Many methods in org.apache.struts.util.RequestUtils and org.apache.struts.util.ResponseUtils are deprecated. Replace RequestUtils.* and ResponseUtils.* with org.apache.struts.taglib.TagUtils.getInstance().*

Replace org.apache.commons.validator.ValidatorUtil with org.apache.commons.validator.util.ValidatorUtils.

== <init-param> web.xml configuration ==

A number of the of ''init'' parameter entries (i.e. <init-param>) in the web.xml were marked as ''deprecated'' in the Struts 1.1 release and have been removed in Struts 1.2. A list of the ''init'' parameters which have been ''removed'' is given below (refer to the [http://struts.apache.org/userGuide/configuration.html User Guide] for more information on Struts configuration):

 * '''mapping''' - see note on '''configFactory''' below
 * '''debug''' - replaced by [http://jakarta.apache.org/commons/logging/guide.html Commons Logging]
 * '''bufferSize''' - moved to <controller> element in the struts-config.xml
 * '''content''' - renamed to '''contentType''' and moved to <controller> element in the struts-config.xml
 * '''locale''' - moved to <controller> element in the struts-config.xml
 * '''maxFileSize''' - moved to <controller> element in the struts-config.xml
 * '''nocache''' - moved to <controller> element in the struts-config.xml
 * '''multipartClass''' - moved to <controller> element in the struts-config.xml
 * '''tempDir''' - moved to <controller> element in the struts-config.xml
 * '''application''' - now '''parameter''' in the <message-resources> element in the struts-config.xml
 * '''factory''' - moved to <message-resources> element in the struts-config.xml
 * '''null''' - moved to <message-resources> element in the struts-config.xml


'''N.B.''' There is a new '''configFactory''' ''init'' parameter in Struts 1.2 which can be used to set a custom ModuleConfigFactory class. This could be used to initialize default ModuleConfig settings on a ''struts-wide'' basis.


----
CategoryHomepage StrutsUpgrade

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org