• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Can we use Ajax only with JSP's?

 
Ranch Hand
Posts: 341
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it possible to use Ajax with all the Java code residing in JSP's. What I mean is, can we implement Ajax without using any framework or model like Struts, Servlets or anything. Is it feasible to achieve Ajax functionality if all you have is a JSP page which contains all java code on it.

Any help or suggestion will be highly appreciated. Thanks in advance.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can request plain old text files, xml files, html files, .NET code, etc. It really does not matter what you are requesting.

Eric
 
Anubhav Anand
Ranch Hand
Posts: 341
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Eric for the reply.

So, what I understand is:
When I say lines like


Then, it's not necessary to have a form to post to. I can request for a normal text message also. But, in that case how exactly the script is to be modified.

Say, e.g. if i have just a button a text field on a html. I just want to replace the text in text field on click of button via Ajax. Say initial is "HI" and on click of button it comes as "HELLO".
So, how exactly to use the request object in that case. Basically, how will
[/CODE]
the above lines change. Because, all the times I use a form and post to it to get data via java. But, this time I don't have a form or a class. How to achieve it?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Again, what and how you do anything on the server doesn't matter! No matter how the response is created on the server, your Ajax code just gets a text response and will deal with it the same way.
 
Anubhav Anand
Ranch Hand
Posts: 341
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Eric and Bear for the replies.

I feel so dumb for not thinking on these lines before. Anyway thanks a lot for just hitting on the right notes.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic