Passion of IT

Spring MVC Vs JSF

There most important front end frameworks of J2EE are Spring MVC and JSF.

JSF: Java Server Facets

JSF in my opinion is the most used front end framework because it is easy and stable: you can make a very complex and secure web application  in few time using it.

This framework has the principal component called “portlet

each portlet is independent by the others for this reason this framework is scalable and easy to maintaining.

each portlet has the following files:

  • Session bean with all the data necessary to run the page
  • Request bean with all the operation and the action that the user can do
  • JSP and XHTML file that shows the result
  • Property file with the labels or db connections etc

The defect of this framework is that stores everything in session so it stores everything in ram jvm memory of the server.

This is a huge problem because the RAM of the java virtual machine of the server is expensive.

when the RAM memory of the server is full the server shows an “memory out of bound exception” and it is necessary to restart the server.

 

The second problem of JSF is the conversion of HTML tags:

JSF uses particular tags, each tag has a class that performs the operation, here is a small list of jsf tags

when you insert the tag <h:form></h:form> and you see the page rendered, this tag is converted in <form action=”"></form>

The conversion of tags is performed to simplify the operation of writing code: it is easiest to write JSF tags and they are rendered in html tags but it is a problem when you want to integrate the page with a special javascript or jquery component:

For example it is very difficult to integrate a jquery slider component with JSF because the slider requires a particular div sequence that are difficult to produce using JSF tags

JSF is easy to use, is stable, scalable, easy to maintenance and each page is independent from the others and requires a lot of jvm memory of the server and also it is difficult to integrate with javascript, jquery, bootstrap component

My  web application affittavetrina is developed using JSF for this reason it is expensive and unuseful because when there are connect a lot of people it might occurs the java memory out of bound exception but in the past  days I didn’t knew Spring model and view

 

Spring MVC

is in my opinion the best framework to make web application, it has the following characteristics:

  • Client (view): the client is a simple JSP file written in html language with special tags (JSTL javascript tag language) and other tags for example the property like jsf for the internationalization. It is fully compatible with all component like jquery, javascript, ecc
  •  Controller: Spring beans that allow to communicate via rest with htmlServletRequest and htmlServletResponse and you can set the information that you need in  session.
  • Model you can choose a web services or another rest services etc.

The client with for example a jquery ajax component can send a rest request with the selection of url, methode (get, post) this request is processed by  server that sends the response to the client

Spring MVC is more complex than JSF because it is necessary to develop everything from the scratch, but requires less JVM memory (you can store in session only the information that you need) and it is fully customizable.

it is less stable and less maintainable because the jsp page written in html is more complex then the page written in jsf tags

Today I made a small project in Spring MVC to store a complex object in session and to read it. Another example is to pass this object in post and in get to the controller and to read it, I tested also the internationalization that runs correctly.

 

 

Conclusion

JSF: I don’t know what is the way that the framework uses to call the action written in the request bean but when I specify the method of the bean that I need to call when the user clicks on button, the application runs. It is easy and less customizable and saves everything in session (ram memory of the server)

Spring MVC: I can choose the way to comunicate with bean (http get, http put, rest web service etc) it is fully customizable but requires more time to write code and it is easy to make a mistake and the code written in Spring MVC is more complex to understand than JSF

 

No Comments Yet

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite="
"> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Recent Comments

Michele Rizzithe website doesn't exist. Ara you a robot? In any case it's difficult that an automatic system writes a comment here since there are two captchas...
Hello there! This is kind of off topic but I need some guidance from an established blog. Is it very hard to set up your own blog? I'm not very t...
We are a group of volunteers and opening a new scheme in our community. Your web site offered us with valuable information to work on. You've done a...
April 2024
M T W T F S S
« Dec    
1234567
891011121314
15161718192021
22232425262728
2930  

Login