Karls
asked on
passing javascript variable to html tag hidden field
Hi
I am trying to pass a javascript variable of type long to and struts HTML tag hidden object using the following JSP page code.
<%
long someNumberVariable = 1234567;
%>
<html:hidden property="newSomeNumberVar iableObjec t" value ="<%=someNumberVariable%>" />
if someNumberVariable is of type String then it works ok. if it is of type long then I get the following error
cannot resolve symbol
symbol : method setValue (long)
location: class org.apache.struts.taglib.h tml.Hidden Tag
_jspx_th_html_hidden_2.set Value(some NumberVari able);
I would prefer to pass the variable in as a long type rather than a String as it saves me doing casting in some class files.
Thanks
I am trying to pass a javascript variable of type long to and struts HTML tag hidden object using the following JSP page code.
<%
long someNumberVariable = 1234567;
%>
<html:hidden property="newSomeNumberVar
if someNumberVariable is of type String then it works ok. if it is of type long then I get the following error
cannot resolve symbol
symbol : method setValue (long)
location: class org.apache.struts.taglib.h
_jspx_th_html_hidden_2.set
I would prefer to pass the variable in as a long type rather than a String as it saves me doing casting in some class files.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What you could do is this:
<html:hidden property="newSomeNumberVar
That way you don't have to change any classes... only the jsp has to be modified. In HTML there are only string values... that is probably the reason why there is no setter for a numeric value. :-)
Hope this helps.