Define your form in struts-config.xml like:
form-bean
name=mySearchForm
type=org.apache.struts.action.DynaActionForm
form-property
name=sort
initial=postDate
type=java.lang.String/
form-property
name=order
initial=DESC
type=java.lang.String/
.. Other properties
The property of the 'initial' attribute inside the
form-property tag (i.e. initial=postDate)
does not seem to become the default value. The query
method (with sort and order among the parameters) that
retrieve articles from the database got the
NullPointerException.
I know the query method
Hmm, checkin' something here :-)
I defined a form just like the following form is defined below. I then
defined an action mapping as follows:
action
path=/searchtest
type=com.setech.test.ChrisTestAction
scope=request
name=mySearchForm
forward name=success
Correction to the two BeanUtils calls, it should be:
String sort = BeanUtils.getProperty(form,sort);
String order = BeanUtils.getPropety(form, order);
But in either case it would yield the same result :-)
Chris
- Original Message -
From: Chris Cranford [EMAIL PROTECTED]
To:
I am confused.
First, the compiler complains about the statements:
String sort = BeanUtils.getproperty( form, sort );
String order = BeanUtils.getProperty( form, order
);
error:
cannot resolve symbol
symbol: method getProperty
Note: I did
import org.apache.commons.beanutils.BeanUtils;
Why does one line have getproperty and the other have getProperty ??? Both
should read getProperty ;-)
Chris
- Original Message -
From: Caroline Jen [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Wednesday, June 16, 2004 11:36 PM
Subject: Re: The Same Action
Caroline,
You could always reference the API to check
your method name and parameters. The
Commons BeanUtils API can be found here:
http://jakarta.apache.org/commons/beanutils/api/org/apache/commons/beanutils
/BeanUtils.html
The api states the method and parameter are:
---
7 matches
Mail list logo