Java Web应用开发:从基础到高级特性
1. JavaServer Faces (JSF) 中的推荐显示逻辑
在JavaServer Faces (JSF) 应用中,存在一段代码用于根据用户的选择来显示书籍推荐。以下是相关代码逻辑的详细解释:
int numSelected = getSessionBean1().getNumSelections();
Properties selections = getSessionBean1().getSelections();
Enumeration<String> selectionsEnum = selections.keys();
Option [] recommendations;
// if at least one selection was made
if ( numSelected > 0 )
{
recommendations = new Option[ numSelected ];
for ( int i = 0; i < numSelected; i++ )
{
String language = (String) selectionsEnum.nextElement();
recommendations[ i ] = new Option( language +
" How to Program. ISBN#: " +
selections.getProperty( language ) );
} // end for
}
超级会员免费看
订阅专栏 解锁全文

被折叠的 条评论
为什么被折叠?



