PDF format is a popular format for sending receipts, email confirmation, and other documentation and we often have a requirement to create PDF documents using Java, mostly in JSP pages. Since most of the official documentation uses PDF format nowadays, it becomes imperative to support PDF files. Recently I received a couple of questions regarding the suggestion of open-source Java PDF libraries, like which is the best open source PDF library in Java or should I use iText or Apache FOP in my Java application for PDF processing. These questions motivates me to write this post. In this article, I will share a couple of Java based open source PDF libraries, both FREE and with some licensing fees, which you can use to generate PDF documents in Java projects.
Ads 970x90
Tampilkan postingan dengan label J2EE. Tampilkan semua postingan
Tampilkan postingan dengan label J2EE. Tampilkan semua postingan
Jumat, 22 Oktober 2021
Selasa, 27 Juli 2021
Difference between ValidatorForm vs ValidatorActionForm in Struts Framework? Example
Struts provide two classes ValidatorForm and ValidatorActionForm for validating form fields. Instead of doing basic validation by using the validate() method in Action class, these classes allows you to leverage rich feature of validation framework provided by Jakarta Struts framework. You can do declarative validation by defining rules in XML config files like validation-rule.xml or validations.xml as well. Since Struts is one of the popular Web MVC frameworks, you can also use its validation framework on any Java web application implemented using Struts. Now, coming back to the question, what is the actual difference between ValidatorForm and ValidatorActionForm in Struts? They both look quite similar, right?
Avoid Using System.exit() on Java Web Application - Best Practice
I have recently come across a code snippet, where the programmer was using System.exit() if the application failed to acquire necessary resources after a couple of retries. His reasoning was that the application cannot function if essential resources like the database are not available or there is no disk space to write records in the File system. Ok, I hear you; but System.exit() in Java Web application, which runs inside either web server or application server, which itself is Java program is not a good idea at all. Why? because invoking System.exit() kills your JVM, invoking this from Tomcat or Jetty, will not only kill your application but the most likely server itself. This can be potentially dangerous if that server also hosts other critical applications, which is not uncommon at all.
How to Export HTML to PDF, CSV, and Excel using Display Tag in JSP? Example
Display tag provides export options to export page into PDF, CSV, Excel, and XML in Java web application written using JSP, Servlet, Struts, or Spring MVC framework. Display tag is a tag library and you just need to use it in your JSP page to display tabular data or generate HTML tables dynamically. Earlier we have seen 10 display tag tips for getting most out of display tag and in this JSP Servlet tutorial we will see one display tag export issue, which prevents display tag export functionality to work properly.
How to Configure HTTPS (SSL) in Tomcat 6 and 7 Java Web Server? Example
Setting SSL (Secure Socket Layer) in Tomcat is often a requirement, especially while developing secure web applications, which requires access over HTTPS protocol. Since the Tomcat web server doesn't provide SSL settings by default, you need to know how to configure SSL in Tomcat, and even worse it varies between different tomcat versions. for Example SSL setup which works on tomcat 6, doesn't work as it is in tomcat 7. In this article, we will see, how to configure tomcat for HTTPS in both tomcat 6 and 7. For those programmers who are not very familiar with SSL and HTTPS here is a quick overview of SSL, certificates and HTTPS, and I suggest reading that article to get a better understanding of How SSL works and How websites are accessed securely over the internet.
How to Split String in JSP? JSTL forTokens Tag Example
JSTL forTokens tag is another tag in core JSTL library to support Iteration or looping. It effectively compliments, more useful <c:forEach> tag, by allowing you to iterate over comma-separated or any delimited String. You can use this tag to split string in JSP and can operate on them individually. forTokens tag has similar attributes like forEach JSTL tag except one more attribute called delims, which specifies delimiter. For example to iterate over colon-separated String "abc:cde:fgh:ijk", delims=":".
Selasa, 22 September 2020
How to setup JNDI Database Connection pool in Tomcat - Spring Tutorial Example
Setting the JNDI Database Connection pool in Spring and Tomcat is pretty easy. Tomcat server documentation gives enough information on how to set up a connection pool in Tomcat 5, 6, 7, 8, or 9. Here we will use Tomcat 7 along with the spring framework for creating a connection pool in the Tomcat server and accessing them in Spring using JNDI code. In our last article, we have seen how to set up a database connection pool in Spring for a core Java application that doesn't run on a web server or application server and doesn't have a managed Java EE container.
Selasa, 25 Februari 2020
Difference between save vs persist and saveOrUpdate in Hibernate
Save vs. saveOrUpdate vs. persist in Hibernate
What is the difference between save and saveOrUpdate or Difference between saving and persist are common interview question in any Hibernate interview, much like the differencebetween get and load method in Hibernate. Hibernate Session class provides a couple of ways to save an object into the database by methods like save, saveOrUpdate, and persist. You can use either save(), saveOrUpdate() or persist() based upon your requirement for persisting objects into the database. The key thing is that all these objects are used to store data into the database but they also make a transient object persistent in Hibernate.