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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:28:21+00:00 2026-06-16T16:28:21+00:00

I have many submit buttons in my plain HTML . The one not working

  • 0

I have many submit buttons in my plain HTML . The one not working is as below:- the other are as same as below

< form:submit cssClass="action-button" name="excelBTNX" value="Excel" id="excelBTNX"  /> 

The function of the above button in the controller is to create a excel sheet and put in session(I can download it from cookies ) and returns back .

The defination of the corrosponding method in Controller is as same as for other buttons which are working fine .

The problem with this is ,it works only at even count hit .When I click for the first time the page gets refreshed . When I click for the second time , control passes to the controller and my excel comes up as cookies.

I tried to track whether the submit is working or not with javaScript code as

     $(‘form’).submit(function(){
     alert("event getting fired");
});

and it gives the alert for both the cases.

I have done the validation part from the controller(manually), so local inbuilt validators are not used . So I believe they are not the case.

How do I fix it ?

Controller codes:-

 @RequestMapping(value = "execute.action", method = RequestMethod.POST, params = "excelBTNX")
public String excelOut(HttpServletRequest request, HttpServletResponse response,
        @ModelAttribute("mymodel") myModel model, BindingResult bindingResult, ModelMap modelmap) {

    scr14(request).initializeSomeCalculation(model);// some innercalss called to manupulate model
    HttpSession session = request.getSession(false);

    if(1=1){//CRUD condition here true in READ mode.
        model= new myModel ();
    }


    byte[] excel = createExcelS14(model,request);
    String fileName = getExcelName() + ".xls";
    String filepath = myFrameWorkUtils.createTempFile(excel, fileName);
    if (session != null) {
        session.setAttribute(fileDownload, filepath);
    }
  scr14(request).initializeSomeCalculation(model);
    model.setDate(somedate);
    return "myPanel";}

  • 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-16T16:28:22+00:00Added an answer on June 16, 2026 at 4:28 pm

    Here are some steps:

    • Check whether this issue is related to your Excel processing or whether it is something with your Controller. I assume you have something like
    @RequestMapping(..., params = "excelBTNX")
    public ModelAndView next(...) 
    { <EXCEL FUNCTIONALITY> }
    

    Just comment out the in the Controller and verify that the method is called every time. Please test this a let us know whether this is working.

    • What happens that makes you think the Controller is only called at the second click? Maybe the signs that you are looking at don’t really mean that the controller is only called every second click. Please explain.

    • Fix if (1=1) code. = in Java is the assignment operator, == is the comparison operator. I assume you want to do a comparison. It also seems like you simplified this part of the code, but it may actually be the problem. Please post the actual code here.

    • I don’t see anything about cookies here. It looks to me like you are creating a temporary Excel file, and setting the name of the file in the session.

    session.setAttribute(fileDownload, filepath) cannot work, since the key of the session attribute map is of type String. It should probably be session.setAttribute("fileDownload", filepath).

    • Can you see whether there is a new temp Excel file generated with each click? You should be able to tell by the timestamp.

    This may still not point to the problem, but it will certainly get us closer.

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

Sidebar

Related Questions

I have a form with many fields and 2 submit buttons. I want to
I am hooking into Html Form submissions where the submit buttons have a specific
I want to submit a form that have many checkboxes with different values, using
I have read many articles explaining how to handle 2 submit buttons in a
I have a form with many buttons all of which print a value in
I have one asp.net form. In it i have many fields which are required.
I have too many number of radio buttons inside a form with different names,
I have many buttons in my layout and they work well. I want to
I have many MySQL statements that are running under MySQL 4, but not MySQL
I have a form I'm trying to set up ... Users can have many

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.