First of all in JSP
<%=varName%>
scriptlet means: change line a) with
varName.toString()
It is so strange that you want to output a variable whose name is unknown.
This is similar to Java. You write
String aVariableString = "test String";
System.out.println(aVariable+"String");
This makes no sense.
However, I can provide a similar code for yours depending on the situation:
, :
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<script>
function addBid(){
var bidId = document.getElementById("bidId").value;
}
</script>
<input type="hidden" id="bidId" value="<c:out value=${containerIndexes[knownIndex]}" />
<custom:tag onclick="addBid();" />
, , :
<c:forEach var="bid" items="${bids}">
<c:out value=${bid.name} /> <custom:tag onclick="addBid(${bid.index});" />
</c:foreach>
bid, , ,
getName()
getIndex()
.
JSP ,
<custom:tag onclick="addBid('${bid.index} whatever string you want here');" />
12, - :
<whateverCustomTagDoes onClick="addBid('12 whatever string you want here') />
( JSP) , ( - JavaScript-eval-), :
<custom:tag onclick="addBid('<%=container_index%>string');" />