I'd like to validate a development approach. 

One of our developers is essentially creating two action classes for each
.jsp page / form. The second "post" action class "always" forwards to
another action.

Here's an example from a "test" struts-config.xml. 
<!-- Get SF -->
<action    path="/getsf"
           type="com.mslv.webapp.sftester.action.GetSfAction"
           name="sfForm"
           scope="request">
  <forward name="success"    path="/sftest.jsp"/>
</action>
<!-- Post SF  -->
<action    path="/postsf"
           type="com.mslv.webapp.sftester.action.GetSfAction2"
           name="sfForm"
           scope="request">
  <forward name="success"    path="/process.do"/>
</action>
<!-- Display SF -->
<action    path="/process"
           type="com.mslv.webapp.sftester.action.GetSfAction3"
           name="sfForm3"
          scope="request">
  <forward name="success"    path="/sftest2.jsp"/>
</action>


And here's a scenario where I don't like the functionality with struts. 
Suppose:
o /getsf & /postsf both use sfForm.
o /process uses sfForm3.
o sfForm and sfForm3 both have a "custAcctID" field
o /sftest.jsp & /sftest2.jsp have <html:text property="custAcctID"/>
o /getsf sets the custAcctID = 100
o /postsf sets the custAcctID = 200
Then
o when sftest2.jsp displays, the value of custAcctID is still 100.

I realize this is normal... the values get copied from the request to the
form. One workaround is to examine the forward, instantiate sfForm3, update
custAcctID, and make sfForm3 an attribute of the request. Then when
sftest2.jsp displays, it has the correct "updated" value for custAcctID. BUT
- this is a lot of extra work.

Questions:
1) Are there any other known issues or limitations of using an action to
forward to another action?
2) Could this always be accomplished with fewer, larger action classes? (an
equivalent pattern)
3) Any other comments?

Have a nice weekend. 

Thanks.

Wayne
[EMAIL PROTECTED]

Reply via email to