2

I use JSP include and from my IDE (IBM RAD 8) I get an error that it can't find variables and that imports can't get resolved but those variables and imports are actually handled in the file that includes the JSP my IDE is complaining about. So is there some setting or likewise that I can use to get rid of this false positive since it is not a compile error that a JSP that is included uses a variable from the page that includes it? enter image description here For includes we should be able to set what references the include if the IDE can't find it so that this false error won't appear. How is this setting possible?

Thanks for any help

pnuts
  • 58,317
  • 11
  • 87
  • 139
Niklas Rosencrantz
  • 25,640
  • 75
  • 229
  • 424

2 Answers2

3

If you use the default jspf extension for fragments, the IDE should be able to distinguish between pages and their dependencies. See RAD Infocenter.

When this is done, a validation error shows up in the include declaration if the container does not provide a dependency.


As an aside: consider dropping scriptlets in favour of the Expression Language; consider using JSP comments instead of HTML comments. See the JSP style guide for more.

McDowell
  • 107,573
  • 31
  • 204
  • 267
1

I had the same problem. You can turn off validation in RAD. If possible, only the .jspf files should be unable to compile, and you can exclude those only. However, if you have uncompilable fragments in .jsp files, you will have to turn off validation for all .jsp files and lose the benefit of .jsp validation!

The process is here. (Although it says RAD 7, it also works for RAD 8.)

  1. First disable validation of .jspf files: http://www-01.ibm.com/support/docview.wss?uid=swg21284702

  2. If you need to disable validation of .jsp files, then go to Window -> Preferences (or right click on the project and select Preferences, to make this change for a project instead of the entire workspace) and go to the Validation option. Uncheck the two checkboxes for JSP Syntax Validator. I don't recommend doing this, because RAD will no longer help you find legitimate JSP syntax errors, but your project should validate and compile if there are no other errors.

k-den
  • 853
  • 13
  • 28
  • Thank you for the answer. I'm wondering how to enable validation, not how to disable it. – Niklas Rosencrantz May 18 '12 at 06:18
  • I'm confused, you wanted a "setting or likewise that I can use to get rid of this false positive"-- that is **exactly** what turning off validation will do. If the code is valid, it will still compile. As you said in your previous answer "Validation of JSPF is broken", which I agree is true when compiling across include files that don't compile on their own, so why would you want it enabled? – k-den May 18 '12 at 14:43
  • OK I suppose the only way to deal with my problem is to turn off validation. It is not professional by IBM to sell a product which has broken features. – Niklas Rosencrantz May 21 '12 at 07:23