users@glassfish.java.net

JSF commandLink

From: <glassfish_at_javadesktop.org>
Date: Sun, 03 Jun 2007 01:55:44 PDT

Hi all!

I'm new to JSF and I'm working on my first proj. so pardon me for asking simple questions...
I have commanLinks as follows:

  <h:dataTable value="#{pe.persons}" var="person">
    <h:column>
        <h:form>
          <h:commandLink action="#{pi.info}">
            <f:param value="#{person.personID}" name="pID"/>
            <h:outputText value="#{person.name}"/>
          </h:commandLink>
        </h:form>
    </h:column>
  </h:dataTable>

Basically, the pe bean reads people's names and IDs from a database and lists them on the page as links. Clicking on a name should open a new page displaying further details about the person. Basically, I'm trying to pass the person's ID as a parameter to the next page - the pi bean. The pi bean creates a new Person object with the appropriate ID, looks up the ID in the database, sets up the person's details [name, phone, address, etc.]. The next page, PersonInfo, displays those details. In order to pass the ID to the pi bean I wrote a simple function, info(), which basically reads the pID parameter and sets the Person's ID. I associated the commandLink action with that function - action="#{pi.info}".
However, I can't even verify whether that function works all right, because I get weird results. info() returns "success", the way it should, and all the navigation cases are set properly (at least I think so):

  <navigation-rule>
    <from-view-id>/PersonList.jsp</from-view-id>
    <navigation-case>
      <from-outcome>success</from-outcome>
      <to-view-id>/PersonInfo.jsp</to-view-id>
      <redirect/>
    </navigation-case>
  </navigation-rule>

When I click the link, nothing happens. Nought. Nada. If I change the action to action="success", it works.
Does anyone have any idea why?

Any help would be greatly appreciated. Also, I'm open to suggestions, so please do let me know if there are better ways to do the whole thing!

Thanks!
Gaia
[Message sent by forum member 'transcendence' (transcendence)]

http://forums.java.net/jive/thread.jspa?messageID=220239