<bean:write name="<%=(String) currentItr.next()%>" property="<%=(String) currentItr.next()%>"/>

The above code prints the values aka : Nicholas...$100000...45....Actor

How can i assgin Nicholas to a javascript variable?

I tried

var audition = <%=(String) currentItr.next()%>.<%=(String) currentItr.next()%>;

and it prints out the column header like so : Name...Salary...Age...Occupation

what am i doing wrong?

有帮助吗?

解决方案

You should try this , if you are assigning string value then use ' ' or " " . For Number value what you wrote was correct .

var audition = "<%=(String) currentItr.next()%>.<%=(String) currentItr.next()%>";

其他提示

@LandLane Why don't you set this scriptlet value into hidden text box, and call the value from JS. How do you calling the javascript from java? If you are using logic:iterate tag means there may be n number of values like nicholas. Post your code, unless nobody can't diagnose it.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top