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 7758645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:24:49+00:00 2026-06-01T13:24:49+00:00

i have override validate method and added errors using addFieldError(test, test print); and in

  • 0

i have override validate method and added errors using
addFieldError("test", "test print");

and in jsp used
<s:fielderror />

but the errors are not displayed in input.jsp.

Also my jsp content type is
<%@ page contentType="text/html; charset=UTF-8"%>

My struts.xml is like

            <action name="test" class="ListInfo">
                 <result>/input.jsp</result>
            </action>

    <action name="Proceed" class="Details">
    <interceptor-ref name="defaultStack"/>
            <interceptor-ref name="execAndWait">
                <param name="delay">100</param>
            </interceptor-ref>
           <result name="wait">Wait.jsp</result>
        <result name="success">/Summary.jsp</result>
        <result name="input" type="chain">test</result>
        <result name="failure" type="chain">test</result>
    </action>
  • 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-06-01T13:24:51+00:00Added an answer on June 1, 2026 at 1:24 pm

    Turns out that errors (field and action are NOT maintained across a chain.

    Following proves this (assumes struts2-conventions-plugin-VERSION):

    Action foo always chains to action bar (so we only need a view for action bar)

    Action foo

    package com.quaternion.action;
    
    import com.opensymphony.xwork2.ActionSupport;
    import org.apache.struts2.convention.annotation.Result;
    
    /** #1 SOMETHING WILL BE ADDED HERE TO FIX THE ISSUE**/
    
    @Result(name="input", type="chain", location="bar")
    public class Foo extends ActionSupport{
        private String name;
    
        @Override
        public void validate(){
            super.addActionError("Just an action error");
            super.addFieldError("name", "Name is all ways wrong... for no good reason.");
        }
    
        public String getName(){
            return name;
        }
    
        public void setName(String name){
            this.name = name;
        }
    }
    

    Action bar

    package com.quaternion.action;
    
    import com.opensymphony.xwork2.ActionSupport;
    
    /** #2 SOMETHING WILL BE ADDED HERE TO FIX THE ISSUE**/
    
    public class Bar extends ActionSupport{  
    }
    

    view for bar: /WEB-INF/content/bar.jsp

    <%@taglib prefix="s" uri="/struts-tags"%>
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <!DOCTYPE html>
    <html>
        <body>
            <h1>Action Bar</h1>
            <s:actionerror/>
            <s:fielderror name="name"/>
        </body>
    </html>
    

    Testing the above we see nothing show up in the errors.

    To fix the issue we use the store interceptor: http://struts.apache.org/2.0.14/struts2-core/apidocs/org/apache/struts2/interceptor/MessageStoreInterceptor.html

    In the first action (#1) we will need to add annotations and the imports to support them:

    import org.apache.struts2.convention.annotation.InterceptorRef;
    import org.apache.struts2.convention.annotation.InterceptorRefs;
    
    @InterceptorRefs({
        @InterceptorRef(value = "store", params = {"operationMode","STORE"}),
        @InterceptorRef("defaultStack"),
    })
    

    In the second action (#2) we will need to add annotations and the imports to support them:

    import org.apache.struts2.convention.annotation.InterceptorRef;
    import org.apache.struts2.convention.annotation.InterceptorRefs;
    
    @InterceptorRefs({
        @InterceptorRef(value = "store", params = {"operationMode","RETRIEVE"}),
        @InterceptorRef("defaultStack"),
    })
    

    And now it works.

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

Sidebar

Related Questions

What method do I have to override so as to extend Ext.data.reader.Json (for a
I have implemented a ToString() override method for my class in my Webservice and
I have the following method: @Override public boolean myMethod() { // do stuff }
i have the following method in a usercontrol protected override void Render(HtmlTextWriter writer) {
I have code that overrides the TextBox ProcessCmdKey method: protected override bool ProcessCmdKey(ref Message
I have this code: @Override public void onSurfaceCreated(GL10 gl, EGLConfig config) { GLES20.glClearColor(0, 0,
I have a code: protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { switch
I override ProcessCmdKey() in my MDI parent form class and have some keyboard shortcut
i have the following function to override the default save function in a model
I have defined an abstract method in my base class to take in a

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.