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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T02:12:24+00:00 2026-05-20T02:12:24+00:00

I have used the jQuery AJax call to send JSON as documented here in

  • 0

I have used the jQuery AJax call to send JSON as documented here in StackOverflow

The problem is that I am not receiving any Data on the server . I can see that the call did reach the target ajax behavior — but in onRequest() method , the RequestCycle dd not contain any parameters

My Wicket Code:

        AbstractAjaxBehavior ajaxSaveBehaviour = new AbstractAjaxBehavior(){
        private static final long serialVersionUID = 1L;

        @SuppressWarnings("unchecked")
        public void onRequest()
        {
            //get parameters
            final RequestCycle requestCycle = RequestCycle.get();



            final PageParameters pageParameters = new PageParameters(requestCycle.getRequest().getParameterMap());
            logger.info(" I have received something 1");

            for(String pkey: requestCycle.getRequest().getParameterMap().keySet()){
                String[] valArry= requestCycle.getRequest().getParameterMap().get(pkey);
                StringBuffer sb = new StringBuffer();
                for(String s: valArry) sb.append(s).append(" , ");
                logger.info("pk :"+ pkey + " = "+ sb.toString());
            }

            //do something using nice json library to produce a string of json

            logger.info(" I have received something 2");
            for(String key: pageParameters.keySet()){
                Object o= pageParameters.get(key);
                logger.info("received key : "+ key + "   = " +o.toString());                    
            }





            String data="ok";        

            requestCycle.setRequestTarget(new StringRequestTarget("application/json", "utf-8", data));
        }


    };
    add(ajaxSaveBehaviour);
    String callBackURL= ajaxSaveBehaviour.getCallbackUrl().toString();

My Javascript that invokes this method

console.log(" call back url :"+ callBackURL);
           $.ajax({
                url: callBackURL,
                type: 'post',
                cache: false,

                data:JSON.stringify(ccbArry[0]),
                contentType: 'application/json',
                dataType: 'json',
                complete: function() {
                        alert(" completed okey dokey!")
                }

            });

From my Firebug console, I can see that the JSON POST was made succesfully and the alert(” completed okey dokey!”) dos get triggered.

The problem is that on the Wicket AbstractAjaxBehavior is unable to find any parameters in the RequestCycle.

Is there something I am missing ? The funny thing is that I ran this is debugger asn I could not find any parameter. This looks like an encoding issue.

From Firebug, I could see that this was the call that was made

http://localhost:8080/mywebapp-web-1.0-SNAPSHOT/?wicket:interface=:0::IActivePageBehaviorListener:0:&wicket:ignoreIfNotActive=true&%7B%22type%22%3A9504%2C%22sourceNewsClipBean%22%3A%7B%22type%22%3A9503%2C%22id%22%3A%224cf05752acc1d6aebface86d%22%2C%22typeString%22%3A%22NEWSCLIP_TYPE%22%7D%2C%22startOffset%22%3A%22195%22%2C%22clipDuration%22%3A%22297%22%7D=

Somehow , these parameters do not apperd in the RequestCycle. It looks like an encodong issue . Any ideas ?

  • 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-20T02:12:25+00:00Added an answer on May 20, 2026 at 2:12 am

    ok I found the solution : The keys was to not use requestCycle.getRequest().getParameterMap() to read the JSON from the browser. Instead read the data directly from the servlet input stream as below:
    It works .

                public void onRequest()
            {
                //get parameters
                final RequestCycle requestCycle = RequestCycle.get();
    
    
                WebRequest wr=(WebRequest)requestCycle.getRequest();
    
                HttpServletRequest hsr= wr.getHttpServletRequest() ;
    
                try {
                    BufferedReader br = hsr.getReader();
    
                           String  jsonString = br.readLine();
                           if((jsonString==null) || jsonString.isEmpty()){
                               logger.error(" no json found");
                           }
                           else {
                               logger.info(" json  is :"+ jsonString);
                           }
    
    
    
                } catch (IOException ex) {
                    logger.error(ex);
                }
    
    
                // json string to retir to the jQuery onSuccess function
                String data=getReturnJSONValue();
    
                logger.info("returning json :"+ data);
                IRequestTarget t = new StringRequestTarget("application/json", "UTF-8", data);
                getRequestCycle().setRequestTarget(t);
    
    
                //requestCycle.setRequestTarget(new StringRequestTarget("application/json", "utf-8", data));
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Environment used: ASP.NET, jQuery I have the following AJAX call: var tempVar = JSON.stringify({plotID:currentId});
I have some jQuery with an Ajax call that looks like this: $.ajax({ type:
Drag is not working after dropping on the area. I have used Jquery UI
I have not used jquery much yet and not very familiar with it. Trying
I am performing a jQuery .ajax() call that returns a List<string> of IP addresses
timeline.js + MVC + Ajax + JSON hello, I have problem while converting string
I have code that when I do an ajax call, it refreshes a column
Initially, I used a .js file that contains AJAX functions to call a .php
I have used JQuery for a small animation work: a table #photos contains 9
I have used JQuery within my asp.net page. JQuery is working fine. I could

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.