易截截图软件、单文件、免安装、纯绿色、仅160KB

filter过滤怎么使用 JSP - Java / Web 开发

SecurityFilter.java:文件

package tom;

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class SecurityFilter {

public void init(FilterConfig config) throws ServletException {}

  public void destroy() {}


public void doFilter(ServletRequest request,ServletResponse response,FilterChain chain)throws IOException, ServletException {

HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse res = (HttpServletResponse) response;
String uri=req.getRequestURI();
String ctx=req.getContextPath();
uri = uri.substring(ctx.length());
 
HttpSession session = req.getSession();
 
if (uri.startsWith("/admin")) {
if (session.getAttribute("admin") != null) {
chain.doFilter(request, response);
} else {
req.setAttribute("message", "您没有这个权限");
res.sendRedirect("../failure.jsp");
}
}
if(uri.startsWith("/manage")){
if(session.getAttribute("username") != null) {
chain.doFilter(request, response);

} else {
req.setAttribute("message","您没有这个权限"); 
req.getRequestDispatcher("/login.jsp").forwa


相关问答:

JSP/Servlet交互 - Java / Web 开发

JSP页面中有多个radio按钮
  JSP页面将参数POST给servlet
  
  要求如下;
  1.选择一个radio,调用servlet servlet中根据参数调用其他接口,除非选中该radio并点击JSP中的实 ......

关于AJAX和JSP的一些小问题~ - Java / Web 开发

我JSP的页面是:
<%@ page language="java" contentType="text/html; charset=gb2312"
  %>
<script>
function Save(){
xmlHttp=GetXmlHttpObject()
if(xmlHttp==nul ......

java 求助 - Java / Java EE

insert into [ScholarshipManagement].[dbo].[department] ([department],[specialization] ,[grade]) output inserted.departmentID values(? ,? ,? )
请问大哥们这个sql 语句应该用Java里的那个数据库操作方法? ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号