Meaningless Drivel is fun!*
The moose likes Struts and the fly likes 2 doubts in AJAX Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "2 doubts in AJAX" Watch "2 doubts in AJAX" New topic
Author

2 doubts in AJAX

murali kankanala
Ranch Hand

Joined: Nov 15, 2004
Posts: 110
1) If the DataBase is taking lot of time to produce the results in Action class (depending on the results i want to set the values into XML) then,
automatically the AJAX response also will have to wait upto until the DataBase results comes.

So although using AJAX the user have to wait upto DataBase results comes to Action class

Is the AJAX right one to use in this case ?
Is the AJAX having solution for this ?

2) Can we set the Attributes into HttpServletRequest in Action , and reading those in JSP.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
There's nothing magic about AJAX. A call across the network to the database still takes exactly as long as it does with a traditional web application. The increase in speed comes from the fact that an AJAX call can just replace part of the data on the page rather than refreshing the whole page.

The "A" in AJAX stands for asynchronous, which means that when a request is submitted, the user gets back control and can perform other actions while the server is working. When the server returns a response, a callback function is called that uses the information returned to modify the page.

Because of this return of control, the response often seems faster to the user than it really is.

In answer to your question about whether AJAX is the right technology to use: I would answer that in about 98% of the time, the answer is no. Most of the tasks that a web application needs to do can still be best accomplished in the traditional way using the "display a page: submit a form" approach. However, AJAX can be very useful for the other 2 percent of cases. Examples:

* Auto-suggest boxes (User starts typing and a list of suggestions appears)
* Cases where the choices in a second dropdown box are dependent on the choice made in the first dropdown
* Cases where you want the user to be able to drag and drop something

2) Can we set the Attributes into HttpServletRequest in Action , and reading those in JSP.


No, you can't. It's a completely different paradigm. To understand how it works, google "ajax basic tutorial" and try it out.
[ May 23, 2006: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: 2 doubts in AJAX
 
Similar Threads
Ajax and ActionClass
jsp and ajax
jsp and ajax
How to validate text fields after enter key press
Show images dynamically from DB