This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Include tag in a conditional statement in jsp  RSS feed

 
Ayvid
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am using the jsp include tag in a conditional if statement.
The jsp file that I am including is a file of string constants.

Below is the code which i am using:

<%
if(true)
{
%>
<jsp:include page="string-constants.jsp" flush="true"/>
<%
}%>

out.println("testing"+TEST);

I am getting an error that cannot resolve symbol symbol : variable TEST.
variable TEST is from the string-constansts jsp.

Can anyone tell me what can be the solution to this.

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Ayvid BV",

We're pleased to have you here with us on the Ranch, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ayvid, please re-read. Your display name must be a first and a last name separated by a space character.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
by using <jsp:include ... /> you include the result of running the included page, not the page itself.
What you need in your case is <%@include ... %> which includes the source of the included file into the compilation unit rather than the result of a separate compilation unit in the output stream of the including compilation unit.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!