0

i have one view where i m showing many records and now i m adding functionality for user to download those records which he will choose date from search textbox. As my search textbox in jsp outside of form tag and thus i m not getting the value of that parameter in my servlet..is there any way to get that value from outside of form tag? Here is my jsp

<div id="divOfDateTable">
Search:<input type="text" name="dropdown" id="datedropdown">
<button id="dateButton" name="dateSearch">Search</button>
</div>
<form action="Download_Servlet" class="download" method="post">     
<input type="submit" id="downloadRecords" value="Download Order-records">
</form>

In my Servlet i want to get that parameter value.i.e;Date put by user.As per the requirement only the searched records by the user needs to be downoaded. So please guys help out..

  • what should not 'datedropdown' be included inside form? – kuhajeyan Aug 22 '16 at 06:44
  • try it with java script , prevent the default form submit , and before submitting the AJAX POST call , get all the form's data plus the data you want to add. check this [answer](http://stackoverflow.com/questions/13611614/submit-the-form-using-ajax) – AntJavaDev Aug 22 '16 at 06:47
  • @AntJavaDev there is no default form submission actually..when user will click on "Download Order-Records" button he is getting all records till the time he had entered in system..but user now wants only specific orders to be downloaded based on selecting date from search box.So i did one thing that taken search box inside form and then got the parameter in Servlet.That's fine.But after submitting the form this time csv file gets downloded and the loader image for loading which i put in system gets stucked there only.What i want is Page(jsp view) should not be changed. – Rohit Kolhey Aug 22 '16 at 08:11
  • i will give one example for that..when we download any song or file from website in Chrome we click on Download button and file gets downloaded in the bottom of the chrome tab..but at the same time page from we download file did not redirected to other page.that is what the same i want. – Rohit Kolhey Aug 22 '16 at 08:15
  • 1
    thats why you are going to need an AJAX get or post call....... – AntJavaDev Aug 22 '16 at 08:32

0 Answers0