You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Johan Compagner <jc...@j-com.nl> on 2001/01/25 20:13:21 UTC

Jsp Compilation question. (Want to load Jsp's from my own location=database)

Hi,

My JSP files are stored in a database because it should be possible to change the jsp pages 
on the fly without deploying a complete new war file and/or shutting down the application server.
And it must be possible to upload those jsp pages through our maintenance web pages of our application.

The problem is how to develop a standaard way so that the (re)compilation of those jsp's works 
over different application servers.

In tomcat i can override the jspCompilerPlugin param of the JspServlet to get what i want i believe!?

        <init-param>
            <param-name>jspCompilerPlugin</param-name>
            <param-value>org.apache.jasper.compiler.JikesJavaCompiler</param-value>
        </init-param>

But this is i believe Tomcat specifiek.

So what i can do is make my own JspServlet and replace the default JspServlet of the
application servlet by defining in my web.xml my own mapping and servlet:

    <servlet-mapping>
        <servlet-name>
            jsp
        </servlet-name>
        <url-pattern>
            *.jsp
        </url-pattern>
    </servlet-mapping>

and a servlet:
    <servlet>
        <servlet-name>
            jsp
        </servlet-name>
        <servlet-class>
            my.package.MyJspServlet
        </servlet-class>
    </servlet>

In tomcat 3.1 this works:
Context log: path="/postbank" Removing duplicate servlet jsp Wrapper(my.package.MyJspServlet)
Context log: path="/postbank" Removing duplicate *.jsp -> Wrapper(jsp org.apache.jasper.runtime.JspServlet)

So it seems that by default the JspServlet is attached to that context and when specified another one it removes 
that one and uses the specified one.

Is this standard behaviour?

But after that i come accross a problem: How can i parse and complile the Jsp to a Servlet??? Because then
i need an application specifiek item. In tomcat i believe Jasper?

So to make a large question short: If i want to load the Jsp pages from my own location how to implement the
rest so that it works with more then one specifiek App Server?

Johan C.