This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes How to pass runtime variables to Javascript function on onclick event form struts html:button tag ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to pass runtime variables to Javascript function on onclick event form struts html:button tag ?" Watch "How to pass runtime variables to Javascript function on onclick event form struts html:button tag ?" New topic
Author

How to pass runtime variables to Javascript function on onclick event form struts html:button tag ?

pratibha patel
Greenhorn

Joined: Feb 22, 2007
Posts: 15
Hello All,

My Problem is I am not able to call my Javascript function on onclick event of button from struts html:button tag. I am iterating some values from bean and passing those values to Javascript function "MyFunction". How to do that ? I am using struts tag <html:button > instead of pure HTML tag <input type = button>

Below code not working for struts tag for button


If I use pure HTML tag for button then it is working fine->


Please help me on this.
Thanks.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41050
    
  43
Post the HTML that works for you, and the HTML that is generated by Struts.


Ping & DNS - my free Android networking tools app
Karthik Jayachandran
Ranch Hand

Joined: Feb 18, 2009
Posts: 88


JSTL expressions may work with struts tags,

try using like,
pratibha patel
Greenhorn

Joined: Feb 22, 2007
Posts: 15
Hello Karthi,

Thanks for your reply, but my problem has no yet resolved. Find below explanation.

I have tried above code, it calls javascript function"myFunction" but takes value as it is. When I try to get values, for example->

it gives value "${no_list}". Here I want the actual value of no_list.

Karthik Jayachandran
Ranch Hand

Joined: Feb 18, 2009
Posts: 88


Oops, it is




Also these pages might help,

http://www.devrecipes.com/2009/10/19/jstl-and-struts-logic-tags-iteration-quick-reference/
http://java.itags.org/java-web-tier-apis/67929/
Saurabh Gupta
Greenhorn

Joined: Oct 06, 2007
Posts: 18
Pratibha,

Did you got any soluition for the below mentioned problem?
I am also facing similar issue and looking for some help.

Thanks Saurabh
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to pass runtime variables to Javascript function on onclick event form struts html:button tag ?
 
Similar Threads
c:when test = .....problem
calling reset on the form bean
Indexed Setting/properties
object required js error
Add text fields on click of a button