• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
//Cast the form
DynaValidatorForm dynaForm = (DynaValidatorForm)form;

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