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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:56:16+00:00 2026-05-26T23:56:16+00:00

I have been trying to display json data in my jsp using struts and

  • 0

I have been trying to display json data in my jsp using struts and json. I am using jquery post to send the data to the action class, on success, it should fire a callback function is jquery post.But the callback is not fired.

I am unable to find the missing link in this.

Here are my codes..

My struts xml..

   <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
   "http://struts.apache.org/dtds/struts-2.0.dtd">

   <struts>

<constant name="struts.enable.DynamicMethodInvocation" value="false"></constant>
<constant name="struts.devMode" value="false" />
<constant name="struts.custom.i18n.resources" value="ApplicationResources"></constant>

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

  <action name="some" class="action.Testing">
    <result type="json">
     <param name="root">displaying</param>
     <param name="noCache">true</param>
    </result>

  </action>

 </package>

 </struts>

My jsp page is the following..

 <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
  pageEncoding="ISO-8859-1"%>
  <%@ taglib prefix="s" uri="/struts-tags" %>
  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  http://www.w3.org/TR/html4/loose.dtd">
 <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>


<SCRIPT type="text/javascript" src="javascript/json.js"></SCRIPT>
<SCRIPT type="text/javascript" src="javascript/jquery.js"></SCRIPT>
<SCRIPT type="text/javascript" src="javascript/jquery.form.js"></SCRIPT>
 <script type="text/javascript">

  function somecallback(displaying){


     var result = displaying.split(",");

  var dataintext = result[0];

    $('#sub').val(dataintext);

   }


  function test(){

    var input = { "text" : "testing entry data",
               "displaying" : "hello"
            };  

       $.post('some.action',input,somecallback,"json");
  }

    $(function(){
    $('#field').click(function(){
     test();
     return false;
     });

 </script>
 </head>
 <body>
 <s:form method="post">
 hello..
<s:submit id="field" value="click me too!!"></s:submit>
<s:textarea id="sub" name="tes" value="%{text}"></s:textarea>
<s:textarea id="second" name="tester"></s:textarea>
<div id="flag" style="height:100px;width:20px;">sfdsf</div>
<input type="text" id="hi" name="help" value="clicked here!!" />"
</s:form>
</body>
</html>

Any Suggestions and help greatly appreciated..

Thank you,
hemanth.

  • 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-26T23:56:16+00:00Added an answer on May 26, 2026 at 11:56 pm

    try changing the order you’re linking the scripts, jquery should be before you like any file using jquery

    <SCRIPT type="text/javascript" src="javascript/jquery.js"></SCRIPT>
    <SCRIPT type="text/javascript" src="javascript/json.js"></SCRIPT>
    <SCRIPT type="text/javascript" src="javascript/jquery.form.js"></SCRIPT>
    

    Also, don’t use onclick use:

    $('#field').click(function(){
       test();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi, i have been having some problems using JSON data in flash builder lately
I have been trying to display a table of results for weekly sales using
I have been trying to display image from database using php but i am
I'm new to Flash/AS3 and I have been trying to display objects from class
I have been trying to implement Win32's MessageBox using GTK. The app uses SDL/OpenGL,
I have been trying to make a case for using Python at my work.
I have been trying to figure out how to display a background image behind
I've been trying to get this really simple example of using AJAX with JQuery
I have been using the JEditable plugin for JQuery and I would like to
I have been trying to display a MySQL table for some time and I

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.