This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
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

Ajax with java

 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using ajax with servlets. So for every different ajax call, i am calling a different servlet, getting the data through a simple Dao class and sending back as the response to html , something like this
Servlet class


So, can i directly call my simple java class (Dao) from html for ajax calls, (instead of calling it indirectly through servlet)? If yes, how can i send it back as a response (from simple java class) to ajax code(html)?
 
Saikat Mukherjee
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even with ajax , the entire thing boils down to HttpServletRequest and HttpServletResponse.
There is no obvious way to do what you are asking for; afterall both the request and response objects will be handled by the container only.
 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply Saikat Mukherjee.

That means, that if my form has various textfields with different ajax calls, then, i will have to go for that many servlets?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or possibly institute a front controller.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic