Query Based Java Components

I recently asked in an interview - In java, how do you compare component-based fundamentals for framework-based queries? I explained to EJB as an example of a component-based framework and Struts as a query-based framework, but was not convinced if I answered this question.

Any ideas on what the interviewer had in mind and what should compare

Regards, avajurug

+46
java frameworks struts components ejb
Aug 08 '09 at 0:44
source share
4 answers

Most likely, they looked for examples of web frameworks - for example, JSF is a component-based infrastructure, and Struts is a query-based structure.

Query-based frameworks usually make it clear through their APIs that they work with parsing an HTML request / generating an HTML response, while component-based frameworks try to distract this and treat the application as collections of components by rendering and acting to do something.

In my opinion, component-based web frameworks are more of a problem than they are - their main goal is to simplify the development of a web application for developers unfamiliar with web development, and closer to traditional desktop development. However in practice, when something goes wrong, you need to develop custom components, you need to set up a framework for something that is not out of the box, etc. You need to understand how basic "traditional" web development and as an abstract structure based on components - and if you are an experienced web developer and have existing solutions, utilities, libraries or fragments that worked in "traditional" web development, you will spend time to reintroduce them to work within a component-based infrastructure.

+78
Aug 08 '09 at 1:38
source share
β€” -

A query-based framework is a web infrastructure that receives a user’s request and then determines what the system should do and return a response to the user. So the flow is pretty linear. You think about the actions: what the user wants (request) β†’ which user will receive the answer (response). An example of a query-based structure is Struts . Modern Grails is heavily based on a query-based framework.

Component-based infrastructure is different. Actually there is no clear idea of ​​the flow from front to back. An example of this is not JSF, because in a sense, JSF is pretty much like Struts (since the creator of Struts and JSF is the same). A good example of a platform based on Tapestry and Wicket components . The paradigm in these two frameworks is different. You do not think in actions or request-response, but about components and components. You define a component in your application and indicate what that component does. But the flow should not be linear, as in a query-based database.

+23
Aug 08 '09 at 13:47
source share

JSF is a component-based java interface, since Nate, Struts is an action-based infrastructure, Http requests are parsed during action processing, after all, the servlet passes the request to the JSP, which will be responsible for creating the response. Although in JSF, which has become the standard for component-based web frameworks, there really is no need to handle requests and responses, because all we need to do is write JSP or XHTML pages, bind the components used on the page, or the value that they must display beans or managed beans for properties in the background, and the FacesServlet (controller) does all the work of handling the request processing and redirecting to the JSP, which will display the response based on the navigation rules specified in faces-config.xml. So you see that there is a big difference between Struts and JSF, because JSF uses a component-based approach, and Struts is closer to the classic JSP / Servlet model. Another thing is that jpartogi said that the creator of JSF and struts are the same, I just want to mention that Struts is a framework belonging to the Apache community, and JSF is the API specified by JCP in JSR-127 for versions 1.1 and JSR- 252 for version 1.2 and has different implementations (SUN-RI, Apache MyFaces ...)

+5
Nov 24 '09 at 11:14
source share

Simply, if the structure has objects in the java side for each web element, so you can change its attributes or add some functions, this is a component-based environment, but if the environment does not provide objects, and you must specify the response value of the web element between its tags is a query-based framework.

+2
03 Oct '14 at 19:45
source share



All Articles