• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

error in jstl while writing c:if

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I wrote a html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>

<TITLE>p442.html</TITLE>
</HEAD>
<BODY>
<P><strong>When you buying a car what is most important to you?</strong></P>
<FORM METHOD="POST" ACTION="p442Jstl.jsp">
<INPUT TYPE="RADIO" NAME="btn1" VALUE="Performance"> Performance <BR>
<INPUT TYPE="RADIO" NAME="btn1" VALUE="Safety"> Safety<BR>
<input type="RADIO" Name="btn1" value="Maintance"> Maintance<br>
<input type="submit" value="submit">

</FORM>

</BODY>
</HTML>
and I wrote a jsp

<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<html><body>
<% String Pref = (String)request.getParameter("btn1"); %>
<c:if test="${pref eq "Performance"}">
Now you can stop even if you do drive insanely fast
</c:if>
<c:if test="${pref =="Safety"}" >
Our breaks won't look up no matter how bad drive you are
</c:if>
<c:if test="${pref == "Maintance"}">
No Problem you won't have to service these breaks
</c:if>
</body></html>


while runing this code in Tomcat 5.0 I am geting this error
org.apache.jasper.JasperException: /p442Jstl.jsp(5,34) equal symbol expected.


Can anybody explain me where I did wrong?
Thanks
Jyothi
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
instead of 'eq' use ==.
In JSTL that's acceptable to compare Strings, the compiler will translate it into a call to equals() for you.
 
Oh, sure, you could do that. Or you could eat some pie. While reading this tiny ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic