Annotations:
- Information for the compiler — Annotations can be used by the compiler to detect errors or suppress warnings.
- Compiler-time and deployment-time processing — Software tools can process annotation information to generate code, XML files, and so forth.
- Runtime processing — Some annotations are available to be examined at runtime.
Annotation is a very powerful mechanism and can be used in a lot of different ways:
- to describe constraints or usage of an element: e.g.
@Deprecated, @Override, or@NotNull - to describe the "nature" of an element, e.g.
@Entity, @TestCase, @WebService - to describe the behavior of an element:
@Statefull, @Transaction - to describe how to process the element:
@Column, @XmlElement
Usage of annotations:
- Documentation, e.g. XDoclet
- Compilation
- IDE
- Testing framework, e.g. JUnit
- IoC container e.g. as Spring
- Serialization, e.g. XML
- Aspect-oriented programming (AOP), e.g. Spring AOP
- Application servers, e.g. EJB container, Web Service
- Object-relational mapping (ORM), e.g. Hibernate, JPA
- and many more...
Struts-Flow:
1) When first the request is made from a JSP/HTML/XSLT to the server with a particular URI(/something.do), the controll first reaches Web.xml file.
2) it checks the mapping for /something.do in web.xml and finds the ActionServlet and loads ActionServlet.
......
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
.....
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
3) As part of loading ActionServlet calls the init() as every other servlet does.
(Note: ActionServlet extends HttpServlet only)
......................
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
........................
4) in init() it takes the init-parameters as struts-config.xml and loads the xml file.
5) then the ActionServlet calls the proceed() of RequestProcessor class.
6) in proceed() , it checks the appropriate mapping for current request, creates and ActionMapping object and maps the URI to the action in the struts-config.xml.
7) then it creates an object to ActionForm associated to that action mapped object
8) calls the setters and reset().
9) if the action tag in struts-config.xml contains validate="true", then the validate method is called.
10) if any validation errors, it return to view component (any jsp,XSLT) which is specified as an attribute of input="/error.jsp"
11) if there are not validation errors, it then creates an Action class for that mapping and search for execute method and executes it.
12) execute method performs the bussinesslogic which you provide and returns with an ActionForward key.
13) now the returned key is searched in the mapping object which is specified as forward tag.
14) it looks for the appropriate view component and performs the getters on that view component and returns the response to the browser.
Message Driven Bean
A MDB is component can process messages asynchronously. This is associated with JMS service. Basically it works as JMS Listener. The messages can be sent by any client like JMSclient, any other EJB,system that does not use Java EE technology. Bean associated with JMS queue or topic.
No comments:
Post a Comment