Mano Ag

Ranch Hand
+ Follow
since May 17, 2018
Mano likes ...
Netbeans IDE Java
20+ yrs of Development of Telecom Software, recently taken on Web Applications
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 Mano Ag

Hello Bill,

You can check this part in the documentation for the formatter class:

"For general argument types, the precision is the maximum number of characters to be written to the output."

The meaning of "general" and "precision" is also included in the document.
2 years ago
Congratulations Ahmad!

Oracle has just published the certification path for Java SE 11 if that is of your interest
2 years ago
Hello David,

Welcome to the ranch!

From your post I gather that at the moment your application is running ok.

Regarding the first run solution I'd just point out the idea of "Occam's Razor",
which states that "simpler solutions are more likely to be correct than complex

So, I think, if your application is in the early design iterations, then if it works
it works, regardless if it looks "too simple"
2 years ago

Hello Fred,

I'll try to explain how the view and the backing bean connect in
order to access a property.

If the basics in this post are too basic please mark that as my fault.

The View

An xhtml file is your view. In it you have JSTL (JavaServer Tag
Library) components (from JSP JavaServer Pages), JSF components
(JavaServer Faces) and possibly components from some UI framework
such as PrimeFaces. You can have HTML and CSS as well.

The Backing Bean


Contains the @Named annotation as well as a scope annotation
(if the scope is session, application or conversation then the
class must also implement the Serializable interface). Such a
class is capable of handling CDI (Context and Depencency Injection).
A class with these characteristics is registered as a resource
with the JSF implementation.


Defines the properties and methods that are associated to the
components displayed in one or more views.

A property in this context can be:

- A variable declared in the class as private along with its
 corresponding public getter and setter. Default values can
 be defined in the class constructor

- A property inherited into this class from a parent class

- (If I am not very much mistaken) A property @Inject-ed
 into this class

The Connection

This is where the magic happens. The view and the backing bean
connect when a component attribute accesses a property or method
by means of the EL (Expression Language).

So if you have:

<h:outputText value="#{course.code}"  />

You'd be accessing the code property in the course class
(via the getter)

In the case of:

<h:inputText value="#{}"  />

You'd be accessing the name property in the course class
(via the setter)

This allows you to manipulate course.code and
inside any method in your backing bean.

And that's all there is, with the caveat that attribute names
are misleading as to what they do depending on which component
they appear (yikes!).

Suggested Reading

Learning Suggestion

If you have your database schema defined, you can generate the
"CRUD" for your application and check the code.

2 years ago

Hello Deja,

If egoless programming caught your attention then you might find the following
book (not new but still relevant) interesting, in particular Part VII (Software Craftsmanship)
2 years ago
Welcome to the ranch!

Proof of Concept? Yes we have it.

But would you tell us how you would approach it ?
2 years ago

I think it should not be that difficult.

It may be the simplest question but, do you have a property to connect your view to ?
Once you have that the rest should be easy.

Do you have an explicit or inherited "course"  property in your backing bean?

(by backing bean I mean POJO or Managed Bean or whatever people chooses to call it...
by property I mean a private variable with  its corresponding getter/setter in a class that
uses the @Named and possibly the @ManagedBean and @Serializable annotations)
2 years ago

Hello Peter,

I wonder if the performance to be gained by including conditions for components in your view
is very specific to each view. However, there are a number of component attributes
that work as conditionals, such as "rendered" and "disabled". I don't see any problem with the
ifs either although there is the idea that the view should include a limited amount of

There is no problem in combining components that have different tags (you will see that all
over the place), as long as the functionality you get is what you want.

These are other things that can help you with the performance thing:

- When using data tables, be sure to determine if lazy loading applies or not
- For any information resulting from a query, be sure to try to optimize the query itself

and lastly:

- Get to know the JSF Lifecycle. Being aware of some of its inner workings will save
a big deal of aggravation...

2 years ago
Hi Fred,

Did you try the "Primefaces Showcase" for info?

It might have what you need.
2 years ago
Hello Andrew,

Welcome to the ranch!

Can you post at least a sketch of your code so that your question can be better understood ?

Why does your program use threads?

What does it use them for ?

Why do you need to share information between threads ?
2 years ago

One thing I see is that your getTime() and getTotalTime() both return the same thing...

Including your main method for people to see can help out for figuring out the issue
2 years ago
Hi Glenn,

It might seem a little contrived but it's not if your concepts of
literals and variables are clear.

In your latest post, both instructions have an int literal being assigned to a long variable.

Whenever you use the variable (call it i or x), you have a long variable, even if it contains
a (previously) int value/literal.
2 years ago
Hello Glenn,

Welcome to the ranch!

This is quoted from the Java Language Specification (11) in section 3.10.1 :

An integer literal is of type long if it is suffixed with an ASCII letter L or l (ell); otherwise it is of type int (ยง4.2.1).
The suffix L is preferred, because the letter l (ell) is often hard to distinguish from the digit 1 (one).

2 years ago