Solved

JSP with ajax

Posted on 2014-01-30
9
731 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
Technology Partners: 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

There is basically two types of AJAX request in mootools. Request  and Request.HTML Request: Request is the basic XHR request class in MooTools. While not extremely useful on its own, it provides the basic functionality for both Request.HTM…
OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

690 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