Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JSP
Search Coderanch
Advance search
Google search
Register / Login
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:
Tim Cooke
Campbell Ritchie
paul wheaton
Ron McLeod
Devaka Cooray
Sheriffs:
Jeanne Boyarsky
Liutauras Vilda
Paul Clapham
Saloon Keepers:
Tim Holloway
Carey Brown
Piet Souris
Bartenders:
Forum:
JSP
usage of substring in jstl variable
liliya woland
Ranch Hand
Posts: 134
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hello,
i'm attempting to get a substring (last 4 chars of the
string
date) and call it var="year", can't get it to work so far. Here is what I have:
<jsp:useBean id="date" class="java.util.Date"/> <c:set var="year" value="${ substring(date, date.length-4, date.length) }" />
Could anybody please help me with this one?
Christophe Verré
Sheriff
Posts: 14691
16
I like...
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
You'd better use formatDate instead :
<
jsp
:useBean id="today" class="java.util.Date"/>
--> <fmt:formatDate pattern="yyyy" value="${today}"/>
don't forget to declare the prefix:
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
[My Blog]
All roads lead to JavaRanch
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
validating a range of values
hx:validateDateTimeRange tag issue
date formate
Get the URL value
javascript calculating between 2 dates
More...