Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6793511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:06:33+00:00 2026-05-26T18:06:33+00:00

I have the a class, CouponAction, with two methods, initCoupon and addCoupon. I only

  • 0

I have the a class, CouponAction, with two methods, initCoupon and addCoupon. I only want validation on the addCoupon method, not on class level where it tries to validate all methods.

this class with methods looks something like this

@Scope("prototype") @Controller

@Namespace("/coupon")

public class CouponAction extends BaseAjaxAction<Coupon> {

............

@Action(value = "initPaymentCoupons", results = {

@Result(location = "/jsp/order/coupon/paymentCoupon.jsp", name = "success")

    })

public String initCoupons(){

........

}


@Validations(requiredFields = {

@RequiredFieldValidator(fieldName = "couponCode", type = ValidatorType.FIELD, message = "Enter a coupon code")
 })

@Action(value = "/addCoupon", interceptorRefs=@InterceptorRef("jsonValidationWorkflowStack"),
            results = {

@Result(location = "/jsp/order/coupon/paymentCoupon.jsp", name = "success")

})

public String addCoupon() {

.......

}

Then I get:

2011-11-10 00:44:13,567 ERROR org.apache.struts2.components.ActionComponent.error:38 - Could not execute action: /coupon/initCoupons
No result defined for action vervik.actions.order.CouponAction and result input

All examples Iv seen uses the validation annotation on class level.
When I used xml I had a file:
CouponAction-addCoupon-validation.xml
which only validation the addCoupon method.

How can I make it work with validation annotation?

Sources:

http://struts.apache.org/2.1.6/docs/convention-plugin.html#ConventionPlugin-InterceptorRefannotation

http://struts.apache.org/2.0.14/docs/annotations.html

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:06:34+00:00Added an answer on May 26, 2026 at 6:06 pm

    What i am aware is that When multiple methods are used to map different actions on the same class, and one of them is annotated with @Validations, those validators will be triggered for all the actions.

    Solution seems to use annotated with @SkipValidation or validateAnnotatedMethodOnly is set to true in the “validation” interceptor.

    <interceptor-ref name="validation">
        <param name="validateAnnotatedMethodOnly">true</param>
        <param name="excludeMethods">input,back,cancel,browse</param>
    </interceptor-ref>
    

    refer the following link

    Struts2 Validation

    though even i have not worked with such case using annotation so hope this will work for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have class in server side and I want use method of this class
I have class method: public object MyMethod(object obj) { // I want to add
I have class method that returns a list of employees that I can iterate
I have: class Car {..} class Other{ List<T> GetAll(){..} } I want to do:
I have class A: public B { ...} vector<A*> v; I want to do
I have class class DateOptTimeType implements org.hibernate.usertype.UserType that works with two columns @org.hibernate.annotations.Type(type =
I have class X and in it there is a static method called doStuff()
I have class MyContainer < ActiveRecord::Base :has_many MyObjects, :dependent => :destroy end I want
I have class that I believe should not be a singleton or static class.
I have class where the relevant part looks like class C { void Method<T>(SomeClass<T>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.