| 网站首页 | 文章中心 | 下载中心 | 图片中心 | 访客留言 | 数码商城 | 毕设、论文 | 彩票 | 
您现在的位置: 有昌网络 >> 文章中心 >> 特别研究 >> JSP技术区! >> 文章正文 用户登录 新用户注册
tomcat设置访问密码         
tomcat怎么设置跟iis那种类似的访问密码
作者:xiaochan… 文章来源:本站原创 点击数: 更新时间:2005-6-28 10:19:46

问题:tomcat怎么设置访问密码?跟iis那种类似的 ? 

回答:

例如你要控制对ROOT目录下文件的访问:

首先更改$TOMCAT_HOME/ROOT/WEB-INF/web.xml

1。在<web-app>和</web-app>之间加入

<security-constraint>

<web-resource-collection>

<web-resource-name>Entire Application</web-resource-name>

<url-pattern>/*</url-pattern>

</web-resource-collection>

<auth-constraint>

<!-- NOTE: This role is not present in the default users file -->

<role-name>user</role-name>

</auth-constraint>

</security-constraint>



<!-- Define the Login Configuration for this Application -->

<login-config>

<auth-method>BASIC</auth-method>

<realm-name>TEST ACCESS CONTROL</realm-name>

</login-config>



2。然后在$TOMCAT_HOME/conf/tomcat-users.xml中加入

<user name="user" password="password" roles="user"/>

roles的名字和web.xml中的相对应



在TOMCAT4.03中测试通过 


文章录入:xiaochang    责任编辑:张丽娜 
  • 上一篇文章:

  • 下一篇文章:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    专 题 栏 目
    最 新 热 门
    最 新 推 荐
    相 关 文 章
    没有相关文章
    网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)