• Welcome to KonaKart Community Forum. Please login or sign up.
 
December 22, 2024, 01:33:25 am

header.jsp

Started by ryanlynch, October 18, 2008, 04:00:17 am

Previous topic - Next topic

ryanlynch

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.

ryanlynch

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