Hey there.
I have a web app that uses JSP/struts to render some HTML. My problem is in the html:link tag. In every other instance on my JSP page, the variables (i.e. <%=variable_name%> render into their respective values when the HTML is output to the screen. In the "onmouseover" parameter, it is not.
This is the JSP code I am working with:
When the HTML renders, the <%=tooltip%> is visible in the source instead of the String value it contains. The <%=link%> and <%=item.getValue()%> variables render to their correct values, but not <%=tooltip%>. I added a line to just output the value of <%=tooltip%> to the screen (i.e. tooltip = [<%=tooltip%>]) and that works fine. The problem only exists within that "onmouseover" parameter.
Anyone have any ideas why this is happening? Does the "onmouseover" parameter escape everything inside the quotes and turn off the JSP render engine?
THanks for any suggestions you have!
I have a web app that uses JSP/struts to render some HTML. My problem is in the html:link tag. In every other instance on my JSP page, the variables (i.e. <%=variable_name%> render into their respective values when the HTML is output to the screen. In the "onmouseover" parameter, it is not.
This is the JSP code I am working with:
Code:
<logic:iterate id="item" name="menuitems" type="org.apache.struts.tiles.beans.MenuItem">
<% // add site URL if the link starts with "/"
String link = item.getLink();
if ("".equals(link)) {%>
<tr>
<td colspan="2"> </td>
</tr>
<% }
else if ("-".equals(link)) {%>
<tr>
<td colspan="2"><hr /></td>
</tr>
<% }
else {
%>
<tr>
<td align="center">
<img src="<%=contextPath%>/images/spacer.gif" width="12" height="12">
</td>
<td>
<%
String tooltip = "'"+item.getTooltip()+"'";
%>
<html:link styleClass="navLink"
onmouseover="showtip(this,event,<%=tooltip%>)"
onmouseout="hidetip()"
page="<%=link%>">
<%=item.getValue()%>
</html:link>
</td>
</tr>
<% }%>
</logic:iterate>
When the HTML renders, the <%=tooltip%> is visible in the source instead of the String value it contains. The <%=link%> and <%=item.getValue()%> variables render to their correct values, but not <%=tooltip%>. I added a line to just output the value of <%=tooltip%> to the screen (i.e. tooltip = [<%=tooltip%>]) and that works fine. The problem only exists within that "onmouseover" parameter.
Anyone have any ideas why this is happening? Does the "onmouseover" parameter escape everything inside the quotes and turn off the JSP render engine?
THanks for any suggestions you have!