A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
forum!
JavaRanch
»
Java Forums
»
Frameworks
»
Struts
Author
Why the 'initial' in the form-bean Does Not Automatically Populate the Form?
JiaPei Jen
Ranch Hand
Joined: Nov 19, 2000
Posts: 1309
posted
Jun 21, 2004 18:58:00
0
The form-bean in my struts-config.xml is specified like this:
<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>
My
servlet
extends Action has the following code:
DynaActionForm initForm = ( DynaActionForm )form; String sort = ( String )initForm.get( "sort" ); String order = ( String )initForm.get( "order" );
The action mapping for this action is like:
<action roles="administrator,editor,contributor" path="/message/ListThreads" type="org.MyOrg.MyProj.message.ListThreads" name="threadForm" scope="request" validate="false"> <forward name="success" path=".thread.Form"/> </action>
If I call the action with the threadForm submitted, the application works fine.
If I call the action "without" the threadForm submitted, the server cannot get the 'initial' in the form-bean.
Something must be missing because the 'initial' should automatically populate the form if the server cannot find a form.
I really hope someone could spot the error.
I agree. Here's the link:
http://ej-technologies/jprofiler
- if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
subject: Why the 'initial' in the form-bean Does Not Automatically Populate the Form?
Similar Threads
Getting error in trying to display form.
Perform the Same Action "with" and "without" a Form
DynaActionForm with ActionMapping
html:optionsCollection from a DynaActionForm
How To Get the 'initial' From the form-property?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter