为什么 WebSphere 6.1(兼容 JDK 1.5)将我的 JSP 编译为 JDK 1.4?

发布于 2024-08-17 12:24:49 字数 225 浏览 3 评论 0原文

我们的 Web 应用程序符合 JDK 1.5,并且在 WebSphere 6.1 上成功运行。

但是,我们拥有的一些包含 1.5 语法中的 Java 代码的 JSP 无法通过 WebSphere 进行编译。

似乎由于某种原因,WebSphere 将 JSP 视为兼容 1.4,因此无法编译。

知道为什么以及如何解决这个问题吗? (停止在 JSP 中编写 Java 是一个答案,还有什么?)

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?)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

路还长,别太狂 2024-08-24 12:24:49

如果您使用 RAD,请打开 web.xml,转到扩展选项卡并添加新的 jsp 属性 jdkSourceLevel 和值 15(其中没有点),

它将更改 ibm-web.xml 并且条目看起来像

  <webApp href="WEB-INF/web.xml#WebApp_ID"/>
  <jspAttributes xmi:id="JSPAttribute_1" name="jdkSourceLevel" value="15"/>

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"/>
ゃ懵逼小萝莉 2024-08-24 12:24:49

查看 文档的此页面。它声称有一个“JDK源级别”选项:

JDK源码级别
指定来源
Java编译器的级别
编译 JSP Java 源代码。有效的
值为 13、14 和 15。默认值
值为13,指定来源
1.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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文