Question

Please pardon me if my question sounds very basic. I am working on a project where they're using struts 1. My supervisor told me that the codes are very messed up. It seems to be that a combination of struts 1 framework and some self created framework are being used.

Is there a way to find out which method is being called when I click a button? I looked at the struts-config.xml file but it didn't help.

Is there a way to put a breakpoint automatically(dynamically) as soon as I click the button, so I know that this is the class being called?

Any help will be much appreciated.

struts-config file:

<action path="/adddispatches-fsav3-02-01" name="dispatchesForm" scope="request" 
type="com.us.web.struts.action.DispatchesNassSimpleSearchAction" 
validate="false">

Methods in the class(because the class has over 5000 lines) DispatchesNassSimpleSearchAction.java

DispatchesNassSimpleSearchAction.java methods

DispatchesNassSimpleSearchAction.java methods

DispatchesNassSimpleSearchAction.java methods

DispatchesNassSimpleSearchAction.java methods

DispatchesNassSimpleSearchAction.java methods

Was it helpful?

Solution

Find out what Action class your class, com.us.web.struts.action.DispatchesNassSimpleSearchAction extends from.

If it extends Action directly, then the execute(ActionMapping, ActionForm, HttpServletRequest, HttpServletResponse) method is invoked. In your instance, it seems that your class doesn't extend any DispatchAction as there isn't any parameter attribute defined in your <action /> tag in your struts-config.xml file.

OTHER TIPS

It should be the "execute" method in the DispatchesNassSimpleSearchAction class. Though it is possible to have many method in a struts action if you use a custom dispatcher.

You're best bet is to set a break point in Java (or add logging) in the action methods in that class. The method signatures for actions look like this:

 public ActionForward someAction(ActionMapping mapping,
                               ActionForm aform,
                               HttpServletRequest request,
                               HttpServletResponse response
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top