我用的是eclipse3.4+tomcat插件+tomcat5.0新建一个tomcat project后,默认生成的目录结构让我有点晕,搜了半天也没找到一篇描述这个的帖子所以来问更直接吧默认生成WEB-INF/src、bin、src、WEB-INF这几个目录
问题:1、WEB-INF/src和src这两个,用哪个放java文件,比如servlet之类呢?2、bin目录是干嘛的?3、我现在想测试一下,项目根目录下新建的index.jsp,用input送个name变量进去,然后用servlet回显,index.jsp如下:
<?xml version="1.0" encoding="GB18030" ?>
<%@ page language="java" contentType="text/html; charset=GB18030"
pageEncoding="GB18030"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030" />
<title>Insert title here</title>
</head>
<body>
<form method="post" action="./servletTestProj">
<p>姓名:<input type="text" name="name" /></p>
<p><input type="submit"/></p>
</form>
</body>
</html>WEB-INF下新建web.xml如下:<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<servlet>
<servlet-name>ServletTestProj</servlet-name>
<servlet-class>test.ServletTestProj</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ServletTestProj</servlet-name>
<url-pattern>/ServletTestProj</url-pattern>
</servlet-mapping>
</web-app>servlet代码不贴了,已经测过没问题
然后启动tomcat后,输入姓名,然后返回404错误,请问下是xml文件写的有问题吗?怎么解决?
问题:1、WEB-INF/src和src这两个,用哪个放java文件,比如servlet之类呢?2、bin目录是干嘛的?3、我现在想测试一下,项目根目录下新建的index.jsp,用input送个name变量进去,然后用servlet回显,index.jsp如下:
<?xml version="1.0" encoding="GB18030" ?>
<%@ page language="java" contentType="text/html; charset=GB18030"
pageEncoding="GB18030"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030" />
<title>Insert title here</title>
</head>
<body>
<form method="post" action="./servletTestProj">
<p>姓名:<input type="text" name="name" /></p>
<p><input type="submit"/></p>
</form>
</body>
</html>WEB-INF下新建web.xml如下:<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<servlet>
<servlet-name>ServletTestProj</servlet-name>
<servlet-class>test.ServletTestProj</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ServletTestProj</servlet-name>
<url-pattern>/ServletTestProj</url-pattern>
</servlet-mapping>
</web-app>servlet代码不贴了,已经测过没问题
然后启动tomcat后,输入姓名,然后返回404错误,请问下是xml文件写的有问题吗?怎么解决?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货