views:

198

answers:

1

Apologies if this is a rehash of an earlier question that I can't find, but is there any way to stop eclipse (ganymede irc) flagging unresolved java references as a problem? I have a web app that I want to deploy via eclipse in order to debug. However, it contains .jsp files including other .jsp files, which reference java objects defined in the includer e.g. (writing this from memory so the syntax will be all over the place):

includer.jsp:
<%String myname="bob"%>
<jsp:include check.jsp>

then check.jsp contains <% if ( myname.equals("bob") ..... etc

eclipse is validating check.jsp in isolation, doesn't like it, won't let me deploy.

I'm sure if I changed the filetype of check.jsp I could get it to work, but it's not my app and there load of other's like it that I'd rather not have to edit.

So, is there any way to configure the eclipse jsp validation to ignore the unresolved reference?

A: 

In your specific case Eclipse is quite right. The include page doesn't have any access to the scriptlet local variable of the parent page. Better use request attributes, you can use JSTL's c:set or a Servlet for this.

As to configuring the JSP validator of Eclipse, I've answered similar question shortly back. I wonder if you didn't see this topic in the list of possibly matched topics which popped up while you entered this question? Here it is: http://stackoverflow.com/questions/1790749/jsp-el-expression-language-causing-problems-in-eclipse/1790859#1790859

Not to mention that using scriptlets is a bad practice. If you can, immediately stop using it and go ahead with taglibs/EL in JSP. It also less or more automagically forces you to write clean JSP code according the MVC ideology.

BalusC
souter
... compiler and as such is not amenable to configuration. Does this make sense?
souter