RequestContext.getRequestChannelId() seems doesn't work

来源:互联网 发布:二维码生成器java代码 编辑:程序博客网 时间:2024/05/22 00:36

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>

                           <tdclass="nav_menuitem_selected"><ahref="<%=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)) {

                     %>

 
原创粉丝点击