for Java中的每个循环和泛型 [英] for-each loops and generics in Java EE

查看:123
本文介绍了for Java中的每个循环和泛型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设计一个基于网站的项目,我首先在Java SE应用程序开发中设计了我的逻辑层。然后我在Java EE中为这个网站做了GUI。我正在使用JSTL在Java EE体系结构中导入我的Java SE文件,我将仅使用它调用这些数据。

但是,它给我的错误如下:
$ b $ ol

  • for-每个循环 - for-each循环在源代码1.4中没有使用,尝试使用源代码1.5来启用for-each循环。

  • 泛型 - 在源码1.4中不支持泛型,尝试使用源码1.5来启用泛型

  • 变量方法在源1.4中不受支持


  • 解决方案

    选择了错误的JDK - 所有这些功能都是在JDK 1.5中添加的。确保为IDE和Web应用程序App Server选择了1.5 JDK。这应该可以解决您的问题。


    I am designing a website-based project wherein I first designed my logical layer in Java SE application development. Then I made the GUI in Java EE for the website. I am importing my Java SE files in the Java EE architecture using JSTL and I will call the data using this only.

    But, it is giving me an error as follows:

    1. for-each loops -- for-each loops are not used in source 1.4, try source 1.5 to enable for-each loop.
    2. generics -- generics are not supported in source 1.4, try source 1.5 to enable generics
    3. variable-arity methods are not supported in -source 1.4

    解决方案

    It appears you have the wrong JDK selected - all those features were added in JDK 1.5. Make sure you have the 1.5 JDK selected for both your IDE, and your web application App Server. This should resolve your problem.

    这篇关于for Java中的每个循环和泛型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