Hi,
I have to code a menu. Depending on the user interaction, different features
will be executed. These features are Struts actions *.do URL with associated
JSP files for the views. The menu is included on all the forms.
Should I use an Action class to manage the menu processing, knowing that no
input form will be associated with it? So the mapping will look like:
<action path="/menu"
type="com.acme.MenuAction"
name="menuForm"
scope="request">
<forward name="home" path="/index.jsp" />
<forward name="feature1" path="/feature1.do?action=Init" />
<forward name="feature2" path="/feature2.do?action=Init" />
</action>
Using the Struts design has the advantage that the foward mapping allows to
use logical names for the features. This indirection level allows to add or
modify a feature without impacting the others (just place a <a
href="menu.do?action=featureN">).
On the other side, Struts mechanic is a bit heavy for a servlet whose role
will be to forward to another feature based on a request parameter, that's
to say a big sequence of if-else.
Subsidiary question:
I have a menu option that is used to switch the language used for display,
and then return to the calling feature.
Can the menu know from which feature it is called, without having to add
another parameter in the request? Is the Referer header available in that
case?
Any opinion welcome.
Pierre M�tras