voyent
Messages posted by: sjmenden  XML
Profile for sjmenden -> Messages posted by sjmenden [5]
Author Message
Thank you for your response.

It was Stateless, but I just converted it over to Stateful and I am still observing the same behavior:

Use to Work with Regular SEAM:
In my template.xhtml page I have a section that should only get rendered if the isAdmin session variable is set to true.

Doesn't work with ICEfaces now:
Now the Admin section gets shown constantly. I even tried to reference the isAdmin as a variable i set in my login EJB like ${login.admin} and the console says returning false for the variable, however the section still gets shown.




Use to Work with Regular SEAM:
A session variable called loggedIn that is set when a user logs in. So in my template.xhtml I have links for Login and Logout. #{loggedIn} to display Logout and #{!loggedIn} to display Login

Doesn't work with ICEfaces now:
Now, initially when I go to my index.xhtml which uses the template.xhtml, only the Login link is being shown, that is fine. But after I log in, then the Login AND Logout links are being shown.




Thank you for taking a look at this.
The administration subview still gets shown even though the admin variable is false, and no exceptions get thrown

index.xhtml
Code:
 ...
 <!-- Administration -->
 <f:subview rendered="#{login.admin == true}">
 <li>
 	<li><a href="administration.seam">Administration</a></li>
 	<ul>
 		<li>
 			<strong>
 				<a href="user.seam">New User</a>
 			</strong>
 		</li>
 		<li>
 			<strong>
 				<s:link id="viewUsers" value="View Users" propagation="end" action="#{viewUsers.findFirstPage}"/>
 			</strong>
 		</li>
 		<li>
 			<strong>
 				<a href="role.seam">New Role</a>
 			</strong>
 		</li>
 		<li>
 			<strong>
 				<s:link id="viewRoles" value="View Roles" propagation="end" action="#{viewRoles.findFirstPage}"/>
 			</strong>
 		</li>
 	</ul>
 </li>
 </f:subview>
 ...
 




Backing EJB3: LoginAction.java
Code:
 ....
 //Base case
 if(Contexts.getSessionContext().get("currentUser") == null) {
 	log.info("Returning false for isAdmin because currentUser == null");
 	return false;
 }
 
 try {
 	User user = (User)Contexts.getSessionContext().get("currentUser");
 	for(Role r : user.getRoles()) {
 		if(r.getRole().equals("admin")) {
 			log.info("Returning true for isAdmin because no admin role was found");
 			return true;
 		}
 	}
 } catch(Exception e) {
 	log.error(e.getMessage());
 	log.error("Error executing isUserAdmin, most likely due the User being null because no User is on the session(user not logged in).");
 }
 log.info("Returning false for isAdmin as a last resort");
 return false;
 ....
 




Console output:
Code:
 Returning false for isAdmin because currentUser == null
 





And even though the admin variable resolves to false, the subview is still getting displayed, how can this be? I've been beating my head over the wall for several days now to no avail. This only happens when I replace the set of seam jars with the ICEfaces jars. And the ICEfaces components do work, just the Expression language is messed up in this case and a few others.

If I'm not mistaken, the EL will try to resolve an unknown variable in every scope before failing.

Here is a more details view of what is happeneing that is preventing me from using ICEfaces, which I really badly want to implement.

Code:
 <li>
 					<h:commandLink value="Logout" rendered="#{login.loggedIn == true}" action="#{login.logout}" />
 					<h:outputText rendered="#{login.loggedIn == false}" >
 						<a href="login.seam">Login</a>
 					</h:outputText>
 				</li>
 



so now I am directly referencing the loggedIn variable, when I first hit my index.xhtml I put logging code that shows:

Code:
 16:00:53,645 INFO  [LoginAction] Returning false for isAdmin
 16:00:53,647 INFO  [LoginAction] Returning false of isLoggedIn
 



Which is perfect, however, right after I log in, the login link is still being shown along with the logout link (which should be shown). This makes absolutely no sense since the console shows:

Code:
 16:02:38,152 INFO  [LoginAction] Returning true for isAdmin
 16:02:38,155 INFO  [LoginAction] Returning true of isLoggedIn
 



So, according to the variables, I should only be seeing the Logout link not the Login since the method accessor to the loggedIn variable returns true.

Any ideas?
The loggedIn is a boolean value in the session context that gets set when I first log in. I guess as a work around for now I'll try to embed that in my login EJB and initialize it false, although, this is more verbose than a simple #{loggedIn}
I just integrated ICEfaces into seam, and the ICEfaces components work that I've tried, but I am now having major Epression Language problems.

Before ICEfaces I had this code in my template.xhtml to determine whether a user was logged in:

Code:
 <li>
 					<h:commandLink value="Logout" rendered="#{loggedIn}" action="#{login.logout}" />
 					<h:outputText rendered="#{!loggedIn}" >
 						<a href="login.seam">Login</a>
 					</h:outputText>
 				</li>
 



when a user first went to my index.seam page which had the above code in it's template, everything would render correctly even though loggedIn was not in the Session context yet.


However, now that I installed ICEfaces both Logout and Login links are getting shown and I see this in my server.log from JBoss:

Code:
 2006-12-04 12:46:56,481 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolving name: loggedIn
 2006-12-04 12:46:56,481 DEBUG [org.jboss.seam.Component] seam component not found: loggedIn
 2006-12-04 12:46:56,481 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] could not resolve name
 2006-12-04 12:46:56,481 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolving name: loggedIn
 2006-12-04 12:46:56,481 DEBUG [org.jboss.seam.Component] seam component not found: loggedIn
 2006-12-04 12:46:56,481 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] could not resolve name
 2006-12-04 12:46:56,481 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolving name: loggedIn
 2006-12-04 12:46:56,481 DEBUG [org.jboss.seam.Component] seam component not found: loggedIn
 2006-12-04 12:46:56,481 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] could not resolve name
 2006-12-04 12:46:56,481 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolving name: loggedIn
 2006-12-04 12:46:56,481 DEBUG [org.jboss.seam.Component] seam component not found: loggedIn
 2006-12-04 12:46:56,481 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] could not resolve name
 2006-12-04 12:46:56,481 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolving name: loggedIn
 2006-12-04 12:46:56,481 DEBUG [org.jboss.seam.Component] seam component not found: loggedIn
 2006-12-04 12:46:56,481 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] could not resolve name
 
 



I have even tried the following to no avail, still the same problem:

Code:
 <h:commandLink value="Logout" rendered="#{loggedIn != null and loggedIn == true}" 
 



Any ideas or help would be greatly appreciated
 
Profile for sjmenden -> Messages posted by sjmenden [5]
Go to:   
Powered by JForum 2.1.7ice © JForum Team