facebook

JSF commandLink does not proceed to next page!!!

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #248885 Reply

    azorba
    Member

    Hi,

    The command link in Laliluna tutorial on JSF does not proceed to next page. The action attribute is “editBook”. Have you ever run into this problem?

    Regards

    #248887 Reply

    Riyad Kalla
    Member

    Moving to OT > Soft Dev

    Azorba,
    This could be caused by many different things, try including details for other’s to help you.

    #248917 Reply

    azorba
    Member

    The JSF tutorial has a List page and a Edit page. Except for the Delete command link which is working since the navigation stays on the List page, the other two command links Edit and Add do not proceed to the Edit page. The server console and web browser do not show any errors.

    Environment: JSF 1.1, JDK 1.4, MyEclipse trial
    Beans and 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”&gt;

    <faces-config>

    <!– Navigation rules –>
    <navigation-rule>
    <description>List of books</description>
    <from-view-id>/listBooks.jsp</from-view-id>
    <navigation-case>
    <from-outcome>editBook</from-outcome>
    <to-view-id>/editBook.jsp</to-view-id>
    <redirect />
    </navigation-case>
    </navigation-rule>

    <navigation-rule>
    <description>Add or edit a book</description>
    <from-view-id>/editBook.jsp</from-view-id>
    <navigation-case>
    <from-outcome>listBooks</from-outcome>
    <to-view-id>/listBooks.jsp</to-view-id>
    <redirect/>
    </navigation-case>
    </navigation-rule>

    <!– Managed beans –>
    <managed-bean>
    <description>Book bean</description>
    <managed-bean-name>bookBean</managed-bean-name>
    <managed-bean-class>de.laliluna.tutorial.library.Book</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>

    <managed-bean>
    <description>
    BookList Bean
    </description>
    <managed-bean-name>bookListBean</managed-bean-name>
    <managed-bean-class>de.laliluna.tutorial.library.BookList</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>

    </faces-config>

    Edit Command Link:
    <h:commandLink id=”Edit” action=”editBook” actionListener=”#{bookBean.selectBook}”>
    <h:outputText value=”Edit” />
    <f:param id=”editId” name=”id” value=”#{book.id}” />
    </h:commandLink>

    Add Command Link:

    <h:commandLink id=”Add” action=”editBook” actionListener=”#{bookBean.initBook}”>
    <h:outputText value=”Add a book” />
    </h:commandLink>

    Regards,

    #248918 Reply

    Riyad Kalla
    Member

    I could be wrong, but I thought having both an action and an actionListener was redundant. The action can be mapped by the controller to a navigation-case in your faces-config, but the actionListener is a direct assignment to a method to handle the link being clicked, try defining one or the other.

    Like I said, I could be wrong and just misunderstand this part of JSF.

    #248925 Reply

    azorba
    Member

    Combination of action method and action listener method should be ok. Following you suggestion, I’ve tried to define one method only; still it does not work.

    #248945 Reply

    Riyad Kalla
    Member

    Hmm, have you tried emailing Sebastian? (the author of the tutorial)

    #266763 Reply

    ailslia
    Member

    This can be a spelling problem or a validation or conversation error, that is not displayed, because there is no <h:messages /> component on your page.

    Keep in mind the jsf life cycles, the submit method is called during the Invoke Application phase. This phase is not reached if there is a validation or conversation issue.
    Checklist:

    * Add a <h:messages /> component to your userForm.jsp in order to see if there are any errors.
    * Verify the spelling of the outcomes (“success”, “cancel”) in your navigation rules and in your action method.
    * Verify the spelling of your bean in the definition as a managed bean in the faces-config.xml file and in userForm.jsp.
    * Verify the name of your action method, in the userForm.jsp and in the backing bean.
    * Check by logging if the action method is ever reached.
    * Use the jsf tracker to print out the life cycles phase: http://www.jsftutorials.net/faces-config/phaseTracker.html
    * You must create getters *and* setters for *all* bean properties even if they are considered as read-only.
    From: http://www.jsf-faq.com/faqs/faces-navigation.html

    I have the same problem… and tried all the steps above.

    #266764 Reply

    ailslia
    Member

    This can be a spelling problem or a validation or conversation error, that is not displayed, because there is no <h:messages /> component on your page.

    Keep in mind the jsf life cycles, the submit method is called during the Invoke Application phase. This phase is not reached if there is a validation or conversation issue.
    Checklist:

    * Add a <h:messages /> component to your userForm.jsp in order to see if there are any errors.
    * Verify the spelling of the outcomes (“success”, “cancel”) in your navigation rules and in your action method.
    * Verify the spelling of your bean in the definition as a managed bean in the faces-config.xml file and in userForm.jsp.
    * Verify the name of your action method, in the userForm.jsp and in the backing bean.
    * Check by logging if the action method is ever reached.
    * Use the jsf tracker to print out the life cycles phase: http://www.jsftutorials.net/faces-config/phaseTracker.html
    * You must create getters *and* setters for *all* bean properties even if they are considered as read-only.
    From: http://www.jsf-faq.com/faqs/faces-navigation.html

    I have the same problem… and tried all the steps above and still the problem persists. 🙁

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: JSF commandLink does not proceed to next page!!!

You must be logged in to post in the forum log in