Skip to main content



      Home
Home » Language IDEs » ServerTools (WTP) » crazy error
crazy error [message #151713] Tue, 13 December 2005 13:58 Go to next message
Eclipse UserFriend
I have a set of about 20 jspx html pages in an app. *All* of them
contain the following in the head:

<base href="${pageContext.request.contextPath}"/>

Weirdly, on just *two* of these files, Eclipse (presumably WTP)
generates an error saying:

"The method getContextPath() is undefined for the type ServletRequest"

If I delete this line of the file, save the file, and put the line back,
then the complaint disappears -- until I do a complete rebuild of the
project. Then it's back...but always only for these two files.

All of the files in question -- the problem two and the others -- are
identical in things like this:

<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<jsp:directive.page contentType="text/html; charset=UTF-8"/>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<base href="${pageContext.request.contextPath}"/>

So I just don't understand what is going on, or how to get around this
problem.
Re: crazy error [message #151744 is a reply to message #151713] Tue, 13 December 2005 14:11 Go to previous messageGo to next message
Eclipse UserFriend
Noel Bush wrote:
> I have a set of about 20 jspx html pages in an app. *All* of them
> contain the following in the head:
>
> <base href="${pageContext.request.contextPath}"/>
>
> Weirdly, on just *two* of these files, Eclipse (presumably WTP)
> generates an error saying:
>
> "The method getContextPath() is undefined for the type ServletRequest"

The error is invalid, ignore it. The problem is that the validator is
checking for the function ServletRequest#getContextPath() which does not
exist. Not realising that within a Tomcat JSP page the instance is
actually a super class HttpServletRequest and getContextPath() does
exist in that.

Eclipse just needs to be taught this is a special case and promote the
ServletRequest class to HttpServletRequest when validationg and doing
content assist.


This bug/feature should cover the problem:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=110538


If you don't like the warning (or if you find Eclipse stalls from
building the rest of the project correctly, disable JSP validation in
the project settings and/or maybe globally too). This is an unwanted
workaround.

JSP validation might not happen continiously but only during rebuilds,
which is why you can appear to add it back and get not error. What
happens when you Save the file after the edit, I would think validation
should be run then.


Darryl
Re: crazy error [message #151752 is a reply to message #151744] Tue, 13 December 2005 14:16 Go to previous messageGo to next message
Eclipse UserFriend
Darryl L. Miles wrote:
> Noel Bush wrote:
>
>> I have a set of about 20 jspx html pages in an app. *All* of them
>> contain the following in the head:
>>
>> <base href="${pageContext.request.contextPath}"/>
>>
>> Weirdly, on just *two* of these files, Eclipse (presumably WTP)
>> generates an error saying:
>>
>> "The method getContextPath() is undefined for the type ServletRequest"
>
>
> The error is invalid, ignore it. The problem is that the validator is
> checking for the function ServletRequest#getContextPath() which does not
> exist. Not realising that within a Tomcat JSP page the instance is
> actually a super class HttpServletRequest and getContextPath() does
> exist in that.
>
> Eclipse just needs to be taught this is a special case and promote the
> ServletRequest class to HttpServletRequest when validationg and doing
> content assist.

This makes sense -- but why would the error consistently occur with
*only two* of my jspx files, not all of them?

> This bug/feature should cover the problem:
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=110538
>
>
> If you don't like the warning (or if you find Eclipse stalls from
> building the rest of the project correctly, disable JSP validation in
> the project settings and/or maybe globally too). This is an unwanted
> workaround.

Yes, this is a pretty undesirable workaround. Here's my vote for
regarding this as a bug.....

> JSP validation might not happen continiously but only during rebuilds,
> which is why you can appear to add it back and get not error. What
> happens when you Save the file after the edit, I would think validation
> should be run then.
>
>
> Darryl

Thanks!
Re: crazy error [message #151777 is a reply to message #151752] Tue, 13 December 2005 15:00 Go to previous message
Eclipse UserFriend
Noel Bush wrote:
> Yes, this is a pretty undesirable workaround. Here's my vote for
> regarding this as a bug.....

Please register your email, add yourself to the CC and vote on the bug
in buzilla.


It might be nice to have finer grain control over JSP validation, its a
bit of an all-on-one at the moment:

* Markup valiation (HTML, XHTML, WML, whatever)
* Java code validation
* JSP tag validation <jsp:xyz ...>
* JSP EL validation
* JSP TAGLIB validation


I'm just thinking from a WTP perspective it might be difficult or
problematic expect everything to work for everyone in every situation
(even if that is the goal).


Darryl
Previous Topic:Re: Linux for the Eclipse Windows Platform
Next Topic:Remote Deployment to Tomcat5?
Goto Forum:
  


Current Time: Mon Jul 14 21:00:25 EDT 2025

Powered by FUDForum. Page generated in 0.03539 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top