How should I access the param1
value from the included jsp (navMenu.jsp
)?
<jsp:include page="navMenu.jsp" > <jsp:param name="param1" value="menu" /> </jsp:include>
The include directive is used to include a file during the translation phase. This directive tells the container to merge the content of other external files with the current JSP during the translation phase. You may code include directives anywhere in your JSP page.
To pass the parameters from index to file page we are using <jsp:param> action tag. We are passing three parameters firstname, middlename and lastname, for each of these parameters we need to specify the corresponding parameter name and parameter value.
The <%@include file="abc. jsp"%> directive acts like C "#include" , pulling in the text of the included file and compiling it as if it were part of the including file. The included file can be any type (including HTML or text). The <jsp:include page="abc.
${param.param1}
(preferable) or request.getParameter("param1")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With