How to integrate JSF with custom servlets?

I am just starting to work on JavaServer Faces and it looks very attractive. However, I would like to use my own servlets in the same web application as JSF.

This may be really obvious, but what are the best practices for integrating JSF with a “normal” servlet application? This will include access to JSF data from servlets (read and write).

+3
source share
2 answers

If your servlets are well written, they should already not have any business logic inside, but just pure request / response / preprocessing / postprocessing logic. Business logic should already be hosted in stand-alone javabean-like domain / model classes. Database logic should already be placed in standalone DAO classes. Etc. You can just use them all in JSF.

, , JSF ( API- Servlet - ) beans HttpServletRequest, beans HttpSession, beans ServletContext. , , ExternalContext#getRequestMap(), #getSessionMap() #getApplicationMap(). , .

, FacesContext Servlet Filter, . bean? , , PhaseListener?

+8

JSF. JSF, " ", " ".

JSF beans, . , ( FacesContext.getCurrentContext().getExternalContext()), - JSF bean.

, JSF, , URL-, URL- JSF.

+1

Source: https://habr.com/ru/post/1734502/


All Articles