A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
OCM Java EE 6 Enterprise Architect Exam Guide
this week in the
Why the 'initial' in the form-bean Does Not Automatically Populate the Form?
Joined: Nov 19, 2000
Jun 21, 2004 18:58:00
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>
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:
subject: Why the 'initial' in the form-bean Does Not Automatically Populate the Form?
DynaActionForm with ActionMapping
Getting error in trying to display form.
html:optionsCollection from a DynaActionForm
How To Get the 'initial' From the form-property?
Perform the Same Action "with" and "without" a Form
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014