Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fetch value from custom multifield component?

Tags:

jcr

aem

I have created a multifield custom widget having two fields with names ./urlLink and ./urlText. Now i m trying to fetch the values from widget into the component's jsp with following code

String property = properties.get("./urlLink",String[].class);
for(String value: property ) {

  out.print(value);
}

out.print(property);

But i am not able to get its value instead i m getting error.

like image 738
cqlearner Avatar asked Mar 22 '26 13:03

cqlearner


1 Answers

If you're getting a property and it contains a string value, you need to use the method getString() - that way when you have the property, you can set the string to the value by doing something like this:

Property property = properties.get("./urlLink",String.class);
String value = property.getString();

Just a side note, if your return is supposed to be a string array, your type that you're putting the values in should be a string array.

String[] value

Check out the documentation on day.com for Properties and getting the values inside them.

like image 55
Nicholaus Chipping Avatar answered Mar 25 '26 00:03

Nicholaus Chipping



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!