i have a class UserAction which extends DispatchAction Class.This class has 2 methods "Add" and "Modify" to perform different actions on the database and i then implement them.i make the necessary changes in the struts-config.xml. <action-mappings> <action path="/User" type="com.actions.login.UserAction" parameter="process" /> </action-mappings>
Now i want to implement some links on a jsp page with the parameter that decides which method is to be called inside this DispatchAction class of mine. So my question is how do i write the parameter "process" in the following scenario while creating the link on the jsp page. <html:link action="User">Modify</html:link> <html:link action="User">Add</html:link>
i hope i am descriptive enough to make situation clear.THx in advance,
when i implement this solution it still gives me the error "page cannot be found" but the websphere does not give any error.Is there any elementary mistake that i am doing? Please help. Thank you.
Joined: May 13, 2005
Hi again! In the segment of the struts-config.xml, that you've attached I fing that there's no entry for even a single forward. What does your com.actions.login.UserAction class's execute method return? Since there's no forward sub element in the "action" tag, there must be a global forward which is returned from the "UserAction" class. If its not the case, then I hope something is missing. Can you paste the action class's execute method body? And also the corresponding "action-mapping" ?
/* * Created on Nov 4, 2005 * * To change the template for this generated file go to * Window>Preferences>Java>Code Generation>Code and Comments */ package com.actions.login;
/** * @author mmaniar1 * * To change the template for this generated type comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
Hi! try replacing the new ActionForward("success1");
Hope this works. Regards, Naresh
Joined: Sep 09, 2003
if i call the link http://.../User.do?process=modify then it works but the way u suggested me earlier i.e. to put it in the html:link tag still doesn't work. ne other ideas. and yes could you plz ealborate what is the difference between the "mapping.findforward" and "new ActionForward" ways which made the difference in my case. Thx in advance.