Expand my Community achievements bar.

SOLVED

how to get the url query string paramters value

Avatar

Level 3

Hi team,

 

I have a requirement where in we should not load the launch based on the <xxx> = true parameter value.

 

 we are loading launch as below :

<sly data-sly-call="${headlibRenderer.headlibs @
designPath = page.designPath,
staticDesignPath = page.staticDesignPath,
clientLibCategories = page.clientLibCategories,
clientLibCategoriesJsHead = page.clientLibCategoriesJsHead,
hasCloudconfigSupport = page.hasCloudconfigSupport}"></sly>
 
 
1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@niks1  

Below implementation working for me as expected.

Sling Model:

 

 

@Model(adaptables = {Resource.class, SlingHttpServletRequest.class})
public class DemoModel {

	@SlingObject
	SlingHttpServletRequest request;

	private String launchEnabled = "false";

	public String getLaunchEnabled() {
		if (request.getParameter("launchDisabled") == null || request.getParameter("launchDisabled").equalsIgnoreCase("false"))
			launchEnabled = "true";
		return launchEnabled;
	}
}

 

 

HTL:

 

 

<div data-sly-use.demo="com.blogspot.adapttoaem.core.models.DemoModel">
    <sly data-sly-test="${demo.launchEnabled == 'true'}"> 
        <p>Launch Enabled</p>
    </sly>
</div>

 

 

 

 

View solution in original post

21 Replies

Avatar

Level 3
@Anudeep_Garnepudi - I tried as suggested but it is still working . public boolean getlaunchEnabled() { return !(Boolean.parseBoolean(request.getParameter("launchDisabled"))) ; }//?????