The page design which I was not allowed to change was very complex. Each page had up to a dozen submit buttons.
So what I did was this: I named each submit button and had a large if-else-if-else-if in my Action to test for the presence of each button name in the request params:
save(stuff) if (request.getParameter(Constants.SUBMIT_GO_HERE)) mapForward = Constants.SUBMIT_GO_HERE else if (request.getParameter(Constants.SUBMIT_GO_THERE)) mapForward = Constants.SUBMIT_GO_THERE else if (request.getParameter(Constants.SUBMIT_GO_SOMEWHERE_ELSE)) mapForward = Constants.SUBMIT_GO_SOMEWHERE_ELSE else throw new Exception("messed up again!") return mapForward
The problem with this is that these button names all need a corresponding forward in the struts-config mapping, and I kept messing up and always got it wrong about five times before I was done on any page, and so did the rest of the team.
In the JSP it is easy enough to specify the button name using expression language, but this mechanism is always vulnerable to mistakes in the struts-config.xml. And refactoring was a nightmare!
Is it realistic to think of adapting struts to take the class & static declaration in the struts-config.xml? Like this:
<action path="/asdfasdf"> <forward name="Constants.SUBMIT_GO_HERE" path=".thisTile"/> <forward name="Constants.SUBMIT_GO_THERE" path=".thatTile"/> <forward name="Constants.SUBMIT_GO_SOMEWHERE_ELSE" path="/somewhere.do" redirect="true"/> </action>
The intention is to throw an ugly exception at start-up.
Am I dreaming? Or have I missed a better solution somewhere?
Thanks for any opinions Adam -- struts 1.2 + tomcat 5.0.19 + java 1.4.2 Linux 2.4.20 Debian
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]