0

I'm creating a web application. I have to list entries from database, with an additional column containing a link to edit the entry. I know how to view a table listing all the entries from the database using managed beans. My question is--how do I only show data relating to one entry on a separate page?

My link looks like that:

<h:commandLink value="Edit" action="#{searchOrdersBean.editThisOrder(order.orderNum)}">

And the called method:

public String editThisOrder(int id){

        porder = purchaseOrderFacade.findByOrderNum(id);

        return "edit";

    }

But I don't know how to display the data of this single result.

shi
  • 1
  • 1
  • Just `#{searchOrdersBean.porder}`? Regardless, is this acceptable as dupe? http://stackoverflow.com/q/8459903/ – BalusC Sep 15 '15 at 21:16
  • Thank you, and also for the link. A quick follow up, if I may, as I don't see it answered in the other topic--does it mean I don't need a separate bean class for edits? And in this case, should I add all the relevant database fields to the bean class I'm using now (I only have a PurchaseOrder object and List now). – shi Sep 15 '15 at 21:25
  • Why do you want to duplicate the model in the controller? – BalusC Sep 16 '15 at 07:20
  • Nonetheless, read the "See also" links there for more answers/guidelines on related matters. And the "See also" links in there. And the "See also" links in there. Etc. Every related question you can think of is answered in those "See also" links I consequently try to put in bottom of an answer. – BalusC Sep 16 '15 at 08:08

0 Answers0