i am using multiple submit buttons using struts2 tags in my jsp page to call different methods in java class but the methods are not being invoked.
my jsp page is:-
<s:form theme="simple">
<table style="width:20%;" style="float:left;" cellspacing="0" cellpadding="0" border="0">
<tr style="white-space:nowrap;">
<td><s:submit name="togglecomplete" value="togglecomplete"action="toggletodotrue"/></td>
<td><s:submit name="toggle" value="cleartodos" action="cleartodo"/></td>
<td><s:submit name="toggleincomplete" value="toggleincomplete" action="toggletodofalse"/><td>
</tr>
</table>
</s:form>
and my struts.xml is
<struts>
<package>
<action name="toggletodotrue" class="com.action.JtableAction"
method="togglecompleted">
<result name="success" type="redirect">listTodo</result>
</action>
<action name="cleartodo" class="com.action.JtableAction"
method="clearcompleted">
<result name="success" type="redirect">listTodo</result>
</action>
<action name="toggletodofalse" class="com.action.JtableAction"
method="toggleincomplete">
<result name="success" type="redirect">listTodo</result>
</action>
<package>
<struts>
The java class is
public class JtableAction extends ActionSupport implements ModelDriven<TODO> {
public String togglecompleted ()throws IOException
{
try{
System.out.println("inside toggle completed");
dao.completeAllTodo();
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
return Action.SUCCESS;
}
public String clearcompleted() throws IOException{
try{
System.out.println("inside clear completed");
dao.clearCompleteTodo();
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
return Action.SUCCESS;
}
public String toggleincomplete()throws IOException
{
try
{
dao.toggleIncompleteTodo();
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
return Action.SUCCESS;
}
These java methods are not being called