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?

souter
  • 386
  • 4
  • 17

1 Answers1

0

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: JSP EL (Expression Language) causing problems in Eclipse

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.

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • Thanks Balus. If I were starting afresh I wouldn't use this style. But it there is a sizable corpus of existing code using it. re. your earlier answer, I've hunted high and low in that dialog but not found the option I want. The errors are all to do with jsp, except for the java section. This references a subset of the java/compiler/errors&warnings dialog. However, there is nothing corresponding to "unresolved reference" in either. These pages only contain warnings e.g. unused local variables. I'm guessing these are generated by eclipse, while the unresolved reference error is from the ..... – souter Dec 10 '09 at 09:38
  • ... compiler and as such is not amenable to configuration. Does this make sense? – souter Dec 10 '09 at 09:39