Questions tagged [struts2-convention-plugin]

The Struts 2 Convention Plugin provides Struts 2 with convention-based actions and views, allowing zero-config Struts 2 applications, while providing customization at multiple levels.

The Struts 2 Convention Plugin provides Struts 2 with convention-based actions and views, allowing zero-config Struts 2 applications, while providing customization at multiple levels.

Features include:

  • Action location by package naming conventions
  • Result (JSP, FreeMarker, etc) location by naming conventions
  • Class name to URL naming convention
  • Package name to namespace convention
  • SEO compliant URLs (i.e. my-action rather than MyAction)
  • Action name overrides using annotations
  • Interceptor overrides using annotations
  • Namespace overrides using annotations
  • XWork package overrides using annotations
  • Default action and result handling (i.e. /products will try com.example.actions.Products as well as com.example.actions.products.Index)

This plugin can provide additional configuration based on convention. It also uses annotations to replace or override the configuration settings made by this plugin. All annotations that could be used in the code you can find under the package org.apache.struts2.convention.annotation.

80 questions
1
vote
1 answer

Action not found, why not?

I have created an action with a method like below: public class NomenclatureAction extends ActionSupport { // ... @Actions({ @Action(value = "ajaxDoStuff", results = { @Result(name =…
Stephan
  • 41,764
  • 65
  • 238
  • 329
1
vote
1 answer

@Result at class level and method level

I'm following the Struts 2 Hello World Annotation Example tutorial by Mkyong: @Namespace("/User") @ResultPath(value="/") @Action(value="/welcome", results={@Result(name="success", location="pages/welcome_user.jsp")}) public class…
1
vote
1 answer

Struts2 does not find HTML files

I'm using Struts2 with the convention plugin. I know how to get it to find actionless JSP files, but I can't seem to get it to display actionless HTML files. I have a whole set of HTML files generated by javadoc which I want to display in my WAR…
Gary Kephart
  • 4,860
  • 5
  • 39
  • 52
1
vote
1 answer

Unknown reason for java.lang.ClassNotFoundException

In an application, we have declared Action class as a Spring bean. This is working fine for all Struts mapping.
1
vote
1 answer

Struts 2 - wrong controller mapping after upgrade

I have a problem with mapping of some Controllers after upgrade from Struts version 2.1.8.1 to 2.3.16.3. All was working before the upgrade, but now 3 out of 60+ controllers boomed with next error: ERROR [ActionComponent] Could not execute action:…
1
vote
1 answer

HTTP 404 - There is no Action mapped for namespace [/modeldriven] and action name [datosUsuario] associated with context path [/FormularioMD]

I'm a beginner to struts2. I created a dynamic web project on eclipse so as to using struts 2. There are something wrong with it, and i just don not know why. the Console output is: There is no Action mapped for namespace [/modeldriven] and action…
1
vote
1 answer

Can't call action using annotation in Struts 2

Here is my action class: FirstAction.java: @Namespace(value = "/User") public class FirstAction extends ActionSupport { /** * */ private static final long serialVersionUID = 1L; @Action(value = "run4", results = { @Result(name = "task1",…
1
vote
1 answer

How do configure struts convention plugin with struts-spring plugin with Action class mapped with annotations

I am trying to configure spring plugin with strut 2 application which is already running with convention plugin, so I am using annotations. I am using ExtJs for my form submission which was initially working well until I introduced the spring…
1
vote
1 answer

struts.convention.result.path is not working in Struts2

My current project structure is as follows WebContent WEB-INF View TestPage.jsp other JSP pages... My assignment is to put all JSP pages inside folder WEB-INF and do all relative changes in the project. WebContent WEB-INF …
Ankit Sharma
  • 1,569
  • 3
  • 19
  • 31
1
vote
2 answers

"Content-Type not allowed" while uploading an SVG file, that is in the allowed whitelist

IMPORTANT: The following problem has been fixed in Struts version 2.3.24. From that version on, there is no need to escape any character. Read more: JIRA Issue WW-4457. I've configured the Struts2 FileUpload Interceptor to allow a whitelist of…
Andrea Ligios
  • 49,480
  • 26
  • 114
  • 243
1
vote
1 answer

Enabling convention plugin breaks xml mapping

I have an old project which uses xml configured struts2 mappings. I wanted to make it a bit fresher and use annotations mapping, as would do that in spring mvc. So I found, that struts2 allows that. But after I added
1
vote
1 answer

How to remove .action from URL without using a constant in struts.xml

I am using Struts 2 convention plugin. I don't want to use any XML based configurations in my application. So, in this case, how how to remove .action extension from URL without using in…
1
vote
1 answer

Struts 2 annotation error when calling action

Hi all I'm having problems using Struts 2 Annotated Actions In my pom.xml I have: org.apache.struts struts2-convention-plugin
1
vote
0 answers
1
vote
1 answer

How to set Alias Interceptor's parameter with annotations

I'm a newbie in Struts 2 I want to use Alias Interceptor with annotations. @Action(value="profile", results={ @Result(name=SUCCESS, location="/home.jsp")}, interceptorRefs={ @InterceptorRef(value="alias", params={"aliases",…