Solved

JSP with ajax

Posted on 2014-01-30
9
719 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
  • 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

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…
Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

770 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