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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:18:10+00:00 2026-06-13T23:18:10+00:00

I want to pass a value in action when it is called using struts1

  • 0

I want to pass a value in action when it is called using struts1 configuration file. I have create a form bean with following property

public class MyForm extends ActionForm {
    private String task;  

    public String getTask() {
        return task;
    }
    public void setTask(String task) {
        this.task = task;
    }
}

In struts-config.xml, I have defined form bean and action as below.

<form-bean name="myForm" type="demo.MyForm"></form-bean>
<action path="/myAction" name="myForm" type="demo.MyAction" scope="request">
    <set-property value="view" property="task" />
    <forward name="success" path="/result.jsp"></forward>
</action>

I am trying to run it in web sphere 6.1 with these configurations, it gives following exception

Deregister the mbean because of uncaught init() exception thrown by servlet action: javax.servlet.UnavailableException: Parsing error processing resource path file:/D:/workspaces/j-space/myProject/Web Content/WEB-INF/struts-config.xml
at org.apache.struts.action.ActionServlet.handleConfigException(ActionServlet.java:761)
at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:744)
at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:689)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:356)
at javax.servlet.GenericServlet.init(GenericServlet.java:256)
....

I think I am missing something or using set-property tag in wrong way . Can anyone help?

  • 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-13T23:18:11+00:00Added an answer on June 13, 2026 at 11:18 pm

    Struts 1.3 DTD says

    The “set-property” element is especially useful when a custom subclass
    is used with , , , or
    elements.

    Create Subclass of ActionMapping with properties you would like to inclide

    public class CustomActionMapping extends ActionMapping {
    
        private String task;
    
        public String getTask() {
            return task;
        }
    
        public void setTask(String task) {
            this.task = task;
        }
    }
    

    configure the custom action mapping in struts-config.xml

    <action-mappings type="CustomActionMapping">
       <action path="/myAction" name="myForm" type="demo.MyAction" scope="request">
          <set-property value="view" property="task" />
          <forward name="success" path="/result.jsp"></forward>
       </action>
    </action-mappings>
    

    get the value of task in doGet/doPost method your Action class

    CustomActionMapping cam = (CustomActionMapping) mapping;
    String task = cam.getTask();
    

    hope this helps you.

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

Sidebar

Related Questions

I want to pass php variable value as a action to html form. I
I want to pass a form input value to action before the user press
I have this snippet of code below. I want to pass the value of
I have a value called member id and I want to send it to
I have a String called var2=ASDFDE whose value keeps changing. Now I want to
What I want is to pass the value of txtComments from View (using jquery/ajax)
I pass parameter with url called var which is containing value 'event'. I want
I have a controller that has a value that I want to pass to
On loading the page I want to pass a value to my javascript function
I want to pass a datetime value into my python script on the command

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.