当前位置: 主页 > 服务器技术 > Web服务器 > 为iis 6整合resin支持JSP

为iis 6整合resin支持JSP

时间:2010-1-14来源:互联网 点击:

顺便附一个测试页,将下面代码保存为一个.jsp 文件放到你的默认网站目录下,

<%@ page contentType= "text/html;charset=gb2312"%>

<html>

<head>

<title>HI-JSP实验</title>

</head>

<body>

<%

   String Msg = "This is JSP test! 看到这段话,恭喜你,成功了!";  

   out.print("Hello World!");

%>

<h3><%=Msg%></h3>

The current date and time is <%=new java.util.Date() %>

<br>

<%

   String str = "Using trim() and substring() can be very useful";

   out.println(str);

%>

</body>

</html>

下面说一下配置多站点的方法。

目的: 给域名 youjava.com   建立一个jsp 的网站 ,该网站位置于d:\wwwroot\youjava_com

步骤:

1,首先,在iis 中新建一个网站 域名为 youjava.com

2,在该站点上新建一个虚拟目录,名为 scripts , 本地路径为c:\inetpub\scripts

3,修改    c:\resin-3.0.24\conf\resin.conf

将默认的站点复制,并在下面粘贴一份:

<!-- configures the default host, matching any host name -->

    <host id="" root-directory=".">

       <!--

          - configures an explicit root web-app matching the

          - webapp‘s ROOT

         -->

      <web-app id="/" document-directory="c:/inetpub/wwwroot "/>

       <resin:if test="${java.isJava5()}">

         <!--

            - Administration application /resin-admin

            -

            - password is the md5 hash of the password.

            - localhost is true to limit access to the localhost

           -->

         <resin:set var="resin_admin_password"   default=""/>

         <resin:set var="resin_admin_localhost" default="true"/>

         <web-app id="/resin-admin" document-directory="${resin.home}/php/admin"/>

        </resin:if>

     </host>

将上面 蓝色内容分别修改如下:

<!-- configures the default host, matching any host name -->     修改为    <!-- youjava.com-->

<host id="" root-directory="."> 修改为   <host id="youjava.com" root-directory=".">

<web-app id="/" document-directory="c:/inetpub/wwwroot "/> 修改为 <web-app id="/" document-directory="d:\wwwroot\youjava_com"/>

保存——重启resin   完成。

注意,在上面的配置中,只配置了主域名 youjava.com 的访问,如果需要多域名访问如 www.youjava.com 或者更多的域名访问需要在<web-app id="/" document-directory="d:\wwwroot\youjava_com"/> 的上面加入别名:

<host-alias>www.youjava.com</host-alias>   

即可,每一行一个别名。

在不同的resin 版本中 resin.conf 的配置 方法是不一样的。但只要明确,每一个站点的配置其实就是从 站点名称开始 也就是 <host id=   的上一行,到 /host> 结束。

站长资讯网
.
分页: [1] [2]
TAG: IIS6 resin 整合
推荐内容最近更新人气排行
关于我们 | 友情链接 | 网址推荐 | 常用资讯 | 网站地图 | RSS | 留言