0

I have jsp shopping pages that need to have specific images assigned when specific category is clicked. So I want to say "if url ends in 'category/bags' then choose this code.

I see "category/bags" in my browser on the page, but when I print out the servlet path it calls the page "CategoryDisplay.jsp" in browser.

I understand there's a difference in the views and I need to use RequestDispatcher.forward.

So how do I A) print out the page that I am on to see what it ends with in request dispatcher forward so I can then B) properly assign that category page in a test statement.

I've tried this: A)

    <% System.out.println("request URI= " + request.getAttribute("javax.servlet.forward.request_uri"));

B)

     <c:if test="${fn:endsWith(javax.servlet.forward.request_uri, 'Bags')}">
    <div class="hero" style="background-image: url('/images/static/shop/hero_bags.jpg');">
        <div class="hero-text">
            <h1>Bags</h1>
        </div>
    </div>
</c:if>   
K. R.
  • 5
  • 5

0 Answers0