Win a copy of Terraform in Action this week in the Cloud forum!

Jorge Martinez

Ranch Hand
+ Follow
since May 23, 2014
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jorge Martinez

Hy,

Thanks but what I meant was what the advantages are of having calls to business methods inside the view that passing just a model the view(objects); I am not talking here about jsf vs struts; I just refer to this difference.

Thanks
7 years ago
JSF
Hy, really thanks. Some doubts:



1. Maybe I was wrong saying in JSF when from the view you call business methods you are attaching the view with the business logic ; this is not true because you are not implementing the business logic in the view, you are just calling a business method from the view, right?

2. This kind of design, I mean, the MVC pattern type 2, what advantages have?

Thanks
7 years ago
JSF
Hy,

I have been using JSF for a small time. I have reading about the two types of MVC pattern:

1. The controller gets a request from the view and it calls a service and then calls a view passing some model to render.
2. The functions are attached inside the view like JSF does


Questions:

1 . I read that in the MVC pattern the function of the view is to render the model, just that; the view is not aware of the business logic and the bussiness logic is not aware of the view. But when the bussiness functions are called inside the view, the view is aware of the businness logic. Is this not a handicap? I mean, for example if I change the name of some business method I would have to change the name of the method inside the view that uses it

2. What would be the advantages using MVC pattern of type 2 vs MVC pattern of type 1? I dont see them. I see the pattern 2 like if if I call business methods inside the JSP and not from the controller

Thanks



7 years ago
JSF
Hy,

When I have a datatable of primefaces with paginator and its only readable and not editable, its not needed to be inside of a form, right? although I have seen it many times inside of it

Thanks
7 years ago
JSF
Hy,


1. I am doing a dataTable with paginator and the value is getting a list of Car objects already created but I what I have seen when I click on the buttons of the paginator is that is lazy loading the objects, I mean, when I render the xhtml with the datatable, if the attribute "rows" is 2, in the html generated only appears two Car objects and not all so is lazy loading from the client side, not in the server side, right?

2 .To get a lazy loading from the server side you can use for example a LazyDataModel with Primefaces, right?

3 I have done an example with LazyDataModel with Primefaces and the method load from the class LazyDataModel is called once per request and not more than once, I mean, maybe because of this class JSF called the method load only once per request because it knows it will return some calculated value? In the example http://www.primefaces.org/showcase/ui/data/datatable/lazy.xhtml they are not doing any caching

Thanks
7 years ago
JSF
Hy,

Trying to configure a persistence.xml file I have the next doubts:

1)transaction-type="JTA" means the transaction will be managed by an ejb container? What I have read about JTA is the api used to manage distributed transactions but if we just have one database, why do we need to declare transaction-type="JTA" and not just "RESOURCE LOCAL"?

2) Is this possible to have transaction-type="RESOURCE LOCAL" and have the transactions managed by a EJB container?

3) If I have transaction-type="JTA", is it mandatory to have an element of type jta-data-source?

4)Why is mandatory to have transaction-type="JTA" with jta-data-source element?, why are they related and I cannot just specify properties indicating the datasource?

Thanks
Ok. Lets put an example if I get it:

1. When I submit a form and it has validating errors, the reason I see the values filled again is because these values are stored in the view state, right?
2. Is there other case where I could get these values filled again from the view state and not from the backed beans?

Thanks
7 years ago
JSF
Ok, but I havent found an example doing caching with pagination. How can you do that?

Thanks
7 years ago
JSF
Hy,

Viewing this example of pagination http://www.javacodegeeks.com/2012/04/lazy-jsf-primefaces-datatable_11.html and other similar beans for pagination, why do they do these beans view scoped? These beans dont contain any properties for a form so they could be application scoped, right?

Thanks
7 years ago
JSF
Ok. In this example I found http://www.javacodegeeks.com/2012/04/lazy-jsf-primefaces-datatable_11.html the guy is doing real pagination from database but the method load from PlayerLazyList class can be called several times in the same request when the users does some pagination and is not caching at all, right?; this is what I mean; in this kind of case we cannot do any caching at all

Thanks
7 years ago
JSF
Hy,

Many times I have read that JSF stores de view state in session and one of the things that are stored are the values of the form fields, right? But these input field values are not stored in session, I mean, they depend of the scope of the managed bean attached to the view. If I have a view and its attached to a view scoped bean with properties for the form fields, the values will dissapear if I go to other view because the bean is view scoped so I cant say the values of the form are stored in session, right?

Thanks
7 years ago
JSF
Ok, thanks. So if we have pagination from the client because there is some grid, is not possible to cache the results in the next way, right? My question would be how to avoid the repeated calls to getCustomerList() in the same request if we had pagination parameters



Thanks
7 years ago
JSF
Reviewing all the answers rigth now, I got a doubt about caching results from database. The example about caching results from a database is a good one but in many cases you cant do it because you cant get all the customers from database because they are so big so there will be some pagination.

1. Due to the pagination, caching the results from database with pagination parameters from the client is not possible, right?

2. getCustomerList() should be in a application scoped bean?

Thanks
7 years ago
JSF
Hy,

Already solved! I didnt know I had to use <h:head> tag instead of <head> for loading the jquery and so on.

Thanks!
7 years ago
JSF
Hy,

I post the template code:




In the source html code, I dont see any jquery library loaded. I think its the problem, right?


Thanks
7 years ago
JSF