wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes Ajax - Struts - JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Ajax - Struts - JSP" Watch "Ajax - Struts - JSP" New topic
Author

Ajax - Struts - JSP

Seby Pappachan
Greenhorn

Joined: Nov 02, 2008
Posts: 12
Hi,

I have a JSP page, in which there is a link. When i click on the link, it will execute an ajax script and in turn the script will pass the request to a struts action class. The action class will perform some DB queries.

My question is that,

Can the action class have ArrayList as the return type?

I do not want to create a html (db result may vary in size from 10 rows to 100+ rows) in the action class and pass it as a string to the caller. I want to use the iterator in JSP page.

Thanks
Seby
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60050
    
  65

You seem to have some misconceptions.

Once a JSP is sent to the browser, it is no longer a JSP -- it's a simple HTML page like any other. So there is no way for an Ajax request (or anything else) to return a Java construct that the JSP page can operate upon.

An Ajax request returns a response like any other request. It can be an XML document, an HTML fragment, a JSON construct, or any other text value. But it is a text value.

If you need to return a list of values, you could do so in XML or JSON, and have JavaScript deal with the list, but there's no way for JSP on the page to get "re-activated".


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Seby Pappachan
Greenhorn

Joined: Nov 02, 2008
Posts: 12
Bear,

Thanks for the help!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Ajax - Struts - JSP
 
Similar Threads
japplet or jpanel
Query String in AJAX
japplet or jpanel ? (struts )
Struts-AJAX issue
ArrayList and Ajax