• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Struts 1: How to access Struts form data in JavaScript

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.

I need to access Struts form data in my JavaScript via JSP. Plese let me know if there is any standard way to do this.

I also need to access the request variables (set via request.setAttribute(..,..)) in my JSP which are set in Struts form. I am open to use Struts tags or Scriplets but I prefer to use standard Struts Tags in my JSP.

Please suggest me a standard procedure to achieve both.

Thank you.
 
author & internet detective
Posts: 42135
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Omi Kir:
I need to access Struts form data in my JavaScript via JSP. Plese let me know if there is any standard way to do this.


Yes. You write out JavaScript variables containing the data in your JSP. For example:
var myData = '<bean:write name="commaDelmitedListOfData" />';


I also need to access the request variables (set via request.setAttribute(..,..)) in my JSP which are set in Struts form. I am open to use Struts tags or Scriplets but I prefer to use standard Struts Tags in my JSP.

What
What kind of variables? If they are strings you can use bean efine. Otherwise, you can use jsp:useBean. Scriptlets should be a last resort for new code.
reply
    Bookmark Topic Watch Topic
  • New Topic