初级护师证书领取流程:我在ROOT\WEB-INF\classes里面写了个Servlet程序,编译通过,但是怎么样运行它呀?

来源:百度文库 编辑:神马品牌网 时间:2024/04/27 06:54:26
首先你得告诉我在IE地址栏键入什么地址。听说还是不是要配置JNDI呀?那么应该怎么样配置,请详细地说说,多谢!!!!!

在你的WEB-INF里的web.xml添加如下内容
<?xml version="1.0" encoding="ISO-8859-1"?>

<web-app 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"
version="2.4">

<!-- JSPC servlet mappings start -->

<servlet>
<servlet-name>myfirst_jsp</servlet-name>
<servlet-class>test.myfirst_jsp</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>myfirst_jsp</servlet-name>
<url-pattern>/myfirst</url-pattern>
</servlet-mapping>

<!-- JSPC servlet mappings end -->

</web-app>
把test.myfirst_jsp替换为你的servlet
myfirst就是你要的url地址的最后的内容
如果你的站点叫web
那你可以这样运行你的servlet
http://127.0.0.1:8080/web/myfirst