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

  • Home
  • SEARCH
  • 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 6823943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:50:36+00:00 2026-05-26T21:50:36+00:00

I’m posting a json request to server. I can see the http post is

  • 0

I’m posting a json request to server. I can see the http post is done correctly in firebug. (I’m sure the json format is valid)

eg. {datas:[{“a”:1, “b”:2},{“a”:5, “b”:6}]}

my question is, how do I recover this data in the server side? I read people saying to use request.getInputStream but can’t figure how to convert it into string or parse with GSON.

another question: is there a limite of size of a json string I can post?

(Struts 2)

dojo.xhrPost({
                url: "sub/sub/theAction",
                postData: dojo.toJson(json),
                handleAs:'json',
                headers: { "Content-Type": "application/json; charset=utf-8"},          
                load: function(data) {      
                    alert("done");          

                        }
                }                       
            });

thanks in advance

  • 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-26T21:50:37+00:00Added an answer on May 26, 2026 at 9:50 pm

    i am not sure how DOJO works or post data but believe must be same as other javascript framework works.
    here is what we can do to achieve what you are trying to do

    <package name="demojson" extends="struts-default,json-default">
        <action name="jsonTest" class="com.demo.action.JsonTestAction">
            <interceptor-ref name="json">
                <param name="contentType">application/json</param>
            </interceptor-ref>
            <result type="json"/>
        </action>
    </package>
    
    public class JsonTestAction extends ActionSupport
    {
            private static final long serialVersionUID = 1L;
            private Map data = new HashMap();
            // log decelaration         
            public Map getData()
            {
                    return data;
            }
    
            public void setData(Map data)
            {
                    this.data = data;
            }
    
            @Override
            public String execute()
            {
                    logger.log(Level.FINE, "action parameters: " + data);
    
                    return SUCCESS;
            }
    }
    
    
    var submit = function()
    {
        var data = {data: {j1 : 'one', j2: 'two', j3: [1, 2, 3, 4, 5], j4: {a: 'A', b: 2, c: '3'}, j5: 2, j6: '2'}};
        jQuery.ajax(
        {
            type: 'POST', 
            url: '/blah/jsonTest.action', 
            data: jQuery.toJSON(data),
            dataType: 'json',
            async: false ,
            contentType: 'application/json; charset=utf-8',
            success: do what you want here}
        });
    

    how json works with Struts2 refer this

    JSON Plugin for Struts2
    };

    hope this will help you

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to create an if statement in PHP that prevents a single post
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string

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.