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
2
votes
2 answers

Struts2 Convention Plugin @Actions not mapping with Spring Boot

When upgrading my application to use Spring Boot version 2.1.8.RELEASE + struts2-convention-plugin with Struts2-core version 2.5.20 the actions are not being mapped correctly and I am getting the…
clD
  • 2,523
  • 2
  • 22
  • 38
2
votes
0 answers

Struts 2.5 + convention plugin and slashes in action

I'm developing a Struts2 web-app with Struts2 convention plugin and I want to enable the wildcards mapping in order to do somenthing like: http://localhost:8080/myApp/user -> go to users' list http://localhost:8080/myApp/user/1 …
IlGala
  • 3,331
  • 4
  • 35
  • 49
2
votes
1 answer

How to short-circuit a @CustomValidator?

Consider below sample, which checks if fromDate and toDate are valid dates and if fromDate is less than toDate: @CustomValidator(type = "DateValidator", fieldName = "fromDate", shortCircuit = true), @CustomValidator(type =…
2
votes
2 answers

Unable to load bean using Struts convention plugin

I want to use annotation based config instead of xml based. Struts has convention plugin to do this kind of thing. So I removed struts.xml file in main/resources, added this plugin as dependency, put some annotations on actions and tried to run my…
marknorkin
  • 3,904
  • 10
  • 46
  • 82
2
votes
1 answer

Why the Exception raised from my Interceptor is not caught by ?

I have a custom Interceptor, from which I throw an Exception; The Action(s) running that Interceptor is managed by Convention plugin; The Exception raised by the Interceptor is globally defined in struts.xml for the package the Action is running…
2
votes
1 answer

Redirect index.jsp to a Struts 2 Action

Related to: How can I set the welcome page to a struts action? I'm trying to redirect my welcome page index.jsp to an action (Struts2). None of options in related post worked for me: type Status report message /malelo/indexRedir description The…
Magno C
  • 1,922
  • 4
  • 28
  • 53
2
votes
1 answer

Struts2 Convention Plugin is broken on Tomcat 8.x - org.apache.struts2.convention.PackageBasedActionConfigBuilder.error Unable to scan named packages

I'm using Struts 2.3.16 along with same version of the convention plugin. The application runs fine on Tomcat 7.0.35 but it fails with the following exception on Tomcat 8.0.3.0. 11-May-2014 06:26:01.421 WARNING [http-nio-8084-exec-5]…
Tiny
  • 27,221
  • 105
  • 339
  • 599
2
votes
1 answer

struts2 convention plugin doesn't work in an EAR but works fine in WAR

When I deployed the WAR file the convention plugin was able to find the action class using annotations, but it fails to find the action with in an EAR. glassfish- v2.1.1 struts2-convention-plugin-2.3.15.3 Content of struts.xml file:
pavpal
  • 41
  • 4
2
votes
1 answer

Short-circuit in Struts2 validation

Let's assume that there a field of type BigDecimal in an action class as follows. @Namespace("/admin_side") @ResultPath("/WEB-INF/content") @ParentPackage(value = "struts-default") public final class TestAction extends ActionSupport { private…
Tiny
  • 27,221
  • 105
  • 339
  • 599
2
votes
3 answers

Global results with Struts 2 and convention plugin

i would like to have some global results in my application. In good old XML configuration it would look like: index
2
votes
1 answer

Conflicts in xwork and xwork-core

I have been trying to integrate Struts 2 with Zero Configuration, Spring, Hibernate and Maven. But, what I think there must be something which I am missing in integration and it must be related to the configuration of Maven's Pom.xml:
2
votes
1 answer

There is no Action mapped for namespace [/] and action name [abc] associated with context path [APP_NAME]

I am getting this issue when using Annotations in my Struts2 code. My Annotated Action class seems something like this which is using interceptors, and my architecture is based on Spring 3, Struts 2, and using Struts2 Convention Plugin…
2
votes
1 answer

Upgrading to Struts 2.3.15 - Convention Plugin cause crash on startup

I'm in the process of upgrading my Struts2 installation to 2.3.15. After adding the struts2-convention-plugin-2.3.15.jar my web-app fails to start. The relevant part of the exception listing is; Caused by: Attribute "order" must be declared for…
user497087
  • 1,561
  • 3
  • 24
  • 41
2
votes
1 answer

Struts2 validations annotation gives multiple messages

I am using the convention plugin. Below is the @Validations annotation. @Validations( requiredFields={@RequiredFieldValidator(type = ValidatorType.SIMPLE, fieldName = "revenue", message = "You must enter a value for field.")}, …
Aadam
  • 1,521
  • 9
  • 30
  • 60
1
vote
0 answers

Struts2 Tags Error With struts-convention-plugin

I've implemented REST into existing non-Restful Struts application and REST module work normally. The trouble is some button in the web page with struts-tags and other taglib make error org.apache.struts2.components.ClosingUIBean | Could not open…