Posts

Showing posts with the label J2EE

Difference between JAX-RS, Restlet, Jersey, RESTEasy, and Apache CXF Frameworks

The JAX-RS is a Java specification request (JSR 311 & JSR 339) which standardize development and deployment of RESTful web services using Java and JEE technologies. It provides API in Java Programming language to create web services according to the REST (Representational State Transfer) architectural pattern. Both Restlet and Jersey are two of the most popular implementation of JAX-RS used for developing RESTful web services in Java ecosystem but there are a couple of other implementation also exist e.g. Apache Wink, Apache CXF, and JBoss RESTEasy. In this article, I'll introduce with these RESTful web services framework in Java world. It's not a very detailed post about strength and weakness of each of the framework but will just give you enough to understand them in detail later. Read more �

What is purpose of different HTTP Request Types in RESTful Web Service?

RESTful web services heavily rely on HTTP by design. They use different HTTP methods to perform their job and uses HTTP response code to inform clients about success or failure of a particular request. REST stands for Representational State transfer and it uses HTTP to allow two systems to communicate via remote calls. RESTFul web services is a collection of REST URI which points to resources. These URI can point to a single resource of a collection of resource. For example, you would expect /employee/101 to contain details employee with 101 and /employees to return a list of all employees. In RESTFul web service, HTTP request types signify the action to take for the resource. Read more �

5 JSTL Core IF Tag Examples in JSP - Tutorial

<c:if> or if tag of JSTL core tag library in JSP is one of the most versatile and useful tag. JSTL if tag allows you to test for a condition, like checking for a particular parameter in requestScope , sessionScope or pageScope . You can also check any parameter in request parameters and headers or can check for a variable in JSP page using <c:if> tag. JSTL if tag helps a lot to reduce amount of Java code from JSP page and if used, along with expression language JSTL core tag library, can remove almost all Java code from JSP files. Earlier we have seen examples o f JSTL foreach tag and JSTL core set tag an d this JSP JSTL tutorial is based on if tag of JSTL core tag library. We will, see how to use <core:if> tag inside JSP files and different example of <core:if> tag to get ourselves familiar with functionality and power offered by JSTL <c:if> tag. After seeing these examples of <core:if> tag along with expression language, You will be amazed...

Display Tag Export Example in JSP � Issue Fix Java Tutorial

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 se en 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 prevent display tag export functionality to work properly. Display tag experience is considered good in variou s JSP Interview and some questions related to sorting, paging, both internal paging and external paging and exporting on display tag also appear as various J2EE and Servlet Interview questions . In my opinion, after JSTL core tag library , d isplay tag is most popular tag library and every Servlet and JSP developer should familiar with display tag. Read more �

How to setup JNDI Database Connection pool in Tomcat - Spring Tutorial Example

Setting JNDI Database Connection pool in Spring and Tomcat is pretty easy. Tomcat server documentation gives enough information on how to setup connection pool in Tomcat 5, 6 or 7. Here we will use Tomcat 7 along with spring framework for creating a connection pool in Tomcat server and accessing them in Spring using JNDI code. In our last article, we have seen how to setup database connection pool in Spring for core Java application which doesn't run on web server or application server and doesn't have managed J2EE container. but if you are developing web application than its better to use s erver managed connection pool and access them using JNDI. Spring configuration will be generic and just based on JNDI name of Datasource so it will work on any J2EE Server e.g. glassfish , WebLogic , JBoss or WebSphere until JNDI name is same. Tomcat is my favorite web server and I use it a lot on development and its comes integrated with IDE like Eclipse and Netbeans. I am using it for ...

ThreadLocal Memory Leak in Java web application - Tomcat

ThreadLocal variables are infamous for creating memory leaks. A memory leak in Java is amount of memory hold by object which are not in use and should have been garbage collected, but because of unintended strong references, they still live in Java heap space . There are many ways memory leak can be caused in Java but when this memory leak is caused due to ThreadLocal variable, it�s refereed as ThreadLocal memory leak. In our last post about ThreadLocal variable, we have seen How ThreadLocal variable can make SimpleDateFormat thread-safe and also raised point that in managed environment like J2EE application server or web server like Tomcat , Jetty , WebSphere or Weblogic use of ThreadLocal should be avoided. In this post we will go little deep and find out How ThreadLocal variables creates memory leak in Java web application, much like we have seen How to fix PermGen memory leak in Tomcat . If you are not familiar with ThreadLocal variables I suggest to go through my previous po...

Difference between save vs persist and saveOrUpdate in Hibernate

Save vs saveOrUpdate vs persist in Hibernate What is difference between save and saveOrUpdate or Difference between save and persist are common interview question in any Hibernate interview, much like Difference between get and load method in Hibernate . Hibernate Session class provides couple of ways to save object into database by methods like save , saveOrUpdate and persist . You can use either save() , saveOrUpdate() or persist() based upon your requirement for persisting object into Database . Along with Spring framework Interview questions , Hibernate questions are also quite popular on J2EE interviews because of its status as leading ORM. It�s good to prepare some questions from Hibernate before appearing in any J2EE interviews . One of them is Difference between save , saveOrUpdate and persist , which we will see in this Hibernate article. Read more �