在jsp中调用session.getAttribute()方法后,我收到错误为“无法解析会话”。请建议解决它。提前致谢。 代码如下 -
<%!
String getApplicantDetailsRow(ApplicantAdminViewTO viewTO, ResourceBundle labelResourceBundle, boolean actionNotepadModule,boolean directLettingModuleFlag,boolean canPrepareApplicantMatchList,boolean canViewOtherSubPortalApplicants,boolean canViewOtherSubPortalBids,boolean canViewAndEditOtherSubPortalApplicants,String strSaccCode){
StringBuilder strBuild = new StringBuilder();
PartnerTO partnerTO;
<% CBLContext cblContext = (CBLContext) session.getAttribute(CBLConstants.CBLContext) %>;
partnerTO = cblContext.getCBLPartner();
long pid=partnerTO.getPartnerId();
strBuild.append("<td class=\"caption\">");
strBuild.append(viewTO.getSubPortalCode());
strBuild.append(" / ");
strBuild.append(CBLUtil.wrappingString(viewTO.getParentSystemId()));
strBuild.append("</td>");
strBuild.append("<td class=\"caption\">");
strBuild.append(CBLUtil.checkNull(viewTO.getUserId()));
strBuild.append("</td>");
strBuild.append("<td class=\"caption\">");
strBuild.append(CBLUtil.checkNull(viewTO.getFirstName()));
strBuild.append("</td>");
strBuild.append("<td class=\"caption\">");
strBuild.append(CBLUtil.checkNull(viewTO.getSurName()));
strBuild.append("</td>");
strBuild.append("<td class=\"caption\">");
strBuild.append(CBLUtil.checkDateNull(viewTO.getDateOfBirth()));
strBuild.append("</td>");
strBuild.append("<td class=\"caption\">");
strBuild.append(CBLUtil.checkNull(viewTO.getAppCategoryCode()));
if(!strSaccCode.equals("") && strSaccCode!=null){
strBuild.append(strSaccCode);
}
strBuild.append("</td>");
strBuild.append("<td class=\"caption\">");
strBuild.append(CBLUtil.checkDateNull(viewTO.getQualifyingDate()));
strBuild.append("</td>");
if (pid==1023){
strBuild.append("<td class=\"caption\">");
strBuild.append(viewTO.getApplicantStatus());
strBuild.append("<br/>");
strBuild.append("</td>");
}else{
strBuild.append("<td class=\"caption\">");
strBuild.append(viewTO.getApplicantStatus());
strBuild.append("<br/>");
strBuild.append(returnAppStatusButtons(viewTO, labelResourceBundle));
strBuild.append("</td>");
}
strBuild.append("<td class=\"caption\">");
strBuild.append(viewTO.getEligibleNoBedroom());
strBuild.append(" / ");
strBuild.append(viewTO.getEligibleNoBedspace());
strBuild.append("</td>");
strBuild.append("<td class=\"caption\">");
strBuild.append(viewTO.getBandDesc());
strBuild.append("</td>");
strBuild.append("<td class=\"caption\">");
strBuild.append(viewTO.getCurrencyPoint());
strBuild.append("</td>");
if(actionNotepadModule){
strBuild.append("<td class=\"caption\">");
strBuild.append(CBLUtil.checkDateNull(viewTO.getCaseLastReviewed()));
strBuild.append("</td>");
}
strBuild.append("<td class=\"caption\">");
strBuild.append("<input type=\"button\" name=\"");
strBuild.append(LabelConstants.FULL_DETAIL);
strBuild.append("\" value=\"");
strBuild.append(labelResourceBundle.getString(LabelConstants.FULL_DETAIL));
strBuild.append("\" onClick=\"formSubmit('");
strBuild.append(viewTO.getApplicantId());
if(viewTO.getSubPortalCodeId()==secureUser.getSubPortalCodeTO().getSubPortalCodeId() || canViewOtherSubPortalApplicants || canViewAndEditOtherSubPortalApplicants){
strBuild.append("')\" class=\"button\">");
}else{
strBuild.append("')\" class=\"graybutton\" disabled='disabled'>");
}
strBuild.append("<input type=\"button\" name=\"");
strBuild.append(LabelConstants.VIEW_BIDS);
strBuild.append("\" value=\"");
strBuild.append(labelResourceBundle.getString(LabelConstants.VIEW_BIDS));
strBuild.append("\" onClick=\"formBid('");
strBuild.append(viewTO.getApplicantId());
strBuild.append('\'');
strBuild.append(',');
strBuild.append('\'');
strBuild.append( CBLUtil.checkNull(viewTO.getFirstName()) );
strBuild.append('\'');
strBuild.append(',');
strBuild.append('\'');
strBuild.append(CBLUtil.checkNull(viewTO.getSurName()));
//if(viewTO.getSubPortalCodeId()!=secureUser.getSubPortalCodeTO().getSubPortalCodeId() && !canViewOtherSubPortalBids){
// strBuild.append("')\" class=\"graybutton\" disabled='disabled'>");
//}else{
strBuild.append("')\" class=\"button\">");
//}
if(directLettingModuleFlag && canPrepareApplicantMatchList){
strBuild.append("<input type=\"button\" name=\"");
strBuild.append(LabelConstants.PREPARE_APPLICANT_MATCH_LIST_BUTTON);
strBuild.append("\" value=\"");
strBuild.append(labelResourceBundle.getString(LabelConstants.PREPARE_APPLICANT_MATCH_LIST_BUTTON));
strBuild.append("\" onClick=\"prepareAppMatchList('");
strBuild.append(viewTO.getApplicantId() );
strBuild.append("')\" class=\"button\" style=\"width:180px;\" >");
}
return strBuild.toString();
}
%>
错误是 -
jsp文件中的第139行出现错误:
“会话无法解决”
行:139 - <% CBLContext cblContext = (CBLContext) session.getAttribute(CBLConstants.CBLContext) %>;
答案 0 :(得分:0)
&#34;会话无法解决&#34;
JSP中的session
对象是隐式对象。您只能在scriptlet中使用它,它在声明中不可用(在块<%! ... %>
内)。