有人说要配置web.xml文件我的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">
<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>CustomerRegistration</servlet-name>
<servlet-class>example_lg_1.CustomerRegistration</servlet-class>
</servlet> <servlet-mapping>
<servlet-name>CustomerRegistration</servlet-name>
<url-pattern>/servlet/CustomerRegistration</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>customerform.html</welcome-file>
</welcome-file-list>
</web-app>
请问这样有问题吗?customerform.html这个文件就是我要输入信息的html页面
<?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">
<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>CustomerRegistration</servlet-name>
<servlet-class>example_lg_1.CustomerRegistration</servlet-class>
</servlet> <servlet-mapping>
<servlet-name>CustomerRegistration</servlet-name>
<url-pattern>/servlet/CustomerRegistration</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>customerform.html</welcome-file>
</welcome-file-list>
</web-app>
请问这样有问题吗?customerform.html这个文件就是我要输入信息的html页面
这个问题。。呵呵。。我真笨。。问题又来一个,为什么,我从html那边传到servlet那显示的中文(不是所有的中文,是传过来的姓名为乱码)String Userid = request.getParameter("txtuserid");(请问这个getParemeter()里面放的是文本框的name还是id呢?)请前辈帮帮忙噢。。
doPost()方法是将要返回的内容返回的
response.setCharacterEncoding("gbk")