JSF Portlet Navigation not Working with Hyperlinks

[nobr]Hello,

I am developing a multi-page portlet with JSF in Java Studio Creator... After much mucking around they deploy to liferay and everything is great.

EXCEPT:

When I try to use JSF navigation via hyperlinks it does not work. Buttons work (or invoke the proper application phase, anyway) but Hyperlinks (command links) do not. I've tried using dynamically generated ones and static ones, no dice.

Any ideas? I have relevant code samples below:

Thanks,

JLS

PortletPage1.jsp:

<?xml version="1.0" encoding="UTF-8"?>

<jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:ui="http://www.sun.com/web/ui">

<jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>

<f:view>

<div style="height: 400px; left: 0px; top: 0px; position: relative; width: 200px">

<ui:form binding="#{PortletPage1.form1}" id="form1" virtualFormsConfig="virtualForm1 | | rosterPanel:hyperlink1">

<h:panelGrid binding="#{PortletPage1.rosterPanel}" id="rosterPanel">

<ui:messageGroup binding="#{PortletPage1.messageGroup1}" id="messageGroup1"/>

<h:panelGrid binding="#{PortletPage1.thePanel}" id="thePanel" style="width: 100%; height: 100%;"/>

<ui:hyperlink action="#{PortletPage1.hyperlink1_action}" actionListener="#{PortletPage1.emailRoster_action}"

binding="#{PortletPage1.hyperlink1}" id="hyperlink1" immediate="true" text="test"/>

<ui:button action="#{PortletPage1.button1_action}" binding="#{PortletPage1.button1}" id="button1" text="Compose Email"/>

<ui:imageHyperlink action="#{PortletPage1.imageHyperlink1_action}" binding="#{PortletPage1.imageHyperlink1}" id="imageHyperlink1" text="test"/>

</h:panelGrid>

<br/>

</ui:form>

</div>

</f:view>

</jsp:root>

PortletPage1.java

public String emailRoster_action(ActionEvent ae){

String id = (String)ae.getComponent().getId();

try{

System.out.println("Calling Action...");

//get the id of the enlistment.

String enlistmentString[] = id.split("_");

Long enlistmentID =new Long(Long.parseLong(enlistmentString[1]));

Enrollment theEnrollment = getCachedEnrollmentById(enlistmentID);

WBCUser u = ServerFacade.getSecurityManagerSessionEJB().getUser(theEnrollment.getStudentUserName());

/**

*this will die if there is a problem with the email address.

*/

Address add =new InternetAddress(u.getEmailAddress());

if(u.getEmailAddress().length() < 2){

thrownew Exception("Email address invalid");

}

getSessionBean1().setEmailTo(u.getEmailAddress());

((ActionResponse)FacesContext.getCurrentInstance().getExternalContext().getResponse()).setWindowState(WindowState.MAXIMIZED);

return"sendEmail";

}catch(Exception e){

error("Can't fetch email addresses.");

}

returnnull;

}

public String extractEmailsFromRoster(List enlistments)throws Exception

{

String buffer ="";

for(int i=0;i<enlistments.size();i++){

Enrollment en = (Enrollment)enlistments.get(i);

WBCUser u = ServerFacade.getSecurityManagerSessionEJB().getUser(en.getStudentUserName());

if(u==null || u.getEmailAddress()==null || u.getEmailAddress().length() >< 2){

continue;

}else{

if(i==enlistments.size()-1){//there is no coma after the last one

buffer+=u.getEmailAddress();

}else{

buffer+=u.getEmailAddress() +";";

}

}

}

return buffer;

}

public String emailEntireRoster_action(ActionEvent ae){

String id = (String)ae.getComponent().getId();

try{

//get the id of the enlistment.

String sessionString[] = id.split("_");

Long sessionID =new Long(Long.parseLong(sessionString[1]));

List enlistments = getCachedSessionEnrollmentsById(sessionID);

String to = extractEmailsFromRoster(enlistments);

getSessionBean1().setEmailTo(to);

((ActionResponse)FacesContext.getCurrentInstance().getExternalContext().getResponse()).setWindowState(WindowState.MAXIMIZED);

return"sendEmail";

}catch(Exception e){

error("Can't fetch email addresses.");

}

returnnull;

}

public String button1_action(){

// TODO: Process the button click action. Return value is a navigation

// case name where null will return to the same page.

//response.setWindowState(WindowState.MAXIMIZED);

try{

((ActionResponse)FacesContext.getCurrentInstance().getExternalContext().getResponse()).setWindowState(WindowState.MAXIMIZED);

}catch(Exception ex){

error("");

ex.printStackTrace();

}

return"sendEmail";

}

public String hyperlink1_action(){

// TODO: Replace with your code

return"sendEmail";

}

public String imageHyperlink1_action(){

// TODO: Replace with your code

return"sendEmail";

}

Page Navigation:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE faces-config PUBLIC"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"

"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">

<faces-config>

<navigation-rule>

<from-view-id>/PortletPage1.jsp</from-view-id>

<navigation-case>

<from-outcome>sendEmail</from-outcome>

<to-view-id>/sendEmailMessage.jsp</to-view-id>

</navigation-case>

</navigation-rule>

<navigation-rule>

<from-view-id>/sendEmailMessage.jsp</from-view-id>

<navigation-case>

<from-outcome>ok</from-outcome>

<to-view-id>/PortletPage1.jsp</to-view-id>

</navigation-case>

</navigation-rule>

</faces-config>

[/nobr]

[9919 byte] By [InterruptRequest] at [2007-11-26 10:33:26]
# 1
anyone?
InterruptRequest at 2007-7-7 2:42:00 > top of Java-index,Development Tools,Java Tools...
# 2
Update: It seems to be related to the themeLinks in the JSP. I got it working for a second by adding in a missing themelinks link... but it's not working anymore. Huh.Ideas?
InterruptRequest at 2007-7-7 2:42:00 > top of Java-index,Development Tools,Java Tools...