Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet Called From Javascript

 
carina caoor
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi im my application i am calling a servlet from javascript with parameter as comma separated string values but as the comma separated string becomes long its not correctly getting passes as parameter to the servlet.
i have got 200 string made as a one comma separated string value now when i pass this as parameter to servlet n call it the servlet is not getting invoked ,url is not properly created.




when i put the url in the addressbar with the long csvstring... it pastes part of csvstring in address bar and rest of the string is not getting pasted and i could not add a charactar to the url further .. this is the limitation with the get request might be ...
can somebody suggest me any solution for this
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

this is the limitation with the get request might be

Most probably. In which case you will need to use a POST request instead of GET.
 
carina caoor
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
from a javascript how do i pass parameters in post to a servlet ...
any example please, because javascript here i spreparing the csv string and i need to pass it to the servlet as parameter.
 
carina caoor
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
any example where servlet is invoked by passing some long charactars as parameters from javascript ... or calling a servlet and passing parameters in post message body could help me out in solving the problem. can anyone give me this example please
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In order to generate a POST you need a form with a method of "post". Set the URL to the servelt as the action of the form tag.
 
carina caoor
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My form action is post method , here i am calling a servlet from javascript and passing a long csv string that is obtained after the user inputs data, i am not passing here the data what user enters, Actually user here in my screen uploads an excel file , i am reading a particular column from the excel file and populating the column values on the screen in a grid, now from the grid i read columns selected by user and make a csv string of the selected values and pass it to servlet along with the URL as get request pass parameters , but as the csv string created contain some 1000 strings separated by comma the url is not properly created and servlet is not getting invoked, if the csv string contains some 100 strings the url is properly getting created and servlet is being invoked , but my requirement is a long csv string to be passed to servlet as parameter ....
can you suggest me some solution please
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic