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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:56:21+00:00 2026-05-29T06:56:21+00:00

I am doing my struts project now i want to retrieve data as json.

  • 0

I am doing my struts project now i want to retrieve data as json. But the variable that i want to get the json response does’nt retrieve the json values that i need.

Here is my Action class

import com.myDrDirect.hbmobj.Doctor;
import com.myDrDirect.order.dao.DoctorDashBoardDao;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import java.util.List;
import java.util.Map;

public class patientOrderDetails extends ActionSupport {
    private int rows;
    private int total;
    private int records;
    private int page;
    private List recentOrders;
    public String jsonRecentOrderDetails() {

         try{
            Map sessionSingleDoctor = ActionContext.getContext().getSession();
            Doctor SessionObj = (Doctor) sessionSingleDoctor.get("Doctor");

          records = DoctorDashBoardDao.getInstance().getCount();
            //records = 10;
             setRows(Integer.parseInt(getText("number.rows.per.page")));
        //rows = 10;
            int to = (getRows() * getPage());
            int from = (getRows() * (getPage()-1));


            total =(int) Math.ceil((double)records / (double)rows);   
            recentOrders= DoctorDashBoardDao.getInstance().getDoctorRecentOrderDetails(rows,from,SessionObj.getId());


     } catch (Exception e) {
            e.printStackTrace();
            System.out.println(e.getCause());
            //log.error("Error occured " + e.toString());
            return ERROR;
        }
          return SUCCESS;
     }

    public int getRows() {
        return rows;
    }

    public void setRows(int rows) {
        this.rows = rows;
    }

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getRecords() {
        return records;
    }

    public void setRecords(int records) {
        this.records = records;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public List getRecentOrders() {
        return recentOrders;
    }

    public void setRecentOrders(List recentOrders) {
        this.recentOrders= recentOrders;
    }


}

and my struts.xml have

<package name="json" extends="json-default">

            <action name="DashBoardActivityJson" class="com.myDrDirect.doctor.action.patientOrderDetails" method="jsonRecentOrderDetails">
                <result name="success" type="json">
                    <!-- serialize the result property of the action -->                    
                    <param name="includeProperties">recentOrders</param>

                </result>
            </action>
            <action name="grid" >
                <result name="success" >/WEB-INF/doctor/jsonGrid.jsp</result>
            </action>
        </package>

I need to get the response in RecentOrders1 varable but this variable not retrieve the json data. When i retrieve the variable records i got the response correctly. The recorde only have a totalcount of the list but the recentOrder1 returns a list. I need to get the recentOrder as list in my view page. Can anybody please tell me what is the issue in the above action or xml file. Please help.

One thing i have noticed here is return value in recentOrder is a list. Do i need to convert this list to json string. Is it necessary or struts2 automatically change my list variable into a json string?

  • 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-29T06:56:22+00:00Added an answer on May 29, 2026 at 6:56 am

    Your action doesn’t have a property RecentOrders1, only recentOrders.

    Note both the capitalization, and lack of a digit.

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

Sidebar

Related Questions

i use struts 1.3 and want to make localization. that's what I'm doing: in
I am using My-eclipse and doing a struts project there is no syntax error
I am doing my project in struts2 framework. but i cant find a way
I'm trying to get my Struts2 project running with Tiles and REST Plugin but
I'm trying implement my project in Apache Struts 2 but I'm not very familiar
Ok, basically there is a large C++ project (Recast) that I want to wrap
How to write dynamic struts <html:option> , I'm doing as below <logic:iterate id=data name=sendEmailForm
Doing an ajax get request works as expected using the following code: $.ajax({ type:
Doing the below will reproduce my problem: New WPF Project Add ListView Name the
When doing an INSERT with a lot of data, ie: INSERT INTO table (mediumtext_field)

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.