您的位置:首页 > Web前端 > JavaScript

Servlet和JSTL在web.xml中的配置

2016-05-12 17:40 465 查看
<span style="font-family:Times New Roman;font-size:24px;">JSTL</span><span style="font-family:KaiTi_GB2312;font-size:24px;">配置如下:</span>
<pre name="code" class="java"><span style="font-family:Times New Roman;font-size:18px;"><jsp-config>

<taglib>

<taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>

<taglib-location>/WEB-INF/c.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>http://java.sun.com/jsp/jstl/xml</taglib-uri>

<taglib-location>/WEB-INF/x.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>http://java.sun.com/jsp/jstl/fmt</taglib-uri>

<taglib-location>/WEB-INF/fmt.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>http://java.sun.com/jsp/jstl/sql</taglib-uri>

<taglib-location>/WEB-INF/sql.tld</taglib-location>

</taglib>

</jsp-config></span>

Servlet配置如下:

<pre name="code" class="java"><span style="font-family:KaiTi_GB2312;font-size:24px;"> </span><span style="font-family:Times New Roman;font-size:18px;"><servlet>
<servlet-name>ExitServlet</servlet-name>
<servlet-class>com.servlet.ExitServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>LoginServlet</servlet-name>
<url-pattern>/LoginServlet</url-pattern>
</servlet-mapping></span>
<span style="font-family:Times New Roman;font-size:18px;"><servlet>用来配置</span><span style="font-family: 'Times New Roman'; font-size: 18px;"><servlet></span><span style="font-family: 'Times New Roman'; font-size: 18px;">对象名字,</span><span style="font-family: 'Times New Roman'; font-size: 18px;"><servlet-name>表示配置的名称,可以任意</span>
<span style="font-family: 'Times New Roman'; font-size: 18px;">设置,</span><span style="font-family: 'Times New Roman'; font-size: 18px;"> <servlet-class>为对象所有的类,要填写完整路径。</span><span style="font-family: 'Times New Roman'; font-size: 18px;"><servlet-mapping>用来</span>
<span style="font-family: 'Times New Roman'; font-size: 18px;">映射虚拟路径,</span><span style="font-family: 'Times New Roman'; font-size: 18px;"><url-pattern>是JSP所访问的路径,填写这个URL,即可进行访问。</span>


                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  web.xml jstl