Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6986535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:49:18+00:00 2026-05-27T18:49:18+00:00

I have a table of Items, and in each row there is a link

  • 0

I have a table of Items, and in each row there is a link that forwards to the edit item page. To load data in the edit page I need the managed bean in request scope (if I put it in view scope I loose data in the forward).

To use ajax in the edit page I need the managed bean in view Scope due to some values I must keep. If I were working with JSF 1.0 and RichFaces I would do it with request scope and a4j:keepalive.

How do I get this funcionality with PrimeFaces and JSF 2.0 or how can I redefine the interface to get this?

Ok, finally based on the post below this is what worked for me:
CommandButton in the Items table:

<o:commandButton id="editButton"
action="#{itemTableMB.editItem(item.id)}" styleClass="botonTabla">
<h:graphicImage styleClass="imagenBotonTabla" url="/resources/images/icons/pencil.png"/>  
</o:commandButton> 

Action in the managed bean:

public String editItem(Integer id){
return "/pages/items/edit.xhtml?faces-redirect=true&id="+id;
}

edit.xhtml:

<f:metadata>
  <f:viewParam id="id" name="id" value="#{itemMB.item.id}"    required="true">
  </f:viewParam>
  <f:event type="preRenderView" listener="#{itemMB.loadItem}" />
</f:metadata> 

Listener in itemMB:

public void loadItem(){
      this.item = this.itemManager.get(this.item.getId());
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T18:49:19+00:00Added an answer on May 27, 2026 at 6:49 pm

    To load data in the edit page I need the managed bean in Request scope (If I put it in view scope I loose data in the forward).

    Are you using a navigation rule (or implicit navigation) without a redirect?

    One solution would be to put backing beans of both the “table of items”-page and the “edit item”-page in view scope, and then go from the first to the second one directly via a GET request (e.g. using <h:link>) or a POST/redirect with a request parameter representing the row on which the user clicked.

    Use <f:viewParam> on the second page to conveniently convert the request parameter back to an entity representing the item being edited.

    If you were indeed using navigation without redirect, then this has the additional benefit that you won’t suffer from the notorious ‘one-URL-behind-problem’, which can be rather confusing to users of your application and be a nightmare for support.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Imagine you have a normal table view where each row is an item on
I have a table full of items that each have a unique ItemID .
I have here a list of items in a table. Each item has a
i have an html page where i have a table of items (one item
I have a simple table structure where each item row has a status. What
I have a table of items by date (each row is a new date).
I have a table of items that are each individually associated with a category
I have a list of items in an html table. On each row (tr)
hi i have a table with couple of rows and each row there is
I have a html table with form elements in each row to add items,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.