第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

Jsp 1.7一下不支持泛型?

Jsp 1.7一下不支持泛型?

泥巴先生 2016-03-07 09:05:49
/*An?error?occurred?at?line:?31?in?the?jsp?file:?/admin/staff-right.jsp '<>'?operator?is?not?allowed?for?source?level?below?1.7*/ public?class?Pager<T>?implements?Serializable{ ???? ????private?int?pageSize;//每頁顯示的記錄數(shù) ???? ????private?int?currentPage;//當(dāng)前頁數(shù) ???? ????private?int?totalRecord;//一共多少記錄 ???? ????private?int?totalPage;//一共多少頁 ???? ????private?List<T>dataList;//要顯示的數(shù)據(jù) ???? ???? ????public?int?getPageSize()?{ ????????return?pageSize; ????} ????public?void?setPageSize(int?pageSize)?{ ????????this.pageSize?=?pageSize; ????} ????public?int?getCurrentPage()?{ ????????return?currentPage; ????} ????public?void?setCurrentPage(int?currentPage)?{ ????????this.currentPage?=?currentPage; ????} ????public?int?getTotalRecord()?{ ????????return?totalRecord; ????} ????public?void?setTotalRecord(int?totalRecord)?{ ????????this.totalRecord?=?totalRecord; ????} ????public?int?getTotalPage()?{ ????????return?totalPage; ????} ????public?void?setTotalPage(int?totalPage)?{ ????????this.totalPage?=?totalPage; ????} ????public?List<T>?getDataList()?{ ????????return?dataList; ????} ????public?void?setDataList(List<T>?dataList)?{ ????????this.dataList?=?dataList; ????} ????public?Pager(){ ???????? ????} ????public?Pager(int?pageNum,int?pageSize,List<T>sourceList){ ????????Set(pageNum,pageSize,sourceList); ????} ????public?void?Set(int?pageNum,int?pageSize,List<T>sourceList){ ????????if(sourceList==null){ ????????????return; ????????} ????????//獲取總記錄 ????????this.totalRecord=sourceList.size(); ????????//獲取每頁顯示記錄數(shù) ????????this.pageSize=pageSize; ????????//獲取總頁數(shù) ????????this.totalPage=this.totalRecord/this.pageSize; ????????if(this.totalRecord%this.pageSize!=0){ ????????????this.totalPage+=1; ????????} ????????//當(dāng)前第幾頁數(shù)據(jù) ????????if(this.totalPage<pageNum){ ????????????this.currentPage=pageNum; ????????}else?{ ????????????this.totalPage=pageNum; ????????} ???????? ????????//開始索引 ????????int?fromIndex=this.pageSize*(this.currentPage-1); ???????? ????????//結(jié)束索引 ????????int?toIndex; ???????? ????????if(this.currentPage*this.pageSize>this.totalRecord){ ????????????toIndex=this.totalRecord; ????????}else?{ ????????????toIndex=this.currentPage*this.pageSize; ????????} ???????? ????????this.dataList=sourceList.subList(fromIndex,?toIndex); ????} } //List<Employee>?employees?=?EmployeeController.findAllEmployees(); //Pager<Employee>?pager=new?Pager<>(currentPage,pageSize,employees); //Pager<Employee>?pager=new?Pager<Employee>(currentPage,pageSize,employees); //兩種都有錯(cuò)?錯(cuò)誤提示:An?error?occurred?at?line:?31?in?the?jsp?file:?/admin/staff-right.jsp '<>'?operator?is?not?allowed?for?source?level?below?1.7 //提示有錯(cuò)
查看完整描述

2 回答

已采納
?
無聊的緘默

TA貢獻(xiàn)4條經(jīng)驗(yàn) 獲得超2個(gè)贊

你發(fā)的第100代碼 ? Pager<Employee> pager = new Pager<>(currentPage, pageSize, employees);

這種寫法只有在jdk1.7以上的版本才支持 后面的尖括號(hào)中省略類型

jdk1.5 ?1.6的版本 ?后方的尖括號(hào)中 也要寫 Employee 要和前面的 一直 才行

查看完整回答
1 反對(duì) 回復(fù) 2016-03-08
?
HansonQ

TA貢獻(xiàn)223條經(jīng)驗(yàn) 獲得超56個(gè)贊

你看下你的項(xiàng)目環(huán)境和編譯環(huán)境是不是都是1.7.

一般都是eclipse的編譯環(huán)境與項(xiàng)目的要求不對(duì)應(yīng)造成的,這個(gè)錯(cuò)誤一般是導(dǎo)入別的項(xiàng)目才出現(xiàn)的。

右鍵項(xiàng)目--屬性--勾選Enable project? specific? settings--Compiler compliance level--選擇1.7--OK

查看完整回答
反對(duì) 回復(fù) 2016-03-07
  • 2 回答
  • 0 關(guān)注
  • 3438 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)