Himai Minh

Ranch Hand
+ Follow
since Jul 29, 2012
Cows and Likes
Cows
Total received
10
In last 30 days
0
Total given
0
Likes
Total received
66
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by Himai Minh

Regarding to my previous posts


I think a form cannot have a f:facet. That is why the heading facet is not displaying.
See this post from stackoverflow: https://stackoverflow.com/questions/24937757/ffacet-not-working-with-hform
2 weeks ago
JSF
One more example I tried is to add a data table to the composite component from the book:


//Index.xhtml that uses the composite login
2 weeks ago
JSF
Hi, what is the difference between composite:renderFacet and composite:insertFacet? I am not very clear even though there is an explanation in stackoverflow.
Let me use an example of Chapter 9 from Core JSF book:

I changed the composite:renderFacet into composite:insertFacet
//login.xhtml

//index.xhtml

If we use renderFacet for the login composite, the heading is displayed.
If use use insertFacet for the login composite, the heading is not displayed.
What is the difference between renderFacet and insertFacet?
2 weeks ago
JSF
Hi,
Is it because your URL to access the index.xhtml has something missing?
It is usually http://localhost:8080/<context-path>/faces/index.xhtml
where <context-path> is defined in the project, usually the name of the project.
2 weeks ago
JSF
Hi, another experiment is to keep track of how many time the save button is click.



The result is that the name is not changed and the increment is changing from 0 to 1 and so on for subsequent run.

If the TableData is session scoped, the increment will change from 0 to 1, 2, 3 and so on.
2 weeks ago
JSF
Another experiment is to make the TableData as a session scoped bean:


After I edited a last name, I hit save button. The request/response life cycle is done. But the TableData bean is still alive. So, the change is stored.
2 weeks ago
JSF
Thanks Tim for the suggestion.
Let me answer my own question based on your advice.
I modified the TableData , so that it uses ArrayDataModel to store the names.




I first edit a last name. When I hit save, the TableData object is not alive after the save is clicked.
The last name change is not in effect. See the following attachment.
2 weeks ago
JSF
So, having a validation error cannot demo the lost of cursor information.
Let me try to dynamically set the names for example in the setNames method, append a number to a last name. Then, increase the number after each request:



What I expect is :
With request scope, the increment value is always 1. The name display is always Dupont1
With session scope, the increment value is always increasing. The name display is Dupont1, Dupont2, Dupont3 after each time the faces servlet is called.
2 weeks ago
JSF
Hi, Tim

As far as losing track of what row you're working on, that was the original point. The cursor information used to do such things is lost when you run in request scope.


Base on my experiments, I think the cursor information is lost when I run in request and session scope.
When the second last name is empty, it cannot be validated.
Then, I click on the third last name and try to edit it. But the last name field is not editable. It looks like the cursor is lost until I fix the second last name.
2 weeks ago
JSF
Hi, Tim.
I did another experiment.
I tried to use both session and request scope TableData bean. I first blank out the second row of last name. Then,  I got an error.
After the error is printed on the browser, I click on the third row of last name. But this row is not editable.
It seems to me that under both scenarios with session/request scope, after the error happens, it forgets which row was selected in the previous request and it cannot select a new row.
2 weeks ago
JSF
Hi, Tim.
This is what I modified. I added id for the table, last name, first name and save button. The last name is required.




In my first run, I define TableData as request scope. In my second run, I define it as session scope.
In the first run using request scope, I first blank out the last name. It gives a validation error. I assume the TableData bean is destroyed. I open another browser to start a new request with a new TableData bean. The last name appears in the second browser because it is a new request.

In the second run using session scope, I first blank out the last name. It also gives me an error. Then, I open a second browser. I assume the same TableData bean is still alive.
The last name appears in the second browser.
But I expect that the last name should disappear in the second browser as the TableData bean is still the same.
2 weeks ago
JSF
Hi,
I tried out an example from Chapter 6 of Core JSF.
The managed bean is a request scope bean, instead of session scope.


This is the index xhtml.


I found out this example works fine. I changed the last name of Anna Keeney to Anna Keeneyi in one request. When I reload the index page again, the change is in effect.
I assume after one request of name change, the name change will be gone after subsequent reload of the page.
Any comments?
3 weeks ago
JSF
Hi, Tim. Thanks for the explanation.
To make sure I understand the explanation.
You mean if we edit a row in a data table and click on the row's submit button, there is a new request object created behind the scene ?
In the case, the request object with the original data is lost?
3 weeks ago
JSF
Hi, I am reading Core JSF 3rd edition chapter 6 datatable, about deleting a name from a data table.




There is a statement in the book :


If the value of a data table has request scope, be sure that the data does not change between the rendering of the table and the decoding of the
response. If the new data set is different, then the wrong row will be processed. If the new data set is empty, then no action takes place at all
because no matching link is encountered.



I don't understand this statement. I think the data , eg Anna Keeney, is rendered and decoded in the same request when Anna Keeney is removed
during the command button is clicked.
Why does it matter to define the Name in session scope or request scope?
For example,  Anna Keeney name object,  is going from lifecycle phrases from restore view through invoke application when the delete button is clicked. Then, it is removed (decoded) from the view when it is in the render phrase. It happens in one single request. Why it should be in a session scope ?
3 weeks ago
JSF
Hi, Tim. Thanks for your explanation.


For example, on inputText, its validator attribute must refer to a Validator object, but converter must refer to a converter method (on a backing bean).


I think it is the other way round :
For example, on inputText, its validator attribute must refer to a Validator method, on the backing bean ,but converter must refer to a converter object 

For example, I use MK Yong's example of validator:




For the example of converter from MK Yong,



4 weeks ago
JSF