易截截图软件、单文件、免安装、纯绿色、仅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 ......

tomcat环境下jsp编译错误,求解! - Java / Web 开发

org.apache.jasper.JasperException: Unable to compile class for JSP: 
An error occurred at line: 52 in the jsp file: /vip_info.jsp
ÕË cannot be resolved
49: <table border="1& ......

jsp和tomcat问题,快疯了 - Java / Java EE

我写了个jsp页面,然后改动了一下,改动的内容就是在jsp页面的js函数里加了个alert()语句,但是我访问这个页面时,死活都是原来页面的内容,我加了很多alert函数还是没改动前的页面内容;tomcat重启了,也重新部署这 ......

mysql的更新语句 - Java / Java SE

id name datetime
1 a 2010-05-13 10:15:00
2 b 2010-05-14 09:10:00
3 d 2010-05-14 10:10:00
如何将距离目前最近的那个记录的name 更新为“x”呢
谢谢咯 啊 呵呵
update table_n ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号