velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shankar Banerjee <>
Subject Re: Map-backed ActionFrom with velocity
Date Wed, 22 Sep 2004 17:26:59 GMT
Shinobu Kawai <shinobu.kawai <at>> writes:

> Hi Shankar,
> > the form. Now, I am trying to use a map-backed ActionForm with the same
> > velocity module and I have doen the various steps:
> > Defined a DynamicActionForm with a map field and getValue , setValue
> > configured the ActionForm in struts-config.xml using <FormBean tag and then
> > referred it by the name in the corresponding <Action tag. The problem is 
> > its not autoloading the form fields from the screen. That is, whatever I 
> > in on the screen is not getting into the ActionForm inside the execute 
> > of the corresponding Action. Everything works fine when I use static 
> > Any idea or clue what might be happening ?
> Can you share with us how you did it?  A minimal sample code to
> reproduce your problem would be nice.  (I didn't know you could
> configure getter/setter methods for DynaActionForm via the
> struts-config.xml...)
> Best regards,

Hi Shinobu,

Here are the code and config snippets that I used. Also I am using a map-
backed ActionForm and not a DynaActionForm. I think the name that I am using 
DynamicActionForm has confused you. But thats just a name this is an 
ActionForm that has a Map to contain all the field values in the html form.
I am trying to submit the Form from a velocity module and I do not see 
the auto population happening : 

The velocity fragment looks is asfollows: 
<form id="searchform" 

Search for: <input name="searchCriteria" size=20 
type="text" value="$!searchForm.value("searchCriteria")"> 
<input name="searchType" size=20 type="text" 
<input type="submit" value="Search Now"> 


The ActionForm class is as follows: 
public class DynamicActionForm extends ActionForm 
private Map values = new HashMap(); 
public DynamicActionForm() { 

/*public void setMap(Map aMap) 
values = aMap; 
public Map getMap() 
return values; 
public void setValue(String key, Object value) { 
values.put(key, value); 

public Object getValue(String key) { 
return values.get(key); 
public void reset( 
ActionMapping arg0, 
HttpServletRequest arg1) { 
"Bill Clinton"); 
"TOP_MAP",values); */ 



struts-confgi.xml is as follows: 


Anybody has any idea what might be going wrong ? Appreciate 
any feedback. 


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message