给新手--安装tomcat后username和password设置以及项目怎么部署在tomcatserver上

安装后tomcatserver后。登陆首先就是让输入username和password。但是我们在安装tomcat的过程中好像没有让设置username和password,这时候可能有人就抓狂了。还有的人是突然忘记了username和password,对于出现这样的情况该怎么去解决呢?

不慌。tomcat安装的过程中是没有让用户设置username和password,由于这个工作是须要用户自己在配置文件里自己书写的。步骤例如以下:

以我安装tomcat的文件夹为例  D:\Program Files\apache-tomcat-6.0.35

进入该文件夹找到conf文件下,找到tomcat-users.xml文件,用记事本打开它



然后在<tomcat-users></tomcat-users>中间加入<user username="" password="" roles="manager"/>

<tomcat-users>
<!--
  NOTE:  By default, no user is included in the "manager-gui" role required
  to operate the "/manager/html" web application.  If you wish to use this app,
  you must define such a user - the username and password are arbitrary.
-->
<!--
  NOTE:  The sample user and role entries below are wrapped in a comment
  and thus are ignored when reading this file. Do not forget to remove
  <!.. ..> that surrounds them.
-->
<!--
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <user username="tomcat" password="tomcat" roles="tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>
-->
<user username="" password="" roles="manager"/> 
</tomcat-users>

上述代码中引號能够自己设置username和password,假设依照我上面所写的代表是没实username和password

这下子大家都清楚了么?

安装好了tomcat,以下就是怎么将自己的项目部署到tomcat上了

首先在MyEclipse中将tomcat设置好  设置的方法和地方例如以下图所看到的


分别设置JDK  载入方式 Paths不用设置


设置好后,将自己的项目部署到tomcat服务器上,能够利用IDE MyEclipse来部署。或者直接手动在server.xml中自己主动部署

打开刚才的tomcat安装的conf目录 找到server.xml  打开在当中加下例如以下代码就可以

<Context path="/struts2" docBase="D:\MyEclipse 10 WorkSpace\struts2\WebRoot" reloadable="true" />

当中 struts2是项目名称  docBase是该项目的路径  reloadable表示当改动配置文件等server自己主动又一次载入


这样,启动server就可以。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值