This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Struts and the fly likes How To Get the 'initial' From the form-property? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How To Get the Watch "How To Get the New topic

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

JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
In my struts-config.xml, I provided some initial values:


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

I tried:

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


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

Joined: Feb 05, 2003
Posts: 4727

//Cast the form
DynaValidatorForm dynaForm = (DynaValidatorForm)form;

//Get the properties
dynaForm.getDynaProperty( "sort" );
dynaForm.getDynaProperty( "order" );

A good workman is known by his tools.
I agree. Here's the link:
subject: How To Get the 'initial' From the form-property?
Similar Threads
Why the 'initial' in the form-bean Does Not Automatically Populate the Form?
setting checkbox value
Struts Validator Plug-In Framework
I am getting error when starting Tomcat .How can I rectify it?
DynaValidatorForm validation question.