|
Re: Why is HttpServlet needed on the Java Build Path? [message #1450453 is a reply to message #1449524] |
Wed, 22 October 2014 13:13 |
Larry Isaacs Messages: 1354 Registered: July 2009 |
Senior Member |
|
|
On 10/21/2014 11:53 AM, Peter Palaga wrote:
> Hi *,
>
> I basically have a maven project [1] using JSP just for rendering a UI
> of a portlet. javax.servlet.http.HttpServlet is not necessary at all to
> either build or run it, but I am getting this error marker on the JSP
> file anyway:
>
> Quote:
>> The superclass "javax.servlet.http.HttpServlet" was not found on the
>> Java Build Path
>
>
> What is triggering the marker? Is my project misconfigured somehow? Or
> is WTP assuming incorrectly that all JSP files have to be used as servlets?
>
> [1] github com
> /jboss-developer/jboss-portal-quickstarts/tree/6.2.x-develop/cdi-scopes-portlet
> - obfuscated a little bit, sorry, I can only use links to eclipse.org
> sites while I have fewer than 5 messages
Actually, JSPs are servlets. They are just created in a way that
differs from writing Java directly. If you happen to be using Tomcat,
you can examine the Java file created for the JSP under the "work"
folder. You will find that the generated class extends HttpJspBase,
which extends HttpServlet. I don't think any of this impacted by
whether the JSP is accessed from a portlet or from a browser.
WTP expects projects that contain JSPs to have a server runtime
associated with the project. This runtime will correspond to a version
of the Servlet/JSP spec and will designate which servers you can and
can't deploy the project to. If you use Servlet 3.1 or JSP 2.3, for
Tomcat you could only deploy to version 8.0. WTP will also use this
runtime version to guide the editor for JSPs and other appropriate
editors to match the features in that version of the spec. Since none of
this is involved in actually building your project, I'm guessing the
maven configuration isn't bothering to take this into account.
Cheers,
Larry
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02828 seconds