Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How To Get the 'initial' From the form-property?

 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my struts-config.xml, I provided some initial values:

<form-bean
name="threadForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property
name="sort"
initial="thread_last_post_date"
type="java.lang.String"/>
<form-property
name="order"
initial="DESC"
type="java.lang.String"/>
</form-bean>

How do I get the initial value in my servlet that extends Action?

I tried:

form.get( "sort" );
form.get( "order" );

and

form.getProperty( "sort" );
form.getProperty( "order" );

The compiler complains "cannot resolve symbol: method get" and "cannot resolve symbol: method getProperty".
[ June 18, 2004: Message edited by: JiaPei Jen ]
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
//Cast the form
DynaValidatorForm dynaForm = (DynaValidatorForm)form;

//Get the properties
dynaForm.getDynaProperty( "sort" );
dynaForm.getDynaProperty( "order" );
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic