81,092
社区成员
发帖
与我相关
我的任务
分享
function donewsTask(){
//task.jsp一开始加载首先调用这个函数,把action传过去,获取到当前session的username!!!
try {
// location.href='/Test.jsp';
//alert("error");
location.href ='/Task_Action?TestNo=1';
}
catch(e)
{alert("wrong");}
}
<!--新增加的模块!功能是登陆进去根据登录用户的session取出用户的相应信息 -->
<action name="Task_news" path="/Task_Action" scope="request" validate="false"
type="com.coreram.newTask.Task_Action" parameter="method" >
<forward name="ok" path="/success.jsp"/>
</action>
public class Task_Action extends DispatchActionSupport {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
/*SysUser user = (SysUser) request.getSession().getAttribute(com.coreram.framework.Globals.USER_KEY);
if (user.getUsername().equals("超级管理员")) {
System.out.println("oye!");
return mapping.findForward("ok");
}*/
String TestNo = Pub.val(request, "TestNo");
if (TestNo.equals("1")) {
System.out.println("success");
return mapping.findForward("ok");
}
return null;
}
}