Struts 2 Tutorial

Struts 2 tutorials

Apache Struts 2, another popular Java Model-View-Contraller (MVC) framework, combine of both successful WebWork and Struts 1.x web frameworks.

Apache Struts 2, is totally different with Struts 1, it’s core features are all implemented with interceptors, “value stack” concept, OGNL expression and Struts 2 tags to work around the application data, and many annotations and conventions to make this framework more simpler to use. In this tutorials, it provides many step by step examples and explanations on using Struts 2 MVC framework.

Happy learning Struts 2. :)

Struts 2 Quick Start

Struts 2 quick start example.

Struts 2 Configurations

Anything about Struts 2 configuration file.

Struts 2 Action & Form

Struts 2 Action and form data management.

Struts 2 Interceptors

Abything about Struts 2 interceptors.

Struts 2 UI Tags

Struts 2 UI tags, to render the HTML form and non-form componnets.

Struts 2 Control Tags

Struts 2 Control tags or Logic tags, help to do conditional processing, iterate, manipulate and display the data.

  • iterator tag example
    Struts 2 Iterator tag is used to iterate over a value, which can be any of java.util.Collection or java.util.Iterator.
  • if, elseIf, else tag example
    Struts 2 If, ElseIf and Else tags are used to perform basic condition checking.
  • append tag example
    Struts 2 append tag is used to combine few Iterators (created by List or Map) into a single Iterator.
  • generator tag example
    Struts 2 generator tag is used to generate an iterator based on the “val” attribute provided in the page.
  • merge tag example
    Struts 2 merge tag is used to merge few Iterators (created by List or Map) into a single Iterator.
  • sort tag example
    Struts 2 sort tag is used to sort a List using a java.util.Comparator.
  • subset tag example
    Struts 2 subset tag is used to output a subset or portion of an iterator elements.

Struts 2 Data Tags

Struts 2 Data tags, help to get the data from the ValueStack, or place the data into the ValusStack.

  • a tag example
    Struts 2 a tag is used to render a HTML “<a>” tag.
  • action tag example
    Struts 2 action tag is used to call action class directly from a JSP page.
  • bean tag example
    Struts 2 bean tag is used to instantiate a class in the JSP page.
  • date tag example
    Struts 2 date tag is used to format Date object in JSP page.
  • debug tag example
    Struts 2 debug tag is a very useful debugging tag to output the content of the “Value Stack” and also the “Stack Context” details in JSP page.
  • include tag example
    Struts 2 include tag is used to include JSP or HTML page directly into the current page.
  • i18n tag example
    Struts 2 i18n tag is used to get the message from any declared resource bundle, not just the resource bundle that associated with the current action.
  • param tag example
    Struts 2 param tag is used to parametrize other tags.
  • property tag example
    Struts 2 property tag is used to get the property value from a class, which will default to the current Action class.
  • push tag example
    Struts 2 push tag is used to push value to the top of stack, so that it can be access or reference easily.
  • set tag example
    Struts 2 set tag is used to assign a value to a variable in a specified scope (application, session, request, page, or action).
  • text tag example
    Struts 2 text tag is used to get the message from the resource bundle that’s bundle with the action class.
  • url tag example
    Struts 2 “url” tag is used to create an URL and output it as a text format.

Struts 2 Resource Bundle & Localization

Struts 2 resource bundle to support the web localization features (multiple language).

Struts 2 Theme

Struts 2 layout is designed by the “xhtml” theme, understand the Struts 2 theme concept is a “MUST”.

Struts 2 Integrate with Other Frameworks

Anything about the Struts 2 integration with others framework – Spring, Hibernate, Quartz, Log4j…

Struts 2 FAQ

Struts 2 FAQ.

Struts 2 Common Errors

Struts 2 common errors.

Struts 2 Reference

Tags :

About the Author

mkyong
Founder of Mkyong.com and HostingCompass.com, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider make a donation to these charities.

