You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ahmed Hammad <ah...@gmail.com> on 2008/11/26 22:04:29 UTC

SSI Filter does not work with JSP

Hi,

I am using Tomcat 6.0.18 with java version "1.5.0_09" on Windows XP, here is
my problem.

I want to configure SSI to work with JSP files. I followed instructions at:
http://tomcat.apache.org/tomcat-6.0-doc/ssi-howto.html
I am able to run SSI Servlet on JSP files, but in this case the java code
inside JSP will not be executed, just displayed as it is. When I configure
SSI Filter, the java code is executed but the SSI directive is not evaluated
without giving any error or hint in the Tomcat log files.

I am not using Apache server, just Tomcat. I need JSP with SSI for legacy
reasons.

Here is my test page:
<%@ page language="java" contentType="text/html;"%>

<html>
<body>
<%
String text = "This is from java code";
out.println(text);
%>
<hr>
<!--#include virtual="header.inc" -->
<hr>
This is page body.
</body>
</html>

--------------------------------------------------------------
Here is my /META-INF/context.xml

<?xml version="1.0" encoding="UTF-8"?>
<Context antiResourceLocking="false" privileged="true" />

--------------------------------------------------------------
and here is my /WEB-INF/web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="
http://java.sun.com/xml/ns/javaee" xmlns:web="
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"
version="2.5">
  <display-name>MediaSearchArabic</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>

    <filter>
        <filter-name>ssi</filter-name>
        <filter-class>
          org.apache.catalina.ssi.SSIFilter
        </filter-class>
        <init-param>
          <param-name>contentType</param-name>
          <param-value>text/x-server-parsed-html(;.*)?</param-value>
        </init-param>
        <init-param>
          <param-name>debug</param-name>
          <param-value>0</param-value>
        </init-param>
        <init-param>
          <param-name>expires</param-name>
          <param-value>666</param-value>
        </init-param>
        <init-param>
          <param-name>isVirtualWebappRelative</param-name>
          <param-value>0</param-value>
        </init-param>
    </filter>

    <filter-mapping>
        <filter-name>ssi</filter-name>
        <url-pattern>*</url-pattern>
    </filter-mapping>

</web-app>

---------------------------------------

I am attaching a sample web application that show the problem.

I greatly appreciate your support.


Regards,
Ahmed

Re: SSI Filter does not work with JSP

Posted by Ahmed Hammad <ah...@gmail.com>.
You are right Mark. Thanks a lot :)

Ahmed


On Wed, Nov 26, 2008 at 11:08 PM, Mark Thomas <ma...@apache.org> wrote:

> Ahmed Hammad wrote:
> > <%@ page language="java" contentType="text/html;"%>
>
> I am pretty sure the content types have to match in order for the filter to
> be used. The content type of your JSP doesn't match your filter
> configuration.
>
> >         <init-param>
> >           <param-name>contentType</param-name>
> >           <param-value>text/x-server-parsed-html(;.*)?</param-value>
> >         </init-param>
>
> Mark
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: SSI Filter does not work with JSP

Posted by Mark Thomas <ma...@apache.org>.
Ahmed Hammad wrote:
> <%@ page language="java" contentType="text/html;"%>

I am pretty sure the content types have to match in order for the filter to
be used. The content type of your JSP doesn't match your filter configuration.

>         <init-param>
>           <param-name>contentType</param-name>
>           <param-value>text/x-server-parsed-html(;.*)?</param-value>
>         </init-param>

Mark


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org