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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:13:06+00:00 2026-06-10T01:13:06+00:00

I have a scenario where I need to call a Java method which sets

  • 0

I have a scenario where I need to call a Java method which sets some request properties and the same has to be reflected in the jsp page.

<script type="text/javascript">
  setInterval(function() {
    ajaxAction($('#refresh'), 'moveETHAction_fetchExecutorData');
    return false;
    //callNextMethod(document.getElementById('moveForm'), 'moveETHAction_',
        //  'fetchExecutorData');
  }, 60 * 1000);

      function ajaxAction(form, url) {
    /* the time and hour are added to the request for create an unique URL for IE.
     * The call to the server is realised only if the url is different...
     */
    params = Form.serialize(form) + '&ms=' + new Date().getTime();
    currentFocused = document.activeElement.id;
    lastActionCalled = url;
    formUsed = form;
    var myAjax = new Ajax.Request(url, {
        method : 'post',
        parameters : params,
        onComplete : showResponse
    });
}
function showResponse(originalRequest) {
    xml = originalRequest.responseXML;
}

 </script>

as you see, I want to hit action class and the respective method.
However I don’t have to replace anything in view part except fetching some request attributes which will be set in Java action class.

the total view part is in one form (‘sendOrder’) and i included one more form(‘refresh’ within the main form. sorry, i don’t know how to achieve my requirement. I just gave this try.

Please let me know how can I resolve this? It’s not mandatory to use AJax, all i need to do is hit the java method and display the same page with updated request properties.

  • 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-10T01:13:07+00:00Added an answer on June 10, 2026 at 1:13 am

    I am not sure how many fields you want to get from the Action and you can very well use Jquery along with Struts2-Json Plugin to do the work for you.

    S2 Json plugin will help you to send back response in JSON format and you can use Jquery JSon feature to parse those fields and fill the values as per your way.

    This is what you have to do

    var myFormValues='id='+uuid;
        $.getJSON('myAction',myFormValues,function(data) {
         $.each(data.myObject,function(key, value){
             alert(key);
                     alert(value);
        });
         });
    

    here key is the name of the field and value is the value it hold with respect to that fiel

    In above you are calling a action namely myAction which will return the JSON back based on the value sent by you myFormValues.
    This is a mock for your action

    public class MyAction extends ActionSupport{
       private String id;
       //getter and setter
       private String vallue1;
       private String vallue2;
       private String vallue3;
       //there getter ans setters
    
       public String execute() throw Exception{
           //Fill you values based on the condition
           return SUCCESS;
       }
    }
    <package name="JSON" extends="json-default">
       <action name="myAction"  class="MyAction">
         <result type="json"></result>
     </action>
    

    Hope this will give you some idea

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

Sidebar

Related Questions

I am having a scenario where I need to call a java method which
I have a scenario where I need to make a call to Java method
I have a scenario where I need to load properties from database or java
I have a scenario where I need to call a method of an Action
I have a scenario in which I think I need to lock a table
I am using Java + iBatis and have a need to call an Oracle
I have a scenario in which I have a class Resource which has two
I have a scenario where I need to use javascript to call a action
I have scenario where I need to host a web service (WCF) on Azure
I have one scenario where I need to select all files having aliencoders.numeric-digits like

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.