1

Our web application is JDK 1.5 compliant, and is running succesfuly on WebSphere 6.1

However, some JSPs we have that contain Java code in 1.5 syntax fail to compile by WebSphere.

It seems that for some reason, WebSphere treats the JSPs as 1.4 complient and fails to compile.

Any idea why and how to solve this? (Stop writing Java in JSPs is one answer, what else?)

Eran Medan
  • 44,555
  • 61
  • 184
  • 276

2 Answers2

6

if you are using RAD, open web.xml go to extensions tab and add new jsp attribute jdkSourceLevel and value 15 (no dot in it)

it will change ibm-web.xml and entry would look like

  <webApp href="WEB-INF/web.xml#WebApp_ID"/>
  <jspAttributes xmi:id="JSPAttribute_1" name="jdkSourceLevel" value="15"/>
Kalpesh Soni
  • 6,879
  • 2
  • 56
  • 59
  • Jon - my appologies for changing the accepted answer, yours is great, but this one seems more accurate – Eran Medan Jan 13 '11 at 02:48
  • Thanks for this. I have multiple WAR's in my EAR, but I could only get the Extension tab in one of them. Why is that? I couldnt find where this `` is written. When I view source of the web.xml I dont find it – Shervin Asgari Feb 22 '12 at 13:08
  • shervin, you most probably dont have correct websphere facets on your web apps in rad, see project properties – Kalpesh Soni Mar 07 '12 at 00:18
3

Have a look at this page of the documentation. It claims there's a "JDK source level" option:

JDK source level
Specifies the source level at which the Java compiler compiles JSP Java sources. Valid values are 13, 14, and 15. The default value is 13, which specifies source level 1.3.

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
  • @Jon - this seems to be for pre-compiled JSPs, I'm still looking in their docs for the "on the fly" settings – Eran Medan Jan 10 '10 at 09:21
  • @Ehrann: It may well just be badly explained. I think it's worth giving it a try even if you're not precompiling. – Jon Skeet Jan 10 '10 at 09:42