<%!
String str = "prerna";
%>
<jsp:include page="index.html">
<jsp:param name="type1" value=<%=str%> >
</jsp:param>
</jsp:include>
I want to pass a java variable in the param tag,but i am not sure how to do it.
I also want to access it in index.html
.
Can anyone suggest me the way to do it ?
Just put it in value
directly.
<jsp:include page="index.html">
<jsp:param name="type1" value="prerna" />
</jsp:include>
Or use JSTL <c:set>
to set it and EL ${}
to get it.
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
...
<c:set var="type1" value="prerna" />
...
<jsp:include page="index.html">
<jsp:param name="type1" value="${type1}" />
</jsp:include>
And if your included page is a jsp, then you can use it as ${param.type1}