場景如下:一般像我們在java中判斷一個水果的類型都會寫如下代碼class Fruit {public final static int APPLE = 1;} if (a.getType = Fruit.APPLE ) {
System.out.pring("蘋果");
}而不會寫如下代碼 if (a.getType = 1 ) {
System.out.pring("蘋果");
}現在有如下需求:需要在jsp中判斷水果類型,由于jsp不能獲取對象。<%使用這個new出來的對象好像只能獲取變量不能獲取靜態變量%>求支招。想要在jsp中寫類似如下的代碼 if (a.getType = Fruit.APPLE ) {
System.out.pring("蘋果");
}
添加回答
舉報
0/150
提交
取消