HttpServletResponse response = ServletActionContext.getResponse();

response.setContentType("text/html;charset=UTF-8");

response.setCharacterEncoding("UTF-8");//防止弹出的信息出现乱码

PrintWriter out = null;

try {

    out = response.getWriter();

    out.print("<script>alert('抱歉,您的链接已失效,您可以返回首页重新申请')</script>");

    out.print("<script>window.location.href='/index.action'</script>");

    out.flush();

    out.close();

    

catch (IOException e) {

    e.printStackTrace();

}


附:

if(***){//表单提交

    PrintWriter out = null;

    try {

    out = response.getWriter();

    out.println(Items);//可以是一个自动提交的表单

    out.flush();

    out.close();

    } catch (IOException e) {

    // TODO Auto-generated catch block

    e.printStackTrace();

    }

    }else{

    response.sendRedirect(Items);//url地址发送

    }



return null;