Category Archives: Java

Annotation basics in Java

Annotations are a kind of metadata attached to various parts of the source code in Java. Although they do not directly affect how the code works, they are processed and used by different tools to provide additional functionality or services … Continue reading

Posted in Java | Tagged | 1 Comment

Facelets ui:repeat tag

Facelets ui:repeat tag can be used as a substitute of h:dataTable tag from JSF HTML library or c:forEach tag from JSTL core library. While using h:dataTable tag is still the preferred method to create tables, ui:repeat tag gives developer more … Continue reading

Posted in Java, Java EE, JSF | Tagged , , , | Leave a comment

Data tables in JSF

Data table is one of the most advanced UI components provided by JSF. This component is used to represent data in a table form and can contain multiple rows and columns and optionally header, footer and caption. In this post … Continue reading

Posted in Java, Java EE, JSF | Tagged , , , , | 4 Comments

Parameterized unit tests in JUnit

Sometimes you may want to execute a series of tests which differ only by input values and expected results. Instead of writing each test separately, it is much better to abstract the actual tests into a single class and provide … Continue reading

Posted in Java, Software development practices | Tagged , , | 2 Comments

Evaluating postfix expressions

The standard notation used to represent mathematical expressions is called infix notation. You should be very familiar with it already because it is almost exclusively used in books and thought in schools. Just to be clear, the typical example of … Continue reading

Posted in Algorithms, Java | Tagged , | 3 Comments

Custom bean validation constraints

Bean Validation API defines several built-in constraint annotations which are very useful in many situations. However, there are still some cases where these standard constraints are not enough and you have to create your own custom constraint. With Bean Validation … Continue reading

Posted in Java, Java EE, Spring | Tagged , , , | 4 Comments

Common exception misuses in Java (and not only)

Exceptions were introduced in many programming languages as a standard method to report and handle errors. If you have ever used functions that return special values (usually -1 or NULL) to indicate an error, you should know how easy it is … Continue reading

Posted in Java, Software development practices | Tagged , | 7 Comments

Views in Java Collections Framework

View in Java Collections Framework is a lightweight object which implements Collection or Map interface but is not a real collection in a traditional sense. In fact, view does store objects inside but references another collection, array or a single … Continue reading

Posted in Java | Tagged , | 1 Comment

Validating HTML forms in Spring using Bean Validation

Validating input is a crucial part to ensure data integrity and proper function of the whole application. JSR-303 also known as Bean Validation is a very convenient way to perform such validation at different levels of the application. In this … Continue reading

Posted in Java, Spring | Tagged , , | 4 Comments

Using JPA and JTA with Spring

When building a web application, we will sooner or later need to somehow store data entered by users and retrieve it later. In most cases the best place to keep this data is a database because it additionally provides many … Continue reading

Posted in Java, Java EE, JPA, JTA, Spring | Tagged , , , , , , | 15 Comments