Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7852183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:21:37+00:00 2026-06-02T19:21:37+00:00

How can I split strings separated by / inside a jsp page using JSTL?

  • 0

How can I split strings separated by “/” inside a jsp page using JSTL?

I have a string in this format:
**

“23/11/2010”

*. Sometimes, the string could be like this: *

“1/1/2010”

*.
I need to do something in order to split the string in three different substrings:
*

“23”, “11”, “2010”.

**
This is because I need to put each one of them inside three different text fields, like these:

<input type="text" value="23">/
<input type="text" value="11">/
<input type="text" value="2010">

I could not find any working example yet.

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T19:21:39+00:00Added an answer on June 2, 2026 at 7:21 pm

    You can use the fn:split() function for this.

    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
    ...
    <c:set var="dateParts" value="${fn:split(dateString, '/')}" />
    ...
    <input type="text" name="day" value="${dateParts[0]}" />
    <input type="text" name="month" value="${dateParts[1]}" />
    <input type="text" name="year" value="${dateParts[2]}" />
    

    Be sure that the date format is validated beforehand 🙂 It would be easier if it was a java.util.Date, not a java.lang.String. You could then use <fmt:formatDate> to format it to a reliable and fixed string format first. Otherwise you’d need to add checks on array length by fn:length() and to prevent potential XSS attack holes by fn:escapeXml().

    Also important to note is that the function takes a regular expression as argument and not just a plain character sequence. So in case you’d like to split on characters which represent special characters in regex, then you’d need to escape them with backslashes. See also How to split a string in Java for general guidelines which also apply to fn:split().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I convert my list of strings: List<string> appliedFilters = filterString.Split(',').Select(n => n).ToList();
I want to split a string that can look like this: word1;word2;word3,word4,word5,word6.word7. etc. The
I have a string that's like this: 1|value|; I want to split that string
I want to split a semicolon separated string so that I can store each
With the help of string.join , we can split a comma-separated list of values.
How can I split a string into an array of strings based on a
I have a string of words separated by ([ \\t{}():;.,،\\n]) . How can I
How can I split a String by Unicode range in Ruby. I wanted to
How can I split a string such as Mar10 into Mar and 10 in
for example, can i do this: split = temp_string.Split(<beginning of record>) those of you

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.