Comments

  • Pingback: water ionizer()

  • Pingback: water ionizers()

  • Pingback: what is it worth()

  • Pingback: related site()

  • Pingback: house blue()

  • Pingback: Payday loans()

  • Pingback: forensic locksmithing courses()

  • Pingback: a bartlett electricians()

  • Pingback: pay day loans()

  • Pingback: alkaline water machine()

  • Pingback: laan penge her og nu()

  • Pingback: mp4 mobile porn()

  • Pingback: salon de jardin 99 euros()

  • Pingback: laan nu og her()

  • Pingback: stop parking()

  • Pingback: car parking()

  • Pingback: tvpackages.net()

  • Pingback: online casinos()

  • Pingback: petunia seeds()

  • Pingback: water ionizer()

  • Pingback: watch movies online()

  • Pingback: watch tv show episodes()

  • Pingback: Watch Video()

  • Pingback: Blue Coaster33()

  • Prasad

    Hello,
    Can we use struts 2 project(project1) as a plug-in in struts-plugin.xml and after adding it has a plug-in in xml file can we use project1 in another struts2 project(project2).
    if yes can u please put down that code with an example am in need of it.
    thanks in advance.

  • sarath thota

    hi, i upgrade my application from struts2.0.11 to struts2.3.15.1 jars.
    Now i am getting problem in validation.xml like below:

    [ERROR] 2013-09-10 12:24:16,852 [AnnotationActionValidatorManager] (CommonsLogger.java:error:38)
    Caught exception while loading file com/sutisoft/esign/struts/action/LoginAction-validation.xml

    http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd – Class: sun.net.www.protocol.http.HttpURLConnection
    File: HttpURLConnection.java
    Method: getInputStream
    Line: 1239 – sun/net/www/protocol/http/HttpURLConnection.java:1239:-1
    at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:119)
    at com.opensymphony.xwork2.validator.DefaultValidatorFileParser.parseActionValidatorConfigs(DefaultValidatorFileParser.java:82)
    at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.loadFile(AnnotationActionValidatorManager.java:394)
    at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.buildClassValidatorConfigs(AnnotationActionValidatorManager.java:279)
    at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.buildValidatorConfigs(AnnotationActionValidatorManager.java:371)
    at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.getValidators(AnnotationActionValidatorManager.java:102)
    at org.apache.struts2.components.Form.getValidators(Form.java:281)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:866)
    at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:106)
    at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:93)
    at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
    at freemarker.core.IteratorBlock.accept(IteratorBlock.java:94)
    at freemarker.core.Environment.visit(Environment.java:221)
    at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:167)
    at freemarker.core.Environment.visit(Environment.java:428)
    at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)
    at freemarker.core.Environment.visit(Environment.java:221)
    at freemarker.core.MixedContent.accept(MixedContent.java:92)
    at freemarker.core.Environment.visit(Environment.java:221)
    at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
    at freemarker.core.Environment.visit(Environment.java:221)
    at freemarker.core.MixedContent.accept(MixedContent.java:92)
    at freemarker.core.Environment.visit(Environment.java:221)
    at freemarker.core.Environment.include(Environment.java:1508)
    at freemarker.core.Include.accept(Include.java:169)
    at freemarker.core.Environment.visit(Environment.java:221)
    at freemarker.core.MixedContent.accept(MixedContent.java:92)
    at freemarker.core.Environment.visit(Environment.java:221)
    at freemarker.core.Environment.process(Environment.java:199)
    at freemarker.template.Template.process(Template.java:259)
    at org.apache.struts2.components.template.FreemarkerTemplateEngine.renderTemplate(FreemarkerTemplateEngine.java:157)
    at org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:572)
    at org.apache.struts2.components.UIBean.end(UIBean.java:526)
    at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)
    at org.apache.jsp.bodycontent.login_jsp._jspService(login_jsp.java:406)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:551)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:488)
    at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:968)
    at org.apache.jasper.runtime.PageContextImpl.doInclude(PageContextImpl.java:650)
    at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:644)
    at org.apache.tiles.jsp.context.JspTilesRequestContext.include(JspTilesRequestContext.java:80)
    at org.apache.tiles.jsp.context.JspTilesRequestContext.dispatch(JspTilesRequestContext.java:73)
    at org.apache.tiles.context.TilesRequestContextWrapper.dispatch(TilesRequestContextWrapper.java:72)
    at org.apache.struts2.tiles.StrutsTilesRequestContext.dispatch(StrutsTilesRequestContext.java:84)
    at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:283)
    at org.apache.tiles.jsp.taglib.InsertAttributeTag.render(InsertAttributeTag.java:140)
    at org.apache.tiles.jsp.taglib.InsertAttributeTag.render(InsertAttributeTag.java:117)
    at org.apache.tiles.jsp.taglib.RenderTagSupport.execute(RenderTagSupport.java:154)
    at org.apache.tiles.jsp.taglib.RoleSecurityTagSupport.doEndTag(RoleSecurityTagSupport.java:75)
    at org.apache.tiles.jsp.taglib.ContainerTagSupport.doEndTag(ContainerTagSupport.java:80)
    at org.apache.jsp.layout.loginlayout_jsp._jspx_meth_tiles_005finsertAttribute_005f1(loginlayout_jsp.java:261)
    at org.apache.jsp.layout.loginlayout_jsp._jspService(loginlayout_jsp.java:149)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
    at org.apache.tiles.servlet.context.ServletTilesRequestContext.forward(ServletTilesRequestContext.java:198)
    at org.apache.tiles.servlet.context.ServletTilesRequestContext.dispatch(ServletTilesRequestContext.java:179)
    at org.apache.tiles.context.TilesRequestContextWrapper.dispatch(TilesRequestContextWrapper.java:72)
    at org.apache.struts2.tiles.StrutsTilesRequestContext.dispatch(StrutsTilesRequestContext.java:84)
    at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:606)
    at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:246)
    at org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:105)
    at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)
    at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:371)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:275)
    at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
    at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:167)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
    at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)
    at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
    at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
    at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
    at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
    at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
    at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
    at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
    at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:252)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
    at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
    at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
    at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
    at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
    at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:161)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
    at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
    at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
    at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
    at com.sutisoft.esign.logic.LoggerInterceptor.intercept(LoggerInterceptor.java:23)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
    at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)
    at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:563)
    at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    at java.lang.Thread.run(Thread.java:619)
    Caused by: java.io.FileNotFoundException: http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd

  • Rakesh

    This site is very effective for me and i want to dummy project on struts 2.0 which is totaly used the struts2.0 and database mysql . Please anyone Help me

    Thanks & regards

    Rakesh

  • Jeni

    This site was amazing !!!

    • user

      So now this site is not amazing?

  • Ask

    Hi mkyong,
    Struts 1 supported the following actions.
    http://www.javabeat.net/2007/07/introduction-to-struts-actions/

    what are the different kinds of actions do the struts2 supported?

    Any help will be greatly appreciated.
    Thanks in advance.

  • http://NA Frank

    Can you post us an example of Rest Implementation on Struts 2,
    No good example or any example is available on the net.

  • http://free.yudu.com/item/details/711236/Employ-the-service-of-Immigration-Lawyers-To-Defend-Your-Rights Immigration Solicitors in Brentwood

    Thank you for sharing your thoughts. I truly appreciate
    your efforts and I am waiting for your next write
    ups thanks once again.

  • Ask

    Hi,
    Struts 1 supported the following actions.
    http://www.javabeat.net/2007/07/introduction-to-struts-actions/

    what are the different kinds of actions do the struts2 supported?

    Any help will be greatly appreciated.
    Thanks in advance.

  • Nevil Parekh

    Sir please help me out………

    SEVERE: Dispatcher initialization failed
    Unable to load configuration. – bean – jar:file:/C:/Users/Nevil/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Struts_Tutorial1/WEB-INF/lib/struts2-gxp-plugin-2.3.4.1.jar!/struts-plugin.xml:8:162
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:437)
    at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
    at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:277)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)
    at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382)
    at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:103)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4638)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5294)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Caused by: Unable to load bean: type:org.apache.struts2.views.gxp.inject.InjectedObjectContainer class:org.apache.struts2.views.gxp.inject.InjectedObjectContainer – bean – jar:file:/C:/Users/Nevil/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Struts_Tutorial1/WEB-INF/lib/struts2-gxp-plugin-2.3.4.1.jar!/struts-plugin.xml:8:162
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:243)
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:210)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
    … 18 more
    Caused by: java.lang.ClassNotFoundException: org.apache.struts2.views.gxp.inject.InjectedObjectContainer
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
    at com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:152)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:214)
    … 21 more

    Apr 11, 2013 9:40:58 AM org.apache.catalina.core.StandardContext filterStart
    SEVERE: Exception starting filter struts2
    Unable to load configuration. – bean – jar:file:/C:/Users/Nevil/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Struts_Tutorial1/WEB-INF/lib/struts2-gxp-plugin-2.3.4.1.jar!/struts-plugin.xml:8:162
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:450)
    at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
    at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:277)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)
    at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382)
    at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:103)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4638)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5294)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Caused by: Unable to load configuration. – bean – jar:file:/C:/Users/Nevil/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Struts_Tutorial1/WEB-INF/lib/struts2-gxp-plugin-2.3.4.1.jar!/struts-plugin.xml:8:162
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:437)
    … 16 more
    Caused by: Unable to load bean: type:org.apache.struts2.views.gxp.inject.InjectedObjectContainer class:org.apache.struts2.views.gxp.inject.InjectedObjectContainer – bean – jar:file:/C:/Users/Nevil/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Struts_Tutorial1/WEB-INF/lib/struts2-gxp-plugin-2.3.4.1.jar!/struts-plugin.xml:8:162
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:243)
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:210)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
    … 18 more
    Caused by: java.lang.ClassNotFoundException: org.apache.struts2.views.gxp.inject.InjectedObjectContainer
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
    at com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:152)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:214)
    … 21 more

    Apr 11, 2013 9:40:58 AM org.apache.catalina.core.StandardContext startInternal
    SEVERE: Error filterStart
    Apr 11, 2013 9:40:58 AM org.apache.catalina.core.StandardContext startInternal
    SEVERE: Context [/Struts_Tutorial1] startup failed due to previous errors
    Apr 11, 2013 9:40:58 AM org.apache.coyote.AbstractProtocol start
    INFO: Starting ProtocolHandler [“http-bio-8080″]
    Apr 11, 2013 9:40:58 AM org.apache.coyote.AbstractProtocol start
    INFO: Starting ProtocolHandler [“ajp-bio-8009″]
    Apr 11, 2013 9:40:58 AM org.apache.catalina.startup.Catalina start
    INFO: Server startup in 2173 ms

    • Me

      Looks like the STRUTS2 Core files where NOT added to the deploy.

      Hope this helps

  • rakesh

    please provide some tutorials abou javafx.

  • http://www.deviojha.com devi prasad ojha

    Hi MKYong,

    Your struts tutorial was really very helpfull tom me.
    Just have a case where i will be getting a request and i want to instantly send “OK” response and after sending i want to perform some further operations with that request.

    Can you give me some idea how to do it.

    Thanks again.

  • Rob

    Will there any example of using cookies with Struts2?

  • Soheil

    Hi,

    I have an issue in Struts2 and i can not get it resolved. I have a dynamically generated user table. I have two buttons (edit and delete) in front of each row. Each button type goes to different methods in userAdminAction. I know that my values are not correct, but i don’t get anything back in java for my userIds. Can you please help me….

    JSP:

    User ID
    First Name
    Last Name
    Email
    Status
    Type

    JAVA:
    private List users = new ArrayList();
    private String userId;
    …..
    public String edit() throws Exception {
    System.out.println(userId);
    return “success”;
    }
    public String Delete() throws Exception {
    System.out.println(userId);
    return “success”;
    }
    public String getUserId() {
    return userId;
    }
    public void setUserId(String userId) {
    this.userId = userId;
    }

  • Firoz

    Hi Mkyong,
    Usually I dont post any comment. But I must say this one of the best site I have ever gone through. I have started recommending this site to my friends/colleague .
    Keep doing the good work mkyong . All the best.

    Many Thanks
    Firoz

    • http://www.mkyong.com mkyong

      Thanks for your kind words, Struts 2 … didn’t update for a long time.

  • mike

    I just start to learn struts 2. I have an issue about deploy several downloaded struts2 project or war files in Tomcat 7. I received requested resources not available error. Tomcat sample pages are working fine. I do find that there are no compiled jsp files under the work directories. The OS is window 8.
    It appears that Tomcat cannot find the jsp files.
    Any help will be greatly appreciated.
    Thanks in advance.