Sri Sankaran wrote:

No sweat.
The reason this discussion got so off whack was because I tried to slam a square peg in a round hole by continuing with Kris' example (Edit & Save actions) to make my point -- bad idea.
So what *is* my scenario?
Consider for example, a master-detail pair of pages. The master page display a list of employee names. The detail page -- which is displayed when a user selects an employee from the master page -- displays a collection of (possibly editable) fields that describe the selected employee.
The form-bean associated with the detail page is your typical EmployeeBean object. Even if the struts-config is set up with the right action mapping like

<action path="/detail"
type="com.acme.DetailAction"
name="employeeBean"/>

how can Struts know that the user selected the user 'John Smith' on the master page? Ergo, the need to create the necessary form bean in the action for the master page. We cannot wait for/depend on Struts to create it.

John Smith has some unique identifying value, right? You're going to need to grab this value on submit and send it to your detail action so that it knows which one to load. Yes, yes, you could just create the form at that point and be done with it - but that is probably better left to your detail-loading-action - the one that populates the detail form and fowards to your JSP.

I don't like the fact that the MasterAction needs to have knowledge of the requirements for the detail page (the type of bean, the name under which it is accessed) -- or maybe that isn't so bad....??

It needs to know which field the detail will use to lookup the record so that it can send it the value of that field. Is that so bad? You can't expect it to "just know". There has to be something to tell it what you want to do. They're obviously related - they're in a master-detail relationship - so why would such minimal coupling be bad? You've got to have something to indicate what you want to do. Right?

Are you telling me that I missed something fundamental to Struts?...'tis quite likely.

Sri

--
Eddie Bush




--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>

Reply via email to