Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Can't get h:commandLink to work

843844Jun 28 2010 — edited Sep 24 2010
I'm working with JSF 2 (Mojarra 2.0.2) and I can't get what should be a very easy page to work. I'm trying to use h:commandLink on the home page of my app to let the user click and go to a login page. When I use the code below and I click the link, the web browser does nothing but append "#" to the end of the URL in the address bar. I've tried in both Safari and Firefox and both show the same behavior. If I manually go to /view/login.xhtml the page displays fine.

I've tried making the navigation case do a redirect and I've also played around with changing the content-type. If I use a commandButton then clicking the button works fine, it just seems to be commandLink. Any ideas?

Here's the Facelet:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
<head>
    <title><h:outputText value="#{msg['label.welcome']}"/></title>
</head>
<body>
<h:form>
    <h:outputText value="${msg['label.loginTitle']}"/>
    <br/><br/>

    <h:commandLink id="idLogin" action="login">
        <h:outputText value="${msg['label.login']}"/>
    </h:commandLink>
</h:form>
</body>
</html>
And here's the navigation case in faces-config.xml:
	<navigation-rule>
		<from-view-id>*</from-view-id> 
		<navigation-case>
			<from-outcome>login</from-outcome>
			<to-view-id>/view/login.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>
Edited by: egillespie on Jun 28, 2010 8:39 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 22 2010
Added on Jun 28 2010
14 comments
2,224 views