急急急 初学者遇到表单提交乱码问题?

db_30 2008-03-27 04:20:50
我是一个初学者,对如何新建过滤器,在web.xml如何链接不知道?请高手指教!
具体问题:
遇到表单提交乱码问题,在tomcat的目录中复制SetCharacterEncodingFilter.class文件到D:\jakarta-tomcat-5.0.28\webapps\box\WEB-INF\classes\ch2\util\filter目录下
可是myeclipse无法编译通过以下是web.xml中的内容,请指教问题出在哪里?
<servlet>
<description>This is the description of my J2EE component</description>
<display-name>This is the display name of my J2EE component</display-name>
<servlet-name>fristServlet</servlet-name>
<servlet-class>com.box.fristServlet</servlet-class>
</servlet>
<servlet>
<description>This is the description of my J2EE component</description>
<display-name>This is the display name of my J2EE component</display-name>
<servlet-name>IoFileServlet</servlet-name>
<servlet-class>com.box.IoFileServlet</servlet-class>
</servlet>


<servlet-mapping>
<servlet-name>fristServlet</servlet-name>
<url-pattern>/servlet/fristServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>IoFileServlet</servlet-name>
<url-pattern>/servlet/IoFileServlet</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>Set Character Encoding</filter-name>
<filter-class>classes.ch2.util.filters.SetCharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>GBK</param-value>
</init-param>
</filter>

<filter-mapping>
<filter-name>Set Character Encoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

</web-app>
...全文
70 点赞 收藏 5
写回复
5 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
db_30 2008-05-12
结贴了!
回复
db_30 2008-03-28
请各位高手帮忙指点!
回复
db_30 2008-03-27
重新调整web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<filter>
<filter-name>Set Character Encoding </filter-name>
<filter-class>classes.ch2.util.filters.SetCharacterEncodingFilter </filter-class>
</filter>

<filter-mapping>
<filter-name>Set Character Encoding </filter-name>
<url-pattern>\*</url-pattern>
</filter-mapping>



<servlet>
<description>This is the description of my J2EE component</description>
<display-name>This is the display name of my J2EE component</display-name>
<servlet-name>fristServlet</servlet-name>
<servlet-class>com.box.fristServlet</servlet-class>
</servlet>
<servlet>
<description>This is the description of my J2EE component</description>
<display-name>This is the display name of my J2EE component</display-name>
<servlet-name>IoFileServlet</servlet-name>
<servlet-class>com.box.IoFileServlet</servlet-class>
</servlet>


<servlet-mapping>
<servlet-name>fristServlet</servlet-name>
<url-pattern>/servlet/fristServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>IoFileServlet</servlet-name>
<url-pattern>/servlet/IoFileServlet</url-pattern>
</servlet-mapping>
</web-app>
还是不行???
回复
fuyou001 2008-03-27
 [code=XML]<filter> 
<filter-name>Set Character Encoding </filter-name>
<filter-class>classes.ch2.util.filters.SetCharacterEncodingFilter </filter-class>
<init-param>
<param-name>encoding </param-name>
<param-value>GBK </param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Set Character Encoding </filter-name>
<url-pattern>/* </url-pattern>
</filter-mapping>

应放在 <servlet>
<description>This is the description of my J2EE component </description>
<display-name>This is the display name of my J2EE component </display-name>
<servlet-name>fristServlet </servlet-name>
<servlet-class>com.box.fristServlet </servlet-class>
</servlet>
<servlet>
<description>This is the description of my J2EE component </description>
<display-name>This is the display name of my J2EE component </display-name>
<servlet-name>IoFileServlet </servlet-name>
<servlet-class>com.box.IoFileServlet </servlet-class>
</servlet>


<servlet-mapping>
<servlet-name>fristServlet </servlet-name>
<url-pattern>/servlet/fristServlet </url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>IoFileServlet </servlet-name>
<url-pattern>/servlet/IoFileServlet </url-pattern>
</servlet-mapping>[/code]前面
回复
db_30 2008-03-27
在Console里显示:

严重: Error filterStart
2008-3-27 16:12:05 org.apache.catalina.core.StandardContext start
严重: Context startup failed due to previous errors
2008-3-27 16:12:05 org.apache.coyote.http11.Http11Protocol start
回复
相关推荐
发帖
Eclipse
创建于2007-09-28

5.8w+

社区成员

Java Eclipse
申请成为版主
帖子事件
创建了帖子
2008-03-27 04:20
社区公告
暂无公告