• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Ajax - Struts - JSP

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bear,

Thanks for the help!
 
reply
    Bookmark Topic Watch Topic
  • New Topic