KonaKart Community Forum

General Category => Feature Requests => Topic started by: ryanlynch on October 18, 2008, 04:00:17 am

Title: header.jsp
Post by: ryanlynch on October 18, 2008, 04:00:17 am
In header.jsp there is the following code for splitting nav parameters:

      <logic:iterate id="n" name="kkEng" property="nav" type="java.lang.String">
         <%if (n!=null && n.split(";").length==2){%>
            &raquo;&nbsp;<html:link page="<%=n.split(";")[1]%>"><%=n.split(";")[0]%></html:link>
         <%}else{%>
            &raquo;&nbsp;<bean:write name="n" filter="false"/>
         <%}%>                                              
      </logic:iterate>

Using a semi colon as the split identifier can cause problems if you have HTML code in the string --for example, I use the HTML code for an apostrophe (#39;) in my name field and since HTML codes end with a semi colon, a false split occurs.. I think its risky to assume the nav string will never contain an intentional semi-colon.
Title: Re: header.jsp
Post by: ryanlynch on October 18, 2008, 04:31:15 am
update: I was able to fix this --for my purposes anyways.

If the semi-colon in n.split(";") is replaced with the regular expression (&#?[^;]*;[^&]*)?;    -- like this: n.split("(&#?[^;]*;[^&]*)?;") , then it will only select semi-colons that are not part of a HTML entity..

Still not in anyway an eloquent long term solution...

-Ryan