2015-04-04 38 views
1

我在jsp上創建列表時出現問題。我不確定它是否存在一個錯誤(雖然不太可能),或者我正在實現它的方式存在一些問題。 當我嘗試保存在我的列表對象的值,我得到這個例外在jsp上創建列表時出現異常

type Exception report 

messageInternal Server Error 

descriptionThe server encountered an internal error that prevented it from fulfilling this request. 

exception 

org.apache.jasper.JasperException: PWC6033: Error in Javac compilation for JSP 

PWC6199: Generated servlet error: 
source value 1.5 is obsolete and will be removed in a future release 

PWC6199: Generated servlet error: 
target value 1.5 is obsolete and will be removed in a future release 

PWC6199: Generated servlet error: 
To suppress warnings about obsolete options, use -Xlint:-options. 

PWC6197: An error occurred at line: 18 in the jsp file: /OrderCheckOut.jsp 
PWC6199: Generated servlet error: 
diamond operator is not supported in -source 1.5 
    (use -source 7 or higher to enable diamond operator) 

note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 4.1 logs. 

首先,我儘管這可能是會話對象未持有的價值,所以我在獲取一個字符串值,其工作的罰款。但我在列表中遇到了問題。以下是我的Jsp代碼.` <% 嘗試購物車displayCart =(Cart)session.getAttribute(「getValue」);

  String firstname=displayCart.getProdRefCode().toString(); 
      //This is causing problem I suppose 
     ArrayList<String>ProdRefCode=new ArrayList<>(); 
     ProdRefCode.add(firstname); 
     } catch (Exception ex) { 
    %><p> There is some problem..check..! 
     <% 
      } 
     %>` 

誰能幫我把..

任何幫助,將不勝感激..

感謝

+1

@Masud贏得不能修復dia的使用mond運營商在1.5以下。 – 2015-04-04 16:58:37

+0

@DaveNewton,是的你是對的。 – Masudul 2015-04-04 17:02:18

+0

我還想補充一點,我使用Netbeans 8.0.2和servlet版本是3.1 ..如果這有幫助 – 2015-04-04 17:03:51

回答

1

你的堆棧跟蹤清楚地說,爲什麼這個問題發生了。您可能使用Java 5,但鑽石算子是Java 7功能。所以,在兩個解決方案

  1. 更新到Java 7
  2. 不要使用鑽石操作符像下面的聲明。

    List<String> ProdRefCode = new ArrayList<String>(); 
    
0

,而不用聲明的ArrayList這樣

ArrayList<String>ProdRefCode=new ArrayList<>(); 

申報的ArrayList像

List<String> ProdRefCode= new ArrayList(); 

即不使用<>右側

+0

與五個小時前的答案不一樣嗎? – 2015-04-04 22:22:03

+0

Masud給出的一個在右側有,他寫了「不要使用鑽石算子」,所以我不能確定他在暗示什麼。 @Dave和@ Masud謝謝你的幫助:) – 2015-04-05 03:00:13

相關問題