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!

Passing parameters from one JSF page to another

843844May 13 2008 — edited May 14 2008
I have a bean which has a managed property named id. I expect this to be passed in, and data will be loaded from a database based on it.
<managed-bean>
        <managed-bean-name>issue</managed-bean-name>
        <managed-bean-class>org.dc949.bugTrack.Issue</managed-bean-class>
        <managed-bean-scope>request</managed-bean-scope>
        <managed-property>
            <property-name>id</property-name>
            <value>#{param.id}</value>
        </managed-property>
    </managed-bean>
When I use this link (from a dataTable), it works flawlessly:
<h:commandLink value="View/Edit" action="editIssue" immediate="true">
    <f:param name="id" value="#{line.id}" />
</h:commandLink>
At this point I'll be at the page where I can edit this issue. It includes a hidden input which holds the issue.id which was passed in. When I click the button to update this entry, it updates without any problem, however when it refreshes the page, the ID is not passed in as a parameter, which means the data isn't loaded. Here's the update button
<h:commandButton id="updateIssue" value="Update" action="#{issue.updateIssue}"/>
and the update method returns and empty string. I want this to reload the current page and pass in issue.id as a parameter named "id" as the commandlink above did. I tried adding an <f:param name="id" value="#{issue.id} /> and <f:attribute value="#{issue.id}" /> with no luck on either one. I've read some other threads here and it sounds like f:attribute is used to pass values from JSF to the backing bean. What I actually want to do is pass a [POST] parameter to the next page. Since all I can return from my action method is a navigation string, I'm not sure how to accomplish this. Suggestions?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 11 2008
Added on May 13 2008
2 comments
826 views