• Post Reply Bookmark Topic Watch Topic
  • New Topic

Displaying data without forms/actions etc..

 
Sloan Bowman
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all I am a Struts user trying to create a new project in JSF to see if this is something I will want to use. My question is simple but for some reason I can't find the logic on how to do this in JSF. I want to create a page lets say called viewAllSalesman.jsp that when viewed will dispaly all of the current salesman in the database. I already have all of the EJB setup on the backup to handle this but cannot figure out how to simple create a page that calls a method of the management bean without using forms? Another thing how do i get request parameters to use them in the queries? For example viewSalesman.jsf?id=293 and this would show me the details of the salesman with the id of 293. I haven't figured out how to do this in JSF. Any help would be greatly appreciated. To me it seems JSF is all event driven therefor normal request do not work properly unless submitted by a form.

Thanks,
SB
 
Sergey Smirnov
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The keyword here is DataModel. If you use it with hataTable, you have no reason to carry about request parameters and other lower-level programming stuff that you use in Struts.
There is a good recent article about some architectural issue:
http://blog.exadel.com/?p=8
It uses the hibernate originaly to explain the idea, but I hope, it will not be hard to use replace the hibernate part with ejb part.

The second half of the following atricle also descrides in details how DatoModel works with dataTable:
http://www-128.ibm.com/developerworks/java/library/j-jsf2/

--
Sergey : jsfTutorials.net
[ July 14, 2005: Message edited by: Sergey Smirnov ]
 
Sloan Bowman
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes I agree to an extent but not everything is going to be used in a table. For example I may want to look up several different aspects for one page and displaythem however I see fit. In this case performing an action (model) to then go out and get the data I need from my EJB's and place them in properties is what I need. Are you saying that its not possible to do what I am looking for with JSF. I simply want the ability to type in http://domain.com/viewAllSalesman.faces and have it look up the data and display it for me without having to use a commandLink or anytype of form information.
 
Sergey Smirnov
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you saying that its not possible to do what I am looking for with JSF

No. I did not mean it. I meant you were looking to a wrong direction in this particular case.
If you have a viewAllSalesman.faces page with a table of salesmen and want to click on one of the row and show the details for salesman on the viewSalesman.faces, you do not have to pass parameter such as id=293, because using the dataModel you already know the clicked row on the server side with getRowData() method.

In any other scenario where you have no data table you are clicking on, it is possible to retrieve the data by viewSalesman.faces?id=293 also . id is passed with #{param} variable. You can initialize one of the backing bean property with #{param.id} in the faces-config.xml and then use it to show the details of the salesman with this id.

--
Sergey : jsfTutorials.net
[ July 15, 2005: Message edited by: Sergey Smirnov ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!