struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Germuska <...@Germuska.com>
Subject Re: Extending Action Mapping
Date Tue, 08 Feb 2005 21:09:05 GMT
At 3:35 PM -0500 2/8/05, Todd Nine wrote:
>Thanks for the help, given the Java Bean standards of getters and
>setters, is there any way to set a Map or a List from the xml file
>(something like the way Spring Framework does it)?   And thanks for
>the naming complement, we get quite a few amusing ones, like
>LaserBeanUtils... :)

There is no way to set a map or a list at the moment.  It wouldn't be 
all that hard to write some Digester rules that did it, but I haven't 
heard much call for it so far.    It is possible to add your own 
rules to the Digester ruleset used during struts-config processing, 
but is that really worth it?

For an immediate solution, I'd suggest just writing your mapping 
class to fit the constraints; just change the name of your method 
from getIgnore() to getIgnoreList().

There has been a bit of discussion on the dev list about using 
Spring, or other alternative ways for configuring the system of 
objects in a Struts application; my conclusion at this point is that 
we are better off refining the model before changing configuration 
approaches -- that is, to design a "Struts API bean" which 
encapsulates what a running Struts application does without being so 
entangled with the ActionServlet and the Servlet API.

Joe



>
>On Tue, 8 Feb 2005 15:23:41 -0500, Benedict, Paul C
><paul_benedict@merck.com> wrote:
>>  If your setter (for setIgnore?) does not have the same type as its getter,
>>  it is probably ignored. The JavaBean spec is really strict with its
>>  requirement for properties.
>>
>>  By the way, "LaserActionMapping" is the coolest action classname I've ever
>>  seen. If there was an award for these things, I think you would win :o)
>>
>>  -----Original Message-----
>>  From: Todd Nine [mailto:todd.nine@gmail.com]
>>  Sent: Tuesday, February 08, 2005 3:20 PM
>>  To: Struts Users Mailing List
>>  Subject: Extending Action Mapping
>>
>>  Hi all, I am trying to extend the ActionMapping Class with my own,
>>  LaserActionMapping.  I have a List that I want to populate with
>>  MessageResource keys,.  I have the configuration below, and my class.
>>  The setter is never being called, does anyone have any suggestions?
>>
>>  <action path="/otherparties"
>>  type="com.llic.web.action.OtherPartiesAction" parameter="method"
>>  input="newBusiness/OtherPartiesTab.jsp" name="otherPartiesForm"
>>  scope="request" validate="true"
>>                  className="com.llic.web.action.LaserActionMapping" >
>>                          <set-property property="ignore"
>>  value="annuity.button.next"/>
>>                          <set-property property="ignore"
>>  value="annuity.button.previous"/>
>>                          <set-property property="ignore"
>>  value="annuity.defaultmethod"/>
>>                          <set-property property="ignore"
>>  value="annuity.reloadmethod"/>
>>
>>                          <forward name="load"
>>  path="newBusiness/OtherPartiesTab.jsp"/>
>>                          <forward name="next"
>>  path="newBusiness/OtherPartiesTab.jsp"/>
>>                          <forward name="addnewparty"
>>  path="newBusiness/OtherPartiesTab.jsp"/>
>>                          <forward name="removeparty"
>>  path="newBusiness/OtherPartiesTab.jsp"/>
>>                          <forward name="updatechanges"
>>  path="newBusiness/OtherPartiesTab.jsp"/>
>>                          <forward name="loadParty"
>>  path="newBusiness/OtherPartiesTab.jsp"/>
>>
>>                  </action>
>>
>>  /*
>>   * Created on Feb 8, 2005
>>   *
>>   */
>>  package com.llic.web.action;
>>
>>  import java.util.ArrayList;
>>  import java.util.List;
>>
>>  import org.apache.struts.action.ActionMapping;
>>
>>  /**
>>   * @author Todd Nine
>>   * This implementation allows for multiple keys to be set.
>>   * This will allow us to skip validation on certain mappings.
>>   */
>>  public class LaserActionMapping extends ActionMapping {
>>
>>          //map of parameters to ignore
>>          private List ignore;
>>
>>          /**
>  >          * Constructor for LaserActionMapping.
>>           */
>>          public LaserActionMapping() {
>>                  super();
>>                  ignore = new ArrayList();
>>
>>          }
>>
>>          /**
>>           * @param map
>>           */
>>          public void setIgnore(String value) {
>>                  ignore.add(value);
>>          }
>>
>>          /**
>>           * @return A list of keys to ignore
>>           */
>>          public List getIgnore() {
>>                  return ignore;
>>          }
>>
>>  }
>>
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>  For additional commands, e-mail: user-help@struts.apache.org
>>
>> 
>>------------------------------------------------------------------------------
>>  Notice:  This e-mail message, together with any attachments, 
>>contains information of Merck & Co., Inc. (One Merck Drive, 
>>Whitehouse Station, New Jersey, USA 08889), and/or its affiliates 
>>(which may be known outside the United States as Merck Frosst, 
>>Merck Sharp & Dohme or MSD and in Japan, as Banyu) that may be 
>>confidential, proprietary copyrighted and/or legally privileged. It 
>>is intended solely for the use of the individual or entity named on 
>>this message.  If you are not the intended recipient, and have 
>>received this message in error, please notify us immediately by 
>>reply e-mail and then delete it from your system.
>> 
>>------------------------------------------------------------------------------
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org


-- 
Joe Germuska            
Joe@Germuska.com  
http://blog.germuska.com    
"Narrow minds are weapons made for mass destruction"  -The Ex

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


Mime
View raw message