File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
REST with Spring (video course)
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.
It is sorta covered in the
JavaRanch Style Guide
subject: Why the 'initial' in the form-bean Does Not Automatically Populate the Form?
How To Get the 'initial' From the form-property?
Getting error in trying to display form.
DynaActionForm with ActionMapping
Perform the Same Action "with" and "without" a Form
html:optionsCollection from a DynaActionForm
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015