wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes How to return just the value not whole HTML? 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 » Engineering » HTML, CSS and JavaScript
Bookmark "How to return just the value not whole HTML?" Watch "How to return just the value not whole HTML?" New topic
Author

How to return just the value not whole HTML?

ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
I am reading HRA (Head Rush Ajax) and unfortunately they have used PHP as server side technology.

I am confuse with this point.

Server returns the response (just the value not the whole HTML) and browser puts that into request's responseText property and we can get it in JS function.

First, how to return just the value from servlet???

Second, how can I return multiple values if I want???

I hope my questions are clear.
[ September 27, 2006: Message edited by: rathi ji ]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Don;t put HTML on the page, just the code you want to return.

Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60766
    
  65

A servlet can return any data you want, not just an HTML page.

It can return a JSON structure for example, which can contain as much information as you like and is easily evaluated in the Javascript.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Thanks Eric and Bear.

I am able to do it.



Thanks.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to return just the value not whole HTML?
 
Similar Threads
help with jquery ajax with jsp/servlets
Need a function that converts a double into a whole int, rounding the decimal and ret
Obtaining Values from an Applet in Web Page
Problem with RMI
Dynamically include and show what's been selected in the last page