Solved

JSP with ajax

Posted on 2014-01-30
9
728 Views
Last Modified: 2014-02-03
Hi there,

I am new to ajax. Would you use ajax with jsp ? jsp already has its own setProperty , getProperty.

Any feedback is greatly appreciated. Thanks.
0
Comment
Question by:zizi21
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 27

Accepted Solution

by:
rrz earned 300 total points
ID: 39822924
>Would you use ajax with jsp  
AJAX is a  client-side  technique.  Using AJAX a browser can communicate with a server in the background without refreshing the page. JSP is a server-side technology. AJAX and JSP don't have much to do with each other. AJAX code could send a  request to a JSP, but it probably   is easier to  use a Servlet instead.    
>jsp already has its own setProperty , getProperty.    
What communication do you want between the client and your server?
0
 

Author Comment

by:zizi21
ID: 39823027
I am using java and jsp to read, write and delete data from the database. That is my communication between client and server. I am using setters/getters and when there is a need, i use redirect.
0
 
LVL 6

Assisted Solution

by:Mahesh Bhutkar
Mahesh Bhutkar earned 100 total points
ID: 39823035
Ajax is a technique to send Asynchronous XMLHttpRequest to server side.

Whereas JSP is a scripting language used at client (UI) side. Inside JSP you can use Ajax to hit server request and handle the response.

You should have basic Javascript knowledge to understand Ajax.

You will get lots of online example on "Ajax calls from Jsp" on Googling..
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 27

Expert Comment

by:rrz
ID: 39823248
>I am using java and jsp to read, write and delete data from the database    
AJAX  could call a Servlet to do those things. The Servlet could respond with the new data and and you could use javascript to display it on the page.  
Of course, a JSP could generate the page that contains the AJAX code. But AJAX and JSP shouldn't  interact with each other.    
You should give us more details describing the flow of your web application.  
Have you considered using any  frameworks?
0
 
LVL 27

Assisted Solution

by:mrcoffee365
mrcoffee365 earned 100 total points
ID: 39825213
Using JSP is fine.  Ajax is not related to whether it's a jsp or whatever on the server which is responding.  Servlets are not required to use Ajax.

As several people have responded correctly, Ajax is javascript which runs on the client -- a browser.  JSP only runs on the server.  JSP does not include getProperty or setProperty.  It's possible you're thinking of beans?  In any case, since Ajax is javascript (not java) which runs in the client and not the server, there's no possibility of conflict.
0
 
LVL 27

Expert Comment

by:rrz
ID: 39825252
mrcoffee>Using JSP is fine.  
Ok, as long as you can avoid any unintentional white space characters.
0
 
LVL 27

Expert Comment

by:mrcoffee365
ID: 39825882
Ajax is usually using text -- extra whitespace is generally not a problem.  It can be, but it's not a great idea to scare new users with edge conditions.

Perhaps you're thinking of PDFs?
0
 
LVL 27

Expert Comment

by:rrz
ID: 39825980
mrcoffee>Perhaps you're thinking of PDFs?  
No.  
JSP is good for generating  the initial view.  But, I really think that using a Servlet for AJAX communication is better than using JSPs.
0
 

Author Comment

by:zizi21
ID: 39829903
Thanks all for the comments. .
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.NET AJAX callbacks to web service are becoming very popular and unavoidable these days. The feel that the user gets when only a part of the page is updated without even hindering the UI is the advantage that the callbacks offer. The wait for the…
Today I am discussing AJAX problems in IE7 and I bet this will helps many guys out here who have problems with AJAX work. Lets start with the discovery of problem and then we will talk about its different solutions. My last two projects included …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question