File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ajax - Struts - JSP

 
Seby Pappachan
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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".
 
Seby Pappachan
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear,

Thanks for the help!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic