ravi
ravi

Reputation: 838

how to use variable in page attribute of jsp include tag?

how to use variable in page attribute of jsp include tag ?

<jsp:include page="/adminadvertisement?type=c80&action=showall" /> 

I want to insert a variable passed as parameter in page attribute .Something like

<jsp:include page="/adminadvertisement?type={$param.type}&action=showall" />

Upvotes: 1

Views: 6573

Answers (2)

BalusC
BalusC

Reputation: 1109502

Use <jsp:param> (and fix your incorrect EL expression, it should follow ${} syntax)

<jsp:include page="/adminadvertisement">
    <jsp:param name="type" value="${param.type}" />
    <jsp:param name="action" value="showall" />
</jsp:include>

However, since it's to be derived from the request parameter, you should be able to use ${param.type} inside the included JSP page page directly without passing it as <jsp:param>.

Upvotes: 6

home
home

Reputation: 12538

Use ${param.type} instead of {$param.type}, if this does not work use param tag:

<jsp:include page="/adminadvertisement"> 
    <jsp:param name="type" value="${param.type}"/>
</jsp:include>

Upvotes: 4

Related Questions