You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Craig R. McClanahan" <Cr...@eng.sun.com> on 2000/07/17 05:22:32 UTC

Summary of New Features in 20000717 Distribution

This weekend I finally had a chance to sit down and code some of the
excellent suggestions that have been coming in through the mailing
lists.  This email summarizes the features that have been added, and
which will be available as of tonight's nightly build (20000717):


CUSTOM TAGS:

* New tag <struts:options1> that is the JDK 1.1
  equivalent of <struts:options>.

* New tag <struts:multibox> that supports initializing
  checkboxes from a property getter that returns an
  array of associated values, rather than a single value.

* All of the field-related tags (checkbox, hidden,
  multibox, password, property,radio, select,
  text, and textarea) now take an optional "name"
  attribute that lets you specify the name of a different
  bean from which to grab the current value.  The default
  behavior is to access the bean associated with the
  form we are nested in (as before).  NOTE:  The
  controller servlet still supports only a single bean for
  automatic population of properties, but you can populate
  other beans (via BeanUtils.populate()) yourself in the
  action class.

* The <struts:link> and <struts:link1> tags can now generate
  a link based upon a global forwarding set up in action.xml,
  instead of requring you to know the hyperlink explicitly.
  The existing capability to add optional query parameters
  works for this kind of a link also.

BEAN RELATED PROGRAMMING:

* The BeanUtils.populate() method, and supporting methods,
  have been enhanced to consistently use the JavaBeans
  "Introspector" class to identify bean properties, and the
  associated getter and setter method names.  Among other
  things, that means Struts will work correctly with JavaBeans
  that have an associated BeanInfo class that customizes
  the properties available and/or the associated methods.

* The BeanUtils.populate() method, and supporting methods,
  now support properties that get and set an array as well as
  a scalar value.  This is used, for example, to support the new
  <struts:multibox> tag.

* The BeanUtils module now caches the results of introspecting
  a bean to identify its property getter and setter methods.  As a
  result, repeated use of the same bean (which is very common
  in Struts-based applications) will run faster than before.


CONFIGURATION:

* In addition to existing mechanisms, there is a new way to set
  arbitrary properties of an <action> or <forward> element.  To
  use it, you can nest a <property name="foo" value="bar/> element
  inside.  This approach is more friendly to development tools, and
  will allow us to create a DTD for "action.xml" files that does not
  have to be updated, even if you have added custom properties
  to your forward or mapping implementation classes.


FORM BEANS SCOPE:

You may now use form beans in request scope, in addition to the
default session scope.  To do this for an individual action, add a
formScope="request" attribute to the <action> element.  You can
also declare request scope to be the default by using the
RequestActionMapping class as your mapping implementation,
as described in the Javadocs for the ActionServlet class.

In all cases, you need to explicitly declare that you want request scope

on your <struts:form> tag, by adding a scope="request" attribute.



That's about enough for one weekend.  Happy Strut-ing!  :-)

Craig



Re: Summary of New Features in 20000717 Distribution

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Colin Wilson-Salt wrote:

> Does this mean that I can now use some / most / all of Struts in a
> sessionless environment?

That is definitely the intent.  You could always use the controller
servlet
and action classes part of Struts without sessions; now you can take
advantage of the forms and automatic form bean populaton a well.

>
> If so, what limitations can I expect?

At least the following come to mind:

* If you really have no session, the internationalization
  features of the <struts:message> tag will have no way
  to know what Locale the user prefers, so all messages
  will be displayed in the system default Locale's language.
  You might consider having sessions just for the user's
  Locale bean if you need i18n support.

* Since there is no state information being saved between
  requests, you will need to make sure that your input form
  *always* contains all of the properties of the underlying
  bean, even if they are hidden.  This affects multi-page forms
  (such as "wizards") the most -- you have to carry along all
  of the values that are not being displayed on the current
  page as well as the visible ones.

Craig

RE: Summary of New Features in 20000717 Distribution

Posted by Colin Wilson-Salt <co...@london.virgin.net>.
Does this mean that I can now use some / most / all of Struts in a
sessionless environment?

If so, what limitations can I expect?

-----Original Message-----
From: Craig R. McClanahan [mailto:Craig.McClanahan@eng.sun.com]
Sent: 17 July 2000 04:23
To: struts-user@jakarta.apache.org; struts-dev@jakarta.apache.org
Subject: Summary of New Features in 20000717 Distribution

<snip>

FORM BEANS SCOPE:

You may now use form beans in request scope, in addition to the
default session scope.  To do this for an individual action, add a
formScope="request" attribute to the <action> element.  You can
also declare request scope to be the default by using the
RequestActionMapping class as your mapping implementation,
as described in the Javadocs for the ActionServlet class.

In all cases, you need to explicitly declare that you want request scope

on your <struts:form> tag, by adding a scope="request" attribute.



That's about enough for one weekend.  Happy Strut-ing!  :-)

Craig




RE: Summary of New Features in 20000717 Distribution

Posted by Jen Hsien Huang <u5...@ncnu.edu.tw>.
The select/options tag seem still not support multiple yet.
Again, following the new update. I modify SelectTag to support multiple selection 

add to select in struts.tld 

<attribute>
      <name>size</name>
      <required>false</required>
      <rtexprvalue>false</rtexprvalue>
    </attribute>

add bean property "size(int)" to SelectTag, and insert following code after SelectTag.java line 220

if (size > 0){
	    results.append(" size=\"");
	    results.append(size);
	    results.append("\"");
	    results.append(" multiple");
	}



-----Original Message-----
From: Craig R. McClanahan [mailto:Craig.McClanahan@eng.sun.com]
Sent: Monday, July 17, 2000 11:23 AM
To: struts-user@jakarta.apache.org; struts-dev@jakarta.apache.org
Subject: Summary of New Features in 20000717 Distribution


This weekend I finally had a chance to sit down and code some of the
excellent suggestions that have been coming in through the mailing
lists.  This email summarizes the features that have been added, and
which will be available as of tonight's nightly build (20000717):


CUSTOM TAGS:

* New tag <struts:options1> that is the JDK 1.1
  equivalent of <struts:options>.

* New tag <struts:multibox> that supports initializing
  checkboxes from a property getter that returns an
  array of associated values, rather than a single value.

* All of the field-related tags (checkbox, hidden,
  multibox, password, property,radio, select,
  text, and textarea) now take an optional "name"
  attribute that lets you specify the name of a different
  bean from which to grab the current value.  The default
  behavior is to access the bean associated with the
  form we are nested in (as before).  NOTE:  The
  controller servlet still supports only a single bean for
  automatic population of properties, but you can populate
  other beans (via BeanUtils.populate()) yourself in the
  action class.

* The <struts:link> and <struts:link1> tags can now generate
  a link based upon a global forwarding set up in action.xml,
  instead of requring you to know the hyperlink explicitly.
  The existing capability to add optional query parameters
  works for this kind of a link also.

BEAN RELATED PROGRAMMING:

* The BeanUtils.populate() method, and supporting methods,
  have been enhanced to consistently use the JavaBeans
  "Introspector" class to identify bean properties, and the
  associated getter and setter method names.  Among other
  things, that means Struts will work correctly with JavaBeans
  that have an associated BeanInfo class that customizes
  the properties available and/or the associated methods.

* The BeanUtils.populate() method, and supporting methods,
  now support properties that get and set an array as well as
  a scalar value.  This is used, for example, to support the new
  <struts:multibox> tag.

* The BeanUtils module now caches the results of introspecting
  a bean to identify its property getter and setter methods.  As a
  result, repeated use of the same bean (which is very common
  in Struts-based applications) will run faster than before.


CONFIGURATION:

* In addition to existing mechanisms, there is a new way to set
  arbitrary properties of an <action> or <forward> element.  To
  use it, you can nest a <property name="foo" value="bar/> element
  inside.  This approach is more friendly to development tools, and
  will allow us to create a DTD for "action.xml" files that does not
  have to be updated, even if you have added custom properties
  to your forward or mapping implementation classes.


FORM BEANS SCOPE:

You may now use form beans in request scope, in addition to the
default session scope.  To do this for an individual action, add a
formScope="request" attribute to the <action> element.  You can
also declare request scope to be the default by using the
RequestActionMapping class as your mapping implementation,
as described in the Javadocs for the ActionServlet class.

In all cases, you need to explicitly declare that you want request scope

on your <struts:form> tag, by adding a scope="request" attribute.



That's about enough for one weekend.  Happy Strut-ing!  :-)

Craig