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


相关问答:

java日期处理 - Java / Java SE

当知道一个日期,如何把这个日期所在旬的前后两个日期取出
比如输入20090905,就输入20090901 20090910
输出20090901 20090910

取得天数后作一下判断再把这个方法用下void set(int field, int value)  
......

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& ......

java 求助 - Java / Java EE

insert into [ScholarshipManagement].[dbo].[department] ([department],[specialization] ,[grade]) output inserted.departmentID values(? ,? ,? )
请问大哥们这个sql 语句应该用Java里的那个数据库操作方法? ......

模拟href 的 css样式 - Java / Web 开发

现在不想用<a> </a> 标签 ,因为点击后会出现页面重定位,给文字加上css样式就可以看起来 是href怎么实现这样的css
text-decoration:underline; cursor:hand;

引用
text-decoration:underline; cur ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号