Dynamic Content / Conditional Content Example using Java Server Pages (JSP) |
Connect is able to pass parameter values to JSP scripts in order to personalize content directed at your cusotmers.
http://example.com/content.jsp?City=Torontothe mapped attribute is "City" (in this case with a value of 'Toronto')..
<%= request.getParameter("City") %>
In the example below, the script defines the content accessible to customers whose 'City' attribute has the value of 'Toronto' (i.e. "Special Toronto Content"). Customers that do not have a 'City' attribute value of 'Toronto' receive the alternate content (i.e. "Content for Everyone Else!").
<% String city = request.getParameter("City"); if (city.equalsIgnoreCase("Toronto")) { %> Special Toronto Content! <% } else { %> Content for Everyone Else! <% } %>