Hello Adam,
Tuesday, July 17, 2001, 11:34:07 PM, you wrote:
AY> If I were to implmenet what you suggest below, I would need to be able
AY> to chain actions.
Hm... I think it is not needed if you use scenario -
1. show search form (prefilled) - first action
2. perform search and show results - second action
AY> Basically we are implmenting the wizard type setup
search->>search results->page1->page2 etc.
AY> So search results would go to page1Show.do page1Show.do would forward to
AY> page1.jsp? That would work.
Why do use additional action to show results? You can perform search
and forward to the view page.
<action
path="/searchPerform"
type="com.action.SearchAction"
name="caretoolSearchForm"
input="/WEB-INF/jsp/caretoolSearchForm.jsp">
<forward name="result" path="/WEB-INF/jsp/caretoolSearchResult.jsp"/>
</action>
AY> To address the flexibility, there are two ways. One, use a different
AY> name for the prefilledform than for the non prefilled form. Two have a
AY> flad in the action entry that specifies whether to use the factory or not.
AY> The more I think about it, the more I think the showAction specified
AY> below is the way to go. Keeps it simple.
Has form be prefilled before action.perform call? If so then you
must extend ActionServlet or use exetensions support mechanism in
struts - Extensions servlet of ServiceManager.
AY> Oleg V Alexeev wrote:
>>Hello Adam,
>>
>>Tuesday, July 17, 2001, 9:37:21 PM, you wrote:
>>
>>AY> One part of Struts where I'd like to do some additions is to form
>>AY> initialization. Most of the form Objects I have require prepopulation
>>AY> out of EJBs. What I'd like to do is specify for a form anothe object
>>AY> that is the factory for that form, and values for properties of the
>>AY> factory that should be set before creating the form.
>>
>>
>>AY> in Struts config:
>>
>>AY> <struts-config>
>>AY> <form-beans>
>>AY> <form-bean
>>AY> name="caretoolSearchForm"
>>AY> factory="caretoolSearchFormFactory"/>
>>AY> etc:
>>
>>AY> <form-factories>
>>AY> <form-factory
>>AY> name="caretoolSearchFormFactory"
>>AY> class="com.getcare.caretool.SearchFormFactory" />
>>AY> etc:
>>
>>AY> Then
>>AY> public interface ActionFormFactory {
>>
>>AY> public ActionForm create();
>>AY> }
>>
>>
>>AY> Is there a better way to go about doing this? Am i reinventing the
>>AY> wheel?
>>
>>Simple way to do such task is to perform form populating in Action
>>class.
>>
>><action
>> path="/searchFormShow"
>> type="com.action.SearchFormShow"
>> name="caretoolSearchForm">
>> <forward name="form" path="/WEB-INF/jsp/caretoolSearchForm.jsp"/>
>></action>
>>
>>Place your call to the EJB in com.action.SearchFormShow action class,
>>create and fill form, store it in appropriate context and forward to
>>the 'form' forward - all values will be prepopulated.
>>
>>May be your idea about automatic form prepopulating is good... I think
>>it needs to be more flexible in factory<->form link, because of form
>>can be used with different actions and prepopulating sometimes is not
>>needed.
>>
--
Best regards,
Oleg mailto:[EMAIL PROTECTED]