JSTL to the rescue when your EJB S’plodes
Alright, so I tried using a nice wcbase: call to get the bean I wanted to I could grab the SKU, but that didn't work. Instead I ended up searching through some old IBM 561 docs until I found that I could pull an item number from catEntry. The main problem was that the number I pulled was exactly what I asked for, the item from the database (I wanted the SKU). I read a little more down the list and found that I could get the catEntry.partNumber which does give me the SKU, but it gives me the prd_ in front of it. So I checked with Mr. Google, and he showed me this site from ONJava.com that had some JSTL goodery. Most of the page was not important, but what was useful was the substringAfter command. Here are some JSTL goodies you can use in a pinch to fix a problem (and yes I realize this fix will NOT work on NordicTrack as we are incorporating apparel and that has tons of SKU's for clothing, and this fix actually does not fetch the actual SKU, but a close representation of it).
fn:substring(string, begin, end) | Returns a part of the string, starting from the begin index up to and including the end index.
fn:substringAfter(string, substring) | Returns the part of the string that follows the substring.
fn:substringBefore(string, substring) | Returns the part of the string that precedes the substring.
I ended up using the substringAfter like this --> SKU: <c:out value="${fn:substringAfter(catEntry.partNumber, 'prd_')}" /> so that I could get the prd number and then trim/substring off the prd_. I now need to go back and trim off the _21663 on a few NT products...
Print This Post