• Action,  ActionForm,  Interview Questions,  Learn Struts,  Struts 2

    Struts2, First “Hello World Application”

    In this tutorial we will see how to create a simpe Struts 2 Hello World Application. The following files are needed to create a Hello World Application. web.xml struts.xml HelloWorld.java index.jsp success.jsp web.xml is used to configure the servlet container properties of the hello world appliation. The filter and the filter-mapping elements are used to setup the Struts 2 FilterDispatcher. The filter is mapped to the URL pattern “/*“. This means all the incoming request that targets to the Struts 2 action will be handled by FilterDispatcher class. <filter><filter-name>struts2</filter-name><filter-class>org.apache.struts2.dispatcher.FilterDispatcher </filter-class></filter><filter-mapping><filter-name>struts2</filter-name><url-pattern>/*</url-pattern></filter-mapping><welcome-file-list><welcome-file>index.jsp</welcome-file></welcome-file-list> The gateway for our hello world application is index.jsp file. The index.jsp file should be mentioned in web.xml as shown…

  • Action,  ActionForm,  Interview Questions,  Learn Struts,  Struts 2

    Struts DynaActionForm

    DynaActionForm is specialized subclass of ActionForm that allows the creation of form beans with dynamic sets of properties, without requiring the developer to create a Java class for each type of form bean. DynaActionForm eliminates the need of FormBean class and now the form bean definition can be written into the struts-config.xml file. So, it makes the FormBean declarative and this helps the programmer to reduce the development time.

    Comments Off on Struts DynaActionForm
  • ActionForm,  Learn Struts,  Struts 2

    What is Globalforward and Forward in Struts?

    A Struts forward is an object that is returned by an action and has two fields: a name and a path. The path indicates where a request is to be forwarded and it is available to all actions. Difference between Forward and global forwardA forward can be local (for specific action) or global (available to any action). A forward can be global or local. A global forward is defined in a struts-config.xml file and redirect to a specified JSP page. A local forward is defined in a struts-config.xml file in an action mapping and is invoked when the action is invoked. Example for Global Forward<global-forwards>  <forward   name=”logoff”               path=”/Applogoff.do”/>  <forward   name=”logon”                path=”/Applogon.jsp”/> …

    Comments Off on What is Globalforward and Forward in Struts?
  • Action,  ActionForm,  Controler,  Learn Struts,  Model,  Struts 1.x,  Struts 2,  Struts Components,  Tiles Plug-in,  Validator Plug-in,  View

    What are the different components for struts application?

    Struts 1.x Framework have following components in its application: struts-config.xml ActionForm Bean View(JSP or ftl) Action Class Model (DAO,DTO classes) And may have following extensible component for Application: Validator.xml Validator class tiles-defs.xml Your comments give us opportunity to improve my blogs, so please comment.

    Comments Off on What are the different components for struts application?
  • ActionForm,  Learn Struts,  Struts 1,  Struts Components

    Need for ActionForm not to be an interface?

    We have ActionForm in aour Struts application which is a class file and not an interface, what will happen in case if we implement it through Interface, There are few reasons why an Action Form should not an interface. Adding a new method in interface (in case new version of struts is released) will break earlier application’s form bean. While in case of base class one can add new method as default implementation which doesn’t break earlier applications to use new version, its a simple extensiblity issue while making ActionForm as Interface. In case Action Form is being an interface, struts developers would be required to use their business objects…

    Comments Off on Need for ActionForm not to be an interface?