Reputation: 29
This is my first post and I'm having problems with a servlet to interpret a variable I created to sequentially name two TAGs on a page running with Liferay.
Apparently the JSP interprets correctly for some TAGs and some does not. This is strange to me.
The following is an example of the code:
<div id="buttons<%=sequencia%>"> <aui:a href="javascript:printdiv('content<%=sequencia%>');" cssClass="bt_esquerda<%=sequencia%>">Imprimir<%=sequencia%></aui:a>
<div id="buttons1"> <a href="javascript:printdiv('content<%=sequencia%>');"
class="bt_esquerda<%=sequencia%>">Imprimir1
Does anyone have any idea WHY it can not resolve within the single and double quotation marks of the <a>
tag, but can <div>
?
Even if you do not know, do you have any alternative ideas?
Thank you.
Upvotes: 2
Views: 108
Reputation: 29
I resolved my problem creating a string before the TAG and using it instead that way.
String link = "javascript:printdiv(\'content" + sequencia + "\');"; <aui:a href="<%=link%>" ...
Thanks for your help, Pankajkumar.
Upvotes: 1
Reputation: 4210
The reason of issue is aui:a represents custom aui anchor tag; which has its implementation whereas div is generic html tag.
You may use any of below alternative
<aui:a href="javascript:;" onClick='<%="javascript:printdiv(\'content+<%=sequencia%>+\');" cssClass="bt_esquerda<%=sequencia%>">Imprimir<%=sequencia%></aui:a>
<aui:a href='<%="javascript:printdiv(\'content+<%=sequencia%>+\');" cssClass="bt_esquerda<%=sequencia%>">Imprimir<%=sequencia%></aui:a>
Upvotes: 1