如何在地址栏隐藏JSP文件的路径

如何在地址栏隐藏JSP文件的路径,第1张

需要配置枝卖链web.xml

具体配法如下:

<welcome-file-list>

<welcome-file>index.html</welcome-file>

<welcome-file>home.html</welcome-file>

<welcome-file>welcome.html</welcome-file>

</welcome-file-list>

他会依次找这三个html.如果只配一猛孙个只找一个

一般配置在

<servlet-mapping>

<servlet-name>HelloServlet</servlet-name>

<url-pattern>配桥*.hello</url-pattern>

</servlet-mapping>

下面

隐藏方法一(CSS隐藏):

正常显示族凳文本框 :<input type="返陪text" value="hi">

不显示的文本框 :<input type="text" value="漏穗蠢hi" style="display: none">

按钮同上。

隐藏方法二(注释):

正常显示文本框 :<input type="text" value="hi">

不显示的文本框 :<!-- <input type="text" value="hi">-->

按钮同上。

这个不是叫隐藏扩展名.

而是xml的映射.(我说的对吗?)

.do的应该是structs的.也是java类的.

你提交一个连接,然指慎罩后经过一个xml文件的映射.然后找到所需.

比如这个web.xml

<?xml version="1.0" encoding="utf-8"?>

<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">

<!-- 设置对应Servlet对应的类型 -->

<servlet>

<servlet-name>shop</servlet-name>

<servlet-class>shop.shopping</servlet-class>

</servlet>

<!-- 设置请求对应响应的Servlet名称 -->

<servlet-mapping>

<servlet-name>shop</servlet-name>

<url-pattern>/shopping</url-pattern>

</servlet-mapping>

<!-- The Welcom File List -->

<welcome-file-list>

<welcome-file>shop.jsp</welcome-file>

</welcome-file-list>

</web-app>

里面已唯闹经基本上脱离的jsp的范围了.应该叫Servlet.


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/tougao/12253090.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-22
下一篇 2023-05-22

发表评论

登录后才能评论

评论列表(0条)

保存