* To get the property from local.properties file and use in class.
* Here I want to show description when “training.product.description” property is “true” in local.properties otherwise I don't want to show
* To get the property from local.properties file and use in class.
* Here I want to show description when “training.product.description” property is “true” in local.properties otherwise I don't want to show description in the storefront.
* We can do it in two ways, Check the below example, in the storefront.
* We can do it in two ways, Check the below example,
TrainingProductDetailsController.java
Method 1:-
Here I am using Config class to get the property. Its looks very short and simple to do it.
import de.hybris.platform.util.Config;
private static final String TRAINING_PRODUCT_DESCRIPTION = "training.product.description";
final String descriptionCheck = Config.getParameter( TRAINING_PRODUCT_DESCRIPTION);
model.addAttribute("descriptionCheck", descriptionCheck);
|
Method 2:-
Here I am using ConfigurationService. It looks lengthy,
import de.hybris.platform.servicelayer.config.ConfigurationService;
private static final String ORDERPALCED_MESSAGE = "training.product.description";
final String descriptionCheck= configurationService.getConfiguration().getProperty(ORDERPALCED_MESSAGE);
model.addAttribute("descriptionCheck", descriptionCheck);
|
local.properties
training.product.description = true
|
* Here I am writing the condition to display description.
JSP:- TrainingProductDetails.jsp
<c:if test="${descriptionCheck eq true }">
<td>${productData.description}</td>
</c:if>
|
