Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Serving JSPs from Jetty - What am I missing

All Jetty 7 releases starting with Jetty 7.1 contain JSP support out of the box using Glassfish binaries, so you should not add a Jasper dependency to your project. Please refer to Bug 330418 for the explanation of the Maven dependencies of Jetty JSP support module. The JSP support modules for Jetty 8 are undergoing the IP process at the Eclipse Foundation. If you would like to use Jetty 8 with JSP support, your best bet is to download Jetty Hightide distribution from Codehaus.

If you are starting the server programmatically, your should use one of the Jetty aggregate modules (e.g. jetty-server-all) that contains everything you would need to start and run Jetty server as your Maven project dependency. Your JSP files should be located in the root directory or sub-directories of the root directory of your web application. Please refer to LikeJettyXml.java from examples-jetty-embedded module for the example of how to start embedded Jetty that contains web application support.

Thanks,
Michael

On Thu, Dec 23, 2010 at 1:54 PM, Cefn Hoile <jetty-users_eclipse.org@cefn.com> wrote:
Hello all, having christmas fun configuring Jetty. I have hello world
and freemarker servlets working but I'm stuck getting it to serve
JSPs.

From what I can see, I should use Jasper with Jetty to get JSP
support. Reckon I have the JspServlet loading and serving without
Exceptions, but I think it's failing to find .jsp files, and I've
tried putting them in the working directory, in WEB-INF, and various
other places with no luck.

I'm guessing there's some option for Jasper which is automagically
configured in a Tomcat setup which I'll have to do explicitly for
Jetty, but I don't know what. The init params for JspServlet offer no
useful control variables about pointing to .jsp files...
http://tomcat.apache.org/tomcat-4.1-doc/jasper-howto.html#Configuration

Jetty is launched explicitly like...
Server server = new Server(8080);
...and I have the equivalent of web.xml wiring all requests for JSPs
to the jasper JspServlet class, which looks like this in Guice...
serve("*.jsp").with(JspServlet.class);
...but when a jsp is actually routed to the JspServlet it responds...

HTTP ERROR: 404
Problem accessing /index.jsp. Reason:
   /index.jsp
Powered by Jetty://

Am I right in thinking I can use Jasper's JspServlet to give me JSPs
on Jetty? The Jetty docs are pretty sketchy on JSPs, and everything
else on the subject points to Tomcat.

If Jasper is the right way to go, what configuration step am I
missing, e.g. to somehow tell Jasper where to look for .jsp files?

Given the mysterious error message, perhaps there's a missing
dependency? If so, can anyone tell me what dependencies I need to add
to Jetty 8 in order to be able to serve JSPs (I've been adding many
combinations of things from Maven repos and no luck so far). Currently
the relevant dependencies in my POM are...

org.eclipse.jetty jetty-distribution 8.0.0.M2
org.eclipse.jetty jetty-jsp-2.1 7.22
javax.servlet jstl 1.2
org.apache.tomcat jsp-api 6.0.29
org.apache.tomcat jasper 6.0.29

If anyone can guide me to initialise Jasper's JspServlet correctly, or
suggest a alternate JSP engine with a known working configuration on
Jetty, that would be great.

Cefn
http://cefn.com
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top