I have the following code that looks up if a logged in customer is in the 'Students' customer segment then sets a flag to true.
I would like the code to look at further customer segments in one go, such as G1, G2, G3 or G4.
Maybe a statement that looks up the segment and then sets the flag to true? Make sense?
<c:set var="ownerId" value="${CommandContext.store.owner}"/>
<%
String isStudent = "false";
Long userIdStr = (Long)pageContext.getAttribute("userId");
Long ownerIdStr = (Long)pageContext.getAttribute("ownerId");
MemberGroupAccessBean ambrgrp = new MemberGroupAccessBean();
try {
ambrgrp = new MemberGroupAccessBean().findByOwnerName(ownerIdStr,"Students");
MemberGroupMemberAccessBean mgmbr = new MemberGroupMemberAccessBean();
mgmbr = new MemberGroupMemberAccessBean().findByGroupMember(ambrgrp.getMbrGrpIdInEJBType(),userIdStr);
isStudent = "true";
} catch(Exception ex) {
}
pageContext.setAttribute("isStudent",isStudent);
%>
Aucun commentaire:
Enregistrer un commentaire