Below codes doen’t work
for (int i = 0, j = navList.size(); i < j; i++) {
Channel chn = (Channel) navList.get(i);
String channelName = chn.getData().getName();
String channelId = chn.getContentManagementId().getId();
RequestContext rqCtx = PageUtil.getCurrentRequestContext(pageContext);// get request context from somewhere
String currntChannelId = (rqCtx.getRequestChannelId()== null? null:rqCtx.getRequestChannelId().getId());
String link = XSLPageUtil.buildLinkURI(rqCtx, channelId, "", "");
if(currntChannelId!= null && currntChannelId.equals(channelId)) {
%>
<tr>
<td class="nav_menuitem_selected"><a href="<%=link %>"><%=channelName %></a></td>
</tr>
<%
} else {
Below codes works
for (int i = 0, j = navList.size(); i < j; i++) {
Channel chn = (Channel) navList.get(i);
String channelName = chn.getData().getName();
String channelId = chn.getContentManagementId().getId();
RequestContext rqCtx = PageUtil.getCurrentRequestContext(pageContext);// get request context from somewhere
String currntChannelId = null;
Channel currntChannel = rqCtx.getRequestedChannel();
if(currntChannel != null) {
currntChannelId = currntChannel.getContentManagementId()
.getId();
}
String link = XSLPageUtil.buildLinkURI(rqCtx, channelId, "", "");
if(currntChannelId!= null && currntChannelId.equals(channelId)) {
%>