我需要制作一个表达式语言条件语句,并检查一些条件。谷歌搜索我只能找到使用三元
的例子#{SomeBean.someProperty ? 'bob' : 'John'}
我需要有更多的条件。我需要这样的东西:
If (SomeBean.someProperty == 'a'){
//Ant
}
Else if (SomeBean.someProperty == 'b'){
//Bob
}
Else if (SomeBean.someProperty == 'c'){
//C++
}
Else{
//Back to the drawing board, something went wrong.
}
我怎样才能用表达式语言写这个?
答案 0 :(得分:2)
与普通Java中的语法相同。
property
请注意,String
被假定为enum
或char
而不是char
,因为#include <stdio.h>
#include <dirent.h>
int main() {
char folderpath;
printf("enter the path : \n");
scanf("%s",&folderpath);
DIR *d;
struct dirent *dir;
d = opendir(&folderpath);
if (d)
{
while((dir= readdir(d)) != NULL)
{
printf("%s\n", dir->d_name);
}
closedir(d);
};
return 0;
}
的解释方式与EL中的数字相同。另请参阅How to compare a char property in EL。