Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!

Himai Minh

Ranch Hand
+ Follow
since Jul 29, 2012
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Himai Minh

What is the difference between NoneScoped and RequestScoped?
According to Stackoverflow's comments, a none scoped bean lives as long as the EL expression is evaluated. But when the none scoped bean's EL expression is evaluated in one request/response, it has already gone through the lifecycle such as restore view, apply request, process validation, update model, invoke application , render response.
And a request scoped bean has to go through all the cycle in one request/response.
1 week ago
I recently ran an example (

There is a resources/util/panelBox.css in the root directory.
The composite is displayed, but the style in panelBox is not.
2 weeks ago
Hi, I am running the cdiviewscope example developed by Michael  Kurz at
I used JDK 1.8 and Glass fish 4.1.

Glassfish gives me this error when the jsf application is deployed:

cannot Deploy cdiviewscope
deploy is failing=Error occurred during deployment: Exception while loading the app : CDI deployment failure:WELD-001408: Unsatisfied dependencies for type PersonRepository with qualifiers @Default
  at injection point [BackedAnnotatedField] @Inject private at.jsflive.jsf22.cdiviewscope.PersonPage.personRepository
  at at.jsflive.jsf22.cdiviewscope.PersonPage.personRepository(
. Please see server.log for more details.

3 weeks ago
But the problem is that in the Next.xhtml, bar = #{} does not do anything.
I have to put bar = #{} to make it work.
1 month ago
In the API of javax.faces.context.Flash (, it says:

  First page

    <h:button id="nextButton" value="Next (button)" outcome="next.xhtml">
      <f:param name="foo" value="bar"/>

    Next page

    <html xmlns=""
      <f:viewParam name="foo" id="foo" value="#{}" />
    <head /><body>
    foo = #{}

I think the Next page should have instead.
When I ran this Next page, it does not print #{} on the screen.
1 month ago
Hi, Tim.
Thanks for your suggestion. I just simply remove the index from the array without recreating a new ArrayList. It works on my side.

The reason why I don't use nameDataModel to remove because ListDataModel class does not have remove method.
1 month ago
Hi, Tim. Thanks for your suggestion.
I need to convert the Name[] into ArrayList<Name> in order to remove the selected index.
The code is:

The index.xhtml:
1 month ago
Thanks for your explanation.
I modify the chapter 6 delete example in Core JSF.

In index.xhtml, we can click on the Delete link to delete one name at a time

1 month ago
Hi, I just notice ArrayDataModel does not have remove method. So, what should we do if we want to remove elements in ArrayDataModel?
This is an example of the Core JSF :

If we have and we wrap it in ArrayDataModel like this:

How can we remove a name from the data model since there is no remove method in ArrayDataModel?

2 months ago
I tried this example with <!-- <hutputText value="#{user.amount}" /-->, where amount >10.00
The exception is thrown after the restore view phrase and before the render response phrase:

2018-03-21T20:06:08.063-0400|Info: AFTER RESTORE_VIEW 1
2018-03-21T20:06:08.068-0400|Info: BEFORE RENDER_RESPONSE 6
javax.el.ELException: java.lang.RuntimeException: Invalid amount :11.0
Caused by: java.lang.RuntimeException: Invalid amount :11.0
at com.corejsf.User.getAmount(
2018-03-21T20:06:09.035-0400|Info: AFTER RENDER_RESPONSE 6

But if the user.amount is <10.00, the output is not  displayed and  the console printout is:

2018-03-21T20:14:07.503-0400|Info: AFTER RESTORE_VIEW 1
2018-03-21T20:14:07.509-0400|Info: BEFORE RENDER_RESPONSE 6
2018-03-21T20:14:08.671-0400|Info: AFTER RENDER_RESPONSE 6

So,  in <!--<hutputText value="11.0"> -->,
you mean there is an exception thrown in the apply request phrase, the response is completed. And the response is the exception.
But in <!--<hutputText value = "5.0"> --> ,
there is no exception thrown in the apply request phrase, the response is rendered. But since the response is commented out, it is not display.

Correct me if I am wrong.
Hi, I am just curious why the exception is displayed on the screen even though the outputText is commented out while the value is not displayed in this case ?
For example, if the value is 5.0 after JSF processed the expression, it is not displayed because of <!-- -->.
But if the value is 11.00 after the JSF throws the exception, the exception is still displayed even though the outputText has <!-- -->.
Why the exception is printed?
Hi, Prasad,
I tried your nice example about the amount > 10.0.
If the amount > 10.0, it throws the exception even though with the output text commented out in XML <!-- <hutputText value="#{user.amount} ... -->
But if the amount is not 10.0, it does not display anything with <!-- -->
So, does it mean the outputText is processed or not  with <!-- -->?
Here is a tip :
If we have this:

The data table won't be displayed because the ui:composition trim everything outside it. Since the data table is outside ui:composition, the table won't be display.
Only whatever inside ui:composition is displayed. In this case, it does not  "see" the #{address} variable, so it does not show the address.

I think comment out is important for this exam.
To comment out a statement in xhtml, <!-- --> is used. Also do one of these:
1. In web.xml, add this context param:

2. <ui:remove> ... something you want to comment out</ui:remove>

Without one of these, <!-- comments --> still appears in the generated html even though the comment is not displayed in the xhtml.