*
The moose likes Struts and the fly likes Is it possible to  pass a bean(struts) through javascript.??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Is it possible to  pass a bean(struts) through javascript.???" Watch "Is it possible to  pass a bean(struts) through javascript.???" New topic
Author

Is it possible to pass a bean(struts) through javascript.???

Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

Hi friends,
I have an issue where im expected to pass the value required for a javascript function using the value obtained from a form bean . I would like to know whether its possible to do so .
I'm looking at something on these lines (or the equivalent) in my JSP
.

And the corresponding Javascript function as :



Please help on how i could pass the bean value to the Javascript
Thanks.


Learning and Learning!-- Java all the way!
Shankar Tanikella
Ranch Hand

Joined: Jan 30, 2011
Posts: 329



implies that you are submiting a form used in your JSP

anyways, the below code should work fine as is... what is the problem that you facing?

<td><html:button property="objid"
onclick="alert('<bean:write name="listDetails" property="objid"/>')" value="Edit" > </html:button></td>


Have Fun with Java
little,little.. little by little makes a lot..
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Is it possible to pass a bean(struts) through javascript.???
 
Similar Threads
form bean value not getting
Comparing values using JSTL
Struts- Error while java.lang.IllegalArgumentException: setAttribute: name parameter cannot be null.
calling the struts action on jquery button click
pass a variable in the URl