java.lang.NoClassDefFoundError
When we import a Java class in a Java project we sometimes face NoClassDefFoundError and that import is not getting resolved. If you are using IntelliJ IDE then you could resolve this issue by going to the following setting option.
Run >> Edit Configurations >> Click on Modify options >> select Include dependencies with "Provided scope" OR "Add dependencies with "Provided" scope to classpath"
How to check the node property type is single value or multi value in aem?
We can check the type of property(whether single or multiple) using the method isMultiple() of Property interface. Below is an example to check the node property "items" is a single value or multiple values and based on that get the value or values for that property in AEM.
Property property = node.getProperty("items");
Value[] values = null;
if(property.isMultiple()){
values = property.getValues();
} else {
values[0] = property.getValue();
}
Hope this helps. Thank you!
Select only one checkbox from a group of checkboxes
Create a group of checkboxes and allow only one selection. Here is the sample code for of creating checkbox using simple HTML and JavaScript.
HTML code
<!DOCTYPE html> <html> <head> <title>Page Title</title> <script> var checkboxChecked; document.addEventListener('input',(e)=> { if(e.target.getAttribute('name')=="termsCondition") { if(checkboxChecked) checkboxChecked.checked=false; } e.target.checked=true; checkboxChecked=e.target; }) </script> </head> <body> <p>Select only one checkbox from a group of checkboxes.</p> <input type="checkbox" name="termsCondition" value="1" /> 1 <input type="checkbox" name="termsCondition" value="2" /> 2 <input type="checkbox" name="termsCondition" value="3" /> 3 <input type="checkbox" name="termsCondition" value="4" /> 4 </body> </html>
Output
Subscribe to:
Posts (Atom)