You can't map an action to a method that has parameters in signature, or return result other than String
. What can you do is create another method for example doData()
private List<Item> data;
//getter and setter
public String doData() {
data = getData(qString);
...
return Action.SUCCESS;
}
<action name="DummyDB" class="com.shopping.op.welcome.DummyDB" method="doData">
<result>/jsp/whateveryoudo.jsp</result>
</action>
In addition to it you need to know that a class you mapped to the action should be a qualified java bean which have a default no-arg constructor or doesn't have constructors at all (in this case the implicit default constructor is used). Struts will instantiate the bean when you make a request to the action mapped by this action config. So, to get it able to do you should follow these simple rules.