让IIS6支持JSP的设置方法(IIS完美整合Tomcat)

2019-10-18 15:41:47王振洲

修改配置文件
C:Program FilesApache Software FoundationJakarta Isapi Redirectorconfuriworkermap.properties

# uriworkermap.properties - IIS
#
# This file provides sample mappings for example wlb
# worker defined in workermap.properties.minimal
# The general syntax for this file is:
# [URL]=[Worker name]

/admin/*=wlb
/manager/*=wlb
/jsp-examples/*=wlb
/servlets-examples/*=wlb

# Optionally filter out all .jpeg files inside that context
# For no mapping the url has to start with exclamation (!)

!/servlets-examples/*.jpeg=wlb

#
# Mount jkstatus to /jkmanager
# For production servers you will need to
# secure the access to the /jkmanager url
#
/jkmanager=jkstatus
/0431la/*=wlb

我们重启tomcat 和 iis 并访问测试
iis的重启可以通过鼠标右键我的电脑 --> 管理 进行重启




接下来我们可以进行测试





ok了 虽然这不是我们的最终结果 但是至少我们之前配置的没有问题了

下面我们进行虚拟主机的配置
9.我们把0431la目录放到c盘根目录并配置tomcat的虚拟主机


 <Host name="www.0431.la" debug="0" appBase="c:431la" unpackWARs="true" autoDeploy="true">
<Context path="" docBase="c:431la" debug="0" reloadable="true"/>
</Host>

10.在iis下面配置虚拟主机的映射目录
并添加jakarta虚拟目录 和 isapi筛选 配置过程可参考第五步

11.修改配置文件
C:Program FilesApache Software FoundationJakarta Isapi Redirectorconfuriworkermap.properties


# uriworkermap.properties - IIS
#
# This file provides sample mappings for example wlb
# worker defined in workermap.properties.minimal
# The general syntax for this file is:
# [URL]=[Worker name]

/admin/*=wlb
/manager/*=wlb
/jsp-examples/*=wlb
/servlets-examples/*=wlb

# Optionally filter out all .jpeg files inside that context
# For no mapping the url has to start with exclamation (!)

!/servlets-examples/*.jpeg=wlb

#
# Mount jkstatus to /jkmanager
# For production servers you will need to
# secure the access to the /jkmanager url
#
/jkmanager=jkstatus
/0431la/*=wlb
/*.jsp=wlb

让jsp请求交由tomcat处理
呵呵
重启iis 和 tomcat 看看我们的成果


我们可以考但jsp请求完全正常解析了。


<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";