在struts中有2中跳转的形式
1.
<action path="/experiments/smtz"
type="com.zn.smtz.struts.action.SmtzInsertAction" attribute="SmtzForm" name="SmtzForm">
<forward
name="listSuccess"
path="portlet.experiments.smtzinsert"
redirect="true" />
</action>
注意: path="portlet.experiments.smtzinsert" 是.的形式,此时SmtzInsertAction中方法用的是
public ActionForward render(ActionMapping mapping, ActionForm form, PortletConfig config,
RenderRequest request, RenderResponse response)
throws Exception{
return mapping.findForward(
getForward(request, "listSuccess"));
}
2.
<action path="/experiments/smtz"
type="com.zn.smtz.struts.action.SmtzInsertAction" attribute="SmtzForm" name="SmtzForm">
<forward
name="listSuccess"
path="="/experiments/list"
redirect="true" />
</action>
注意:path="="/experiments/list" 是/的形式,此时的SmtzInsertAction中方法用的是
public class SmtzInsertSaveAction extends PortletAction{
public void processAction(
ActionMapping mapping, ActionForm form, PortletConfig config,
ActionRequest request, ActionResponse response)
throws Exception {
config.getPortletContext().setAttribute("smtz", "success");
setForward(request, "insertSuccess");
}
但是也可以在path中直接指定页面,例如path="/success.jsp",此时的jsp页面必须在html文件夹下就是html下直接有success.jsp中间不能有别的子文件夹