How does a Struts2 action compare to a servlet?

How do Struts2 actions compare to servlets? Can an action act like a servlet?

+3
source share
3 answers

The Struts action (Struts1 / Struts classic) is more bound to the servlet. In Struts2, it's completely different. The Struts2 action is just a POJO (simple Java class), completely separate from the Servlet API. This decoupling makes testing easier.

In a typical Struts2 web application workflow, an action will be created for each request and will be associated with a servlet (it can implement an interface ServletAwareif it needs to know about this association, usually this is not necessary and is not recommended).

( Struts) , Struts2 , , : , , HTTP- ( ) ; - Struts2, .

+9
  • Struts - java. struts URL- ( , URL- ). , , . , , jsp, . ) , ) c) jsp, jsp.

  • /, , , , , .

+1

Struts2 - MVC, Java EE.

0

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


All Articles