Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

pass a parameter from a struts ActionForm to a javascript fn

 
Gayatri Ganesh
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,

Is there a way to pass a parameter from the struts action or use the struts ActionForm variable to a javascript fn on the jsp which should open a new pop -up browser window with that parameter ?

Thanks,
Gayatri
 
John Smith
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you just do a bean:write inside your script tags you'll get the value of the variable as those tags are parsed before the page is loaded thus before the javascript can ever possibly be executed
 
Kim Kantola
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey, I have a similar question, but instead of passing a parameter, can you pass an actual object?

For example, I have an object, and I want to pass it to a javascript function which will then call a popup.

Can only strings be passed, or can an object be passed to a javascript function?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic