Prior to learning
struts, I wrote a servlet/jsp/action application and it works like this ---
In my central
servlet "ControlServlet", it takes "action" as a parameter and the servlet code includes ---
****
if(action.equsls("act1")) { initiate and call Action1 class; forward to jsp1; }
if(action.equals("act2")) { initiate and call Action2 class; forward to jsp2; }
....
****
In jsp1 and jsp2, both of them include html FORM. when "submit" is clicked, it calls "ControlServlet" again, they also carry the "action" parameter as a hidden variable so that "ControlServlet" knows what's the next page it should dispatch to. SO, the overall flow is like
Browser --> /ControlServlet?action=act1 , then it calls "Action1" class and directs to jsp1; in jsp1 after "submit" is clicked --> /ControlServlet?action=act2, then it calls "Action2" class and directs to jsp2...
How to change it into a struts ? the biggest issue is "how to do the action and action mapping " ? Please help me check if the following makes sense ---
<action-mapping>
<action path="/ControlServlet?action=act1"
type="Action1"
(I do NOT put "name=" here because in the First time the servlet gets no input bean !)
input="/ControlServlet?action=act1"
scope="request">
<forward name="ok" path="/jsp1" /></action>
<action path="/ControlServlet?action=act2"
type="Action2"
name="jsp1BeanForm" (this is the content of jsp1 input page)
input="jsp1"
scope="request"
<forward name="ok" path="/jsp2" /></action>
</action-mapping>