Categories Java

How to Create a Task(or Cron Job) in Tomcat Example

To do this you can take advantage of schedulers such us quartz, but it you don't need anything as powerful as that you can create a new thread that starts when the server starts.... Read More

Use project as dependency of a web Project in Eclipse

With Eclipse you can use a source project and compile directly into a web project. Every time you change your dependency project a new Jar will be stored in your web project build path. This is very convenient if you are developing libraries for web projects.... Read More

Java Eclipse Insert and Read Utf-8 in Mysql Example

In most cases trouble happens because not everything is coded with UTF-8 or we are not doing the transcoding properly. We must tell MySQL how to store, send or receive the Unicode Transformation Format - 8 bit (UTF-8).  The easiest way to avoid any trouble is by setting everything to UTF-8.... Read More

Java Pdf to Tiff Example

This example uses the ICEpdf open source library to read a PDF and turn it into TIFF images.... Read More

Java JSP Examples to Display Thread Status.

Sometimes it's useful to know that is some threads status. I normally use JConsole to monitor but if you can't use this technology and you need to know what is going on with the threads an easy trick is to upload a JSP to the server. Here are some good examples for that.... Read More

Java NIO Server Example (Asynchronous Bidirectional)

I needed to create a server for up to 1000 concurrent users. Using a single-threaded-per-socket connection was taking too much CPU and memory. NIO is supposed to increase your latency but it wasn't too much in my case.... Read More

Java Sockets Performance Test Example (Asynchronous Bidirectional)

I was asked to develop a socket service that could send and receive requests asynchronously. The service was meant to cope with up to 300 concurrent users and up to send/receive 50/100 messages per second.... Read More

How to remove the blank line in JSP left by the directive

The blank line after JSP directive issue has been tackled from JSP 2.1 version and above. To sort this thing out just set the property trimDirectiveWhitespaces="true" which is set to false by default.... Read More

How to print all elements in a Map

To get just the key... Read More

How to Put all the values of a resultset to a bean with BeanProcesor

BeanProcesor is an Apache API that helps us copy all the values from a Resultset to a bean. It uses reflection and unless you need an extremely optimal code it highly recommended to uses because it reduces development time.... Read More