简体   繁体   中英

Include JSP with Java dependency on variable

I have a main JSP what is including another JSP with code like:

<div class="titulo" data-role="header" data-theme="a">
   <h1><span class="header-title"><span><%=titleHeader%></span></span></h1>
</div> 

Like you can see, titleHeader is a variable what I have declared on my main JSP (because it depends of each main JSP) and I am doing a include of another JSP where I am using it.

Eclipse shows up an error. How can I face this problem?

Thank you.

I have found the answer: Java variable across multiple include blocks - variable cannot be resolved

试试看

<c:out value="${titleHeader}" />

<% String titleHeader= "Some title " ;  %>

use your code

<div class="titulo" data-role="header" data-theme="a">
 <h1><span class="header-title"><span><%=titleHeader%></span></span></h1>
</div>

it will work

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM