Fetching values from request attributes | Community
Skip to main content
Level 5
December 16, 2020
Question

Fetching values from request attributes

  • December 16, 2020
  • 1 reply
  • 791 views

Hi,

I am trying to set some value in request scope and fetch the same in HTL, it is not working, Not sure if this is doable in HTL without using Use API or backend changes.

product.jsp:

<%@include file="/libs/foundation/global.jsp" %>
<%
boolean isActive = false;
%>
<c:set var="productStatus" value="<%=isActive%>" scope="request" />

HTL:
<div data-sly-include="/apps/wknd/components/page/common/product.jsp" data-sly-unwrap></div>

<div>productStatus Flag - ${request.getAttribute("productStatus").toString}</div>

 

Thanks

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

Kunal_Gaba_
December 16, 2020

Yes you will have to write some backend code for getting request attributes. I would recommend that you write a generic backend class which can be used for fetching any request attribute. You can refer to following example - http://www.6dglobal.com/blog/accessing-request-variables-sightly-2015-01-23