Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Using jstl split function  RSS feed

 
Steve Dyke
Ranch Hand
Posts: 1759
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it normal that when I use jstl split on a string like 2,1748,,Steve to have the splitarray[2] be assigned the value of Steve when this is really the value of splitarray[3]? This is sure messing up things when the string to split has a blank value in it.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37180
515
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've never used that function because I keep my logic completely out of the JSP. If I had to do a split, I would add a method to my model object with methods like model.returnNameOfUser() and implemented as split[3]. Then I can trust Java code - which I can unit test to make sure it behaves as expected.

While the results you are seeing are unintuitive, the fact that nobody has commented either way implies that's how it works or nobody is using this feature/scenario.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!