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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:10:55+00:00 2026-06-09T23:10:55+00:00

I am developing Spring 3 + Struts2 application and I configure my Actions in

  • 0

I am developing Spring 3 + Struts2 application and I configure my Actions in Spring as follows:

  <bean id="patientSearchAPIClass" class="com.axiohelix.nozoki.web.action.api.PatientSearch">     
       <property name="searchService" ref="searchService"/>        
    </bean> 

But in my Action class I keep fields to store Request parameters ,

public class PatientSearch extends ActionSupport {


        public String getPharumoId() {      
        return pharumoId;
        }

        public void setPharumoId(String pharumoId) {
        this.pharumoId = pharumoId;
         }

        public String getName() {
        return name;
        }
        public void setName(String name) {
        this.name = name;
        }

        private String name;
        private String pharumoId;
        ..


        public String execute(){        
        searchResults=searchService.searchPatients(pharumoId,                                                  name,
                                                   birthday,
                                                   pharmacyId,
                                                   clinic,
                                                   doctorName,
                                                   drugName,
                                                   supplyDate,                                                 
                                                   offset, 
                                                   pageSize);       

        return Action.SUCCESS;
    }

This Action returns a JSON output and I access it using URL like:

http://localhost/app/searchAPI.action?name=UserName

then next time if I access using URL :

http://localhost/app/searchAPI.action

The field ‘name’ is till set to previous “UserName” value.

1.How to reset these values per request ?

2.I thought Action classes are instantiated per request,is it not ?

  • 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-09T23:10:57+00:00Added an answer on June 9, 2026 at 11:10 pm

    Problem was with the way Action classes are getting created by Spring.By default Spring creates singleton instances and for Struts2 ,Action classes also work as Model, due to this framework create a new instance of Action and place it in to values stack.

    While creating action class using Spring make sure to define scope as prototype like

    <bean id="patientSearchAPIClass" 
     class="com.axiohelix.nozoki.web.action.api.PatientSearch" scope=prototype>
    

    So that new instance of Action should get created by Spring for each request.

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

Sidebar

Related Questions

I am developing a new web application with Struts2, Spring and Hibernate as its
I am struts2 for developing my application. Sample code of action class would be
I'm developing web application supported by Spring Integration. I'm using 1.0.4.RELEASE. I use CGLib
We are developing a web application using Spring framework and Hibernate ORM. As far
I'm developing a web application that use Spring Security for authentication of users. I
I am using spring 3.0.2 for developing a simple web based application like twitter.
I am developing a web application using Spring JS and Dojo Toolkit. In this
I am using Spring Web MVC and Hibernate for developing my application. My login.jsp
I am developing my first Java web application (Spring/Hibernate/Freemarker) and my only concern is
I'm developing a Java/Spring web application. The problem I'm currently facing is that I'd

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.