在找问题的过程中发现难以理解的问题 我在有标签库的登陆界面有<bean:message key="userinfo.login.title"/>这个标签,我把XML中设置过滤器的代码注释掉,程序运行正常,加上过滤器后就出现"/tags/struts-html" not found 的错误提示了,我再把过滤器加上,程序运行正常,且过滤器正常工作,当我把我<bean:message key="userinfo.login.title"/>这个标签换一个位置时如,从<html:form>里移动到外面时,程序马上就又提示"/tags/struts-html" not found,在XML中把过滤器注释掉,标签可正常显示,程序正常显示后,把过滤器加上程序又可以正常运行,把标签的位置又放回到最原来的位置<html:form>中程序又提示"/tags/struts-html" not found不知道这是怎么回事情,实在是想不明白,我TOMCAT服务器启动时,报出很多这种提示, 严重: Parse Error at line 27 column 65: Element type "put" must be declared. 严重: Parse Error at line 30 column 80: Element type "definition" must be declared. 严重: Parse Error at line 31 column 43: Element type "put" must be declared.
实在是很郁闷,当正常运行时,我把程序里<bean:message key="userinfo.login.title"/>删除掉后,刷新后马上就又出现/tags/struts-html" not found 的错误提示了,重复上面说的把XML中filter设置注释掉再刷新,系统运行正常,再把filter加上,系统也运行正常,如果再把<bean:message key="userinfo.login.title"/>这句话加上系统又出现/tags/struts-html" not found 了,
实在找不到问题,那就是肯定有问题。
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import java.io.IOException;
/**
* @author Administrator
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class checkEncodingFilter implements Filter{
private FilterConfig config=null; //定义FilterConfig对象
private String targetEncoding="gb2312"; //定义默认编码
public void init(FilterConfig config) throws ServletException{
this.config=config;
//得到XML中定义编码
this.targetEncoding=config.getInitParameter("encoding");
}
public void doFilter(ServletRequest request,
ServletResponse response,
FilterChain chain
) throws IOException,ServletException{
//设置编码
request.setCharacterEncoding(targetEncoding);
chain.doFilter(request,response);
}
public void destroy(){
config=null;
}
}
我在有标签库的登陆界面有<bean:message key="userinfo.login.title"/>这个标签,我把XML中设置过滤器的代码注释掉,程序运行正常,加上过滤器后就出现"/tags/struts-html" not found
的错误提示了,我再把过滤器加上,程序运行正常,且过滤器正常工作,当我把我<bean:message key="userinfo.login.title"/>这个标签换一个位置时如,从<html:form>里移动到外面时,程序马上就又提示"/tags/struts-html" not found,在XML中把过滤器注释掉,标签可正常显示,程序正常显示后,把过滤器加上程序又可以正常运行,把标签的位置又放回到最原来的位置<html:form>中程序又提示"/tags/struts-html" not found不知道这是怎么回事情,实在是想不明白,我TOMCAT服务器启动时,报出很多这种提示,
严重: Parse Error at line 27 column 65: Element type "put" must be declared.
严重: Parse Error at line 30 column 80: Element type "definition" must be declared.
严重: Parse Error at line 31 column 43: Element type "put" must be declared.
的错误提示了,重复上面说的把XML中filter设置注释掉再刷新,系统运行正常,再把filter加上,系统也运行正常,如果再把<bean:message key="userinfo.login.title"/>这句话加上系统又出现/tags/struts-html" not found 了,