日期:2014-05-19 浏览次数:21486 次
<!--新增加的模块!功能是登陆进去根据登录用户的session取出用户的相应信息 -->
<action path="/newtask" scope="request" validate="false"
type="com.coreram.framework.common.action.NewTask" parameter="method" >
<forward name="ok" path="/success.jsp"/>
</action>
package com.coreram.framework.common.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.springframework.web.struts.DispatchActionSupport;
public class NewTask extends DispatchActionSupport{
public ActionForward newtask(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
if ("tom".equals("tom")) {
return mapping.findForward("ok");
}
return null;
}
}
function doNewsTask(){
//task.jsp一开始加载首先调用这个函数,把action传过去,获取到当前session的username!!!
try {
//alert("error");
//location.href ="/Test.jsp";这种写法是正确的!!
//window.location.href="/Test.jsp"; 这种写法是错误的!!
var url="/newtask.do";
window.location.href=url;
}
catch(e)
{alert("wrong");}
}
<global-exceptions>
<exception key="general.exception" type="java.lang.Exception"
scope="request" handler="com.coreram.framework.exception.RedirectExceptionHandler"
path="/error.jsp" />
</global-exceptions>
public class RedirectExceptionHandler
extends ExceptionHandler {
private static org.apache.log4j.Logger logger = org.apache.log4j.LogManager.getLogger("RedirectExceptionHandler");
public ActionForward execute(Exception ex,
ExceptionConfig ae,
ActionMapping mapping,
ActionForm formInstance,
HttpServletRequest request,
HttpServletResponse response) throws
java在linux上tracert用readline()读不出内容