Wednesday, 21 August 2013

h:commandLink refershes the page before calling the action

h:commandLink refershes the page before calling the action

I have a page with a logout button which is h:commandLink
<h:form>
<div id="top-nav">
<div id="logout" style="float: right; margin-left:
10px;">
<h:commandLink styleClass="top-nav-btn"
action="#{adminLogoutBean.logout}"
rendered="#{facesContext.externalContext.sessionMap['ccUserVO']
ne null}" value="Logout" immediate="true">
<f:ajax execute="@form" render="@none" />
</h:commandLink>
</div>
<div style="margin-left: -80px; margin-top: 70px;">
<p style="float: left;margin-left: 10px;">Please
enter client VIN or EMAIL</p>
<br />
<h:inputText styleClass="menus
txfld_border_no_image required email"
minlength="5"
style="width:300px;clear:right;display:inline;"
id="loginEmail"
value="#{callCenterAdminBean.searchText}"
/>
<span class="btn-wrap" id="get_enabled">
<h:commandButton type="submit"
class="common_btn noprint submit"
id="userlookup_btn" value="GET"
action="#{callCenterAdminBean.userLookup}">
</h:commandButton> </span>
<span class="btn-wrap" id="get_disabled"
style="display:none"> <h:commandButton
type="submit"
class="common_btn noprint submit"
disabled='true' value="GET"
action="#{callCenterAdminBean.userLookup}">
</h:commandButton> </span>
</div>
</h:panelGroup>
</div>
</h:form>
When I click on Logout, I find the page refreshes first and then the
action is called. Why does the page refresh? I want to call the bean
method which will redirect to the login page using the navigation rules.
Please help.

No comments:

Post a Comment