• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSLT printing c:out value

 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I want to print the hastable name value, but its not working.
Here is the code, I want to print name key value.
===========
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.util.*" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<html>
<head>
<title>c:set test</title>
</head>
<body>
C:Set Test
<br>
<jsp:useBean id="n" class="java.util.Hashtable" />
<c:set value="name" target="${n}" property="Hello World"/>
name values is:
<c ut value="${n.name}"/>

</body>
</html>
============
I except the out Hello World, But its not printing.
Any help?
SR
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try the following:
<jsp:useBean id="n" class="java.util.Hashtable" />
<c:set value="Hello World" target="${n}" property="name" />
name value is:
<c ut value="${n.name}" />
I got the Hello World.
 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. uri for core is uri="http://java.sun.com/jsp/jstl/core" not
uri="http://java.sun.com/jstl/core" as suggested in JSTL spec.
2. with

you put a string ("name") with key ("Hello World") into the Map ${n}
if you want to print the value with key "Hello World"
you need to use

not

because the there is not key ("name") availible in the map ${n}

btw: is not working

Originally posted by sun ram:
Hi,
I want to print the hastable name value, but its not working.
Here is the code, I want to print name key value.
===========
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.util.*" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<html>
<head>
<title>c:set test</title>
</head>
<body>
C:Set Test
<br>
<jsp:useBean id="n" class="java.util.Hashtable" />
<c:set value="name" target="${n}" property="Hello World"/>
name values is:
<c ut value="${n.name}"/>

</body>
</html>
============
I except the out Hello World, But its not printing.
Any help?
SR

 
sun ram
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, It worked.
-SR
 
crispy bacon. crispy tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic