首页
论坛
图书
开发资料
在线文档
网址
下载
联系我们
 新闻│Java│JavaScript│Eclipse│Eclipse 英文│J2EE│J2ME│J2SE│JSP│Netbeans│Hibernate│JBuilder│Spring│Struts
站内搜索: 请输入搜索关键词

当前页面: 开发资料首页 → Java 专题 → 版权过滤器

版权过滤器

摘要: 版权过滤器

</td> </tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> 一般我们都会在网页(仅指*.jsp和servlet)尾部加上版权标志,大都采用添加include指令 <%@ include file="tail.jsp" %>或
标记 ,其实用过滤器是不是更好?

<table width="669" border="0"> <tr> <td width="395"> package example;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class CopyrightFilter implements Filter{
private FilterConfig config;
String year;

public void init(FilterConfig config) throws ServletException{
this.config=config;
year=config.getInitParameter("date");
} </td> <td width="264"> </td> </tr> </table>
public void doFilter(ServletRequest req,ServletResponse resp,FilterChain chain) throws IOException,ServletException{
chain.doFilter(req,resp);
PrintWriter out=resp.getWriter();
out.println("
版权所有:java学习室"+year+"
");
out.flush();
}

public void destroy(){}

}
最后要在web.xml中添加:

CopyrightFilter
example.CopyrightFilter

date
2004.9




CopyrightFilter
/*
function TempSave(ElementID) { CommentsPersistDiv.setAttribute("CommentContent",document.getElementById(ElementID).value); CommentsPersistDiv.save("CommentXMLStore"); } function Restore(ElementID) { CommentsPersistDiv.load("CommentXMLStore"); document.getElementById(ElementID).value=CommentsPersistDiv.getAttribute("CommentContent"); } </td> </tr> <tr>


↑返回目录
前一篇: WEB应用中的编码问题
后一篇: 在servlet中用连接池DDConnectionBroker

首页 | 全站 Sitemap | 联系我们 | 设为首页 | 收藏本站
版权所有 Copyright © 2006-2007, Java 编程资料牛鼻站, All rights reserved