1

What does it mean this sentence :
With a component based MVC framework you don't need to write much code yourself. However you have less fine grained control over the process and the HTML/CSS/JS output.

Can you give me a real example ?

Hayi
  • 6,972
  • 26
  • 80
  • 139

1 Answers1

1

That sentence you quoted is very generic and probably said by some people who don't have lot of experience in component based frameworks at all. The aim of a component based framework is to provide you with some pre-built components to avoid having to implement HTML code and its binding to server side by yourself everytime you have a requirement. In case of JSF this is done by a Java Servlet which converts JSF's own code to HTML at server side.

That components are by default customizable by specifying some attributes in their declaration, i.e. you can look at all the attributes h:selectOneMenu provides to you in order to customize its behaviour. If a component still doesn't meet your requirements at all, you always have the option of implementing your own one.

You can also add JS behaviour and CSS styles to your components, don't forget all the framework does is converting its own tags into plain HTML code which can be understood by the browser. As JS and CSS are applied at client side, you could attach them also to the created components. I think in this case what you're getting confused about is the use of third party component libraries, as Primefaces or Richfaces could be for JSF. This libraries have their own components which also add JS-JQuery behaviour and CSS styles. They'll probably cover most of the cases for your application, but even if you need a more specified solution you always have the choice to do by your own.

See also: Creating Custom UI Components and Other Custom Objects

Aritz
  • 30,971
  • 16
  • 136
  • 217
  • thanks for this explication but can you advise me i'm good at java, css and js, so i use component or action based MVC framework ? – Hayi Dec 24 '13 at 15:38
  • JSF itself could be considered as action based, as different actions direct to different views. If you want to decide between JSF and spring MVC for example, I can't decide for you, as it depends on your experience and learning curve. Haven't myself never done spring MVC! – Aritz Dec 24 '13 at 22:08
  • Can we consider JSF as action-based, as 'different actions direct to different views' ? http://stackoverflow.com/questions/9015378/component-base-mvc-framework-and-action-based-mvc-framework?rq=1 – Ahamed Mustafa M Dec 25 '13 at 09:50
  • @AhamedMustafaM Obviously it depends on what you consider to be 'action based'. JSF has a workflow based on user-executed actions. It could be compared with Struts, where a performed action also results in a forward. Having used both of them, JSF is for me in both 1.x and 2.x branches further much more simpler to use, specially latest versions. – Aritz Dec 25 '13 at 13:25
  • In addition to all of this, a framework doesn't need to stick to be component based, action based or request based. JSF, to give an example, could be all of them if properly configured. The point of using JSF over Spring MVC is that JSF allows you to choose an state for every single bean you use. Spring MVC is more request-oriented (doesn't have anything as `@ViewScoped` out of the box, AFAIK). Also we have to mention the JSF specific third party libraries as Primefaces. On the other hand, Spring MVC provides full integration with the Spring framework, while JSF doesn't. – Aritz Dec 25 '13 at 18:10