asked on
ASKER
<c:if test="${dbname}== 'mydatabase'}">
<c:if test="${dbname == 'mydatabase'}">
ASKER
ASKER
ASKER
ASKER
ASKER
<%@ taglib uri = "http://java.sun.com/jsp/jstl/core" prefix = "c"%>
<table border="0" cellspacing="1" width="80%" >
<tr>
<td width="12%"></td>
<c:set var="dbname" value="mydatabase" scope="page" />
output: <c:out value="${dbname}" />
<c:if test='${dbname eq "mydatabase"}'>
<td>Introduction to the CCP</td>
</c:if>
<td>How to complete your profile in CCP</td></tr>
<tr>
<td width="12%"></td>
<c:if test='${dbname eq "mydatabase"}'>
<td><iframe width="210" height="136" src="http://www.youtube.com/embed/xxxxx=0" frameborder="0" allowfullscreen></iframe></td>
</c:if>
JavaServer Pages (JSP) allow the development of dynamically generated web pages. It uses the Java programming language; JSP pages are translated into servlets at runtime, with each servlet being cached and reused until the JSP is modified. JSP allows Java code to be interleaved with static web markup content, so the resulting page can be compiled and executed on the server to deliver the content.
TRUSTED BY
ASKER
I tried the code you suggested but it did not give me the result I wished. I double checked that I could see the value of dbname when using c:out value and it was present.
I then changed the eq to ne but still did not see any result so I wonder if the problem lies in the rest of my code.
Could you run your eye over it and see if I have anything wrong? I am trying to display a single video if the user belongs to one database and two video's if the user belongs to mydatabase.
<div clsss="showvideo">
<table border="0" cellspacing="1" width="80%" >
<tr>
<td width="12%"></td>
<c:if test="${dbname eq 'mydatabase'} ">
<td>Introduction to the CCP</td>
</c:if>
<td>How to complete your profile in CCP</td></tr>
<tr>
<td width="12%"></td>
<c:if test="${dbname eq 'mydatabase'} ">
<td><iframe width="210" height="136" src="http://www.youtube.com/embed/xxxxx=0" frameborder="0" allowfullscreen></iframe><
</c:if>
<td><iframe width="210" height="136" src="http://www.youtube.com/embed/xxxx?rel=0" frameborder="0" allowfullscreen></iframe><
</tr>
</table>
</div>