Component Configuration

Dear community,

I hope you are well.

Currently Im follow up the below documentation
ref:

so I creatte
1.
@FieldGroupList({
@FieldGroup(titleKey = “address”, value = { “street”, “city” }),
@FieldGroup(titleKey = “layout”, value = { “size” })
})
public interface MyComponentParamsInfo {

@Parameter(name = "street")
String getStreet();
@Parameter(name = "city")
String getCity();
@Parameter(name = "size", defaultValue="medium")
@DropDownList({"small", "medium", "large"})
String getSize();

}

  1. I add
    definitions:
    config:
    /hippo:configuration/hippo:translations/hippo:hst/componentparameters/org:
    jcr:primaryType: hipposys:resourcebundles
    /example:
    jcr:primaryType: hipposys:resourcebundles
    /components:
    jcr:primaryType: hipposys:resourcebundles
    /MyComponentParamsInfo:
    jcr:primaryType: hipposys:resourcebundles
    /en:
    jcr:primaryType: hipposys:resourcebundle
    address: Address Information
    ​ ​​​​​​ street: Street
    city: City
    layout: Layout Settings
    size: Size
    size#small: Small
    size#medium: Medium
    size#large: Large

so when i go to the cms channel editor and drag mycomponent, on the right side i fill in the properties, should i see that fill in values in the component???

Aslo i create a ftl
<#-- @ftlvariable name=“mycomponent” type=“org.example.bloomreach.beans.MyComponent” →

<#if mycomponent?has_content>


${mycomponent.street}



${mycomponent.city}


${mycomponent.size}



<#elseif isPreview>

No info has been select yet!

Thansk in advance

Did you rebuild your jar files after making the Java changes?

yes, if you mean mvn clean install, remove the storage and run cargo again

Yes, that’s what I was referring to. It appears you have the properties showing up in the CMS and filled them in on the component. Your issue is retrieving it on the frontend. What happens when you simply try to render “mycomponent” in the Freemarker? Have you actually passed that variable to the frontend from the “org.example.bloomreach.beans.MyComponent” class?

If you dropped component previously or configured it with a different class within catalog, you might need to delete it and add it again.
Also check the log files if there are any errors
Also, you can use mvn clean package instead of installing the artifacts…

Dear Nicholas and Machak,

Thank you for your respond, so far I tried your two advice but sill I cannot see the properties filled in the respond.

Please find below my implementation:

##################################

cnd:

[bloomreach:mycomponent] > bloomreach:basedocument, hippostd:relaxed, hippotranslation:translated
orderable

##################################

catalog.yaml
definitions:
config:
/hst:hst/hst:configurations/bloomreach/hst:catalog:
jcr:primaryType: hst:catalog
/bloomreach-catalog:
jcr:primaryType: hst:containeritempackage
/mycomponent:
jcr:primaryType: hst:containeritemcomponent
hst:componentclassname: org.example.bloomreach.components.page.MyComponentPage

      hst:iconpath: img/catalog/plugin/textandtitle/textandpicture-icon.png
      hst:label: My Component
      hst:template: components.mycomponent

##################################

MyComponent.java
@Node(jcrType = MyComponent.JCR_TYPE)
public class MyComponent extends BaseDocument {

//private static final Logger LOG = LoggerFactory.getLogger(TextWithTitle.class);

public static final String JCR_TYPE = “bloomreach:mycomponent”;

private static final String STREET = "bloomreach:street";
private static final String CITY = "bloomreach:city";
private static final String SIZE = "bloomreach:size";


public static String getJcrType() {
    return JCR_TYPE;
}

  public String getStreet() {
    return getSingleProperty(STREET, StringUtils.EMPTY);
}
public String getCity() { return getSingleProperty(CITY, StringUtils.EMPTY);}
public String getSize() { return getSingleProperty(SIZE, StringUtils.EMPTY);
}

}

##################################
MyComponentPage.java

@ParametersInfo(type = MyComponentParamsInfo.class)
public class MyComponentPage extends BaseHstComponent {
private static final Logger LOG = LoggerFactory.getLogger(MyComponent.class);

 private static final String ATTR_MYCOMPONENT_DOCUMENT = "mycomponent";

@Override
public void doBeforeRender(HstRequest request, HstResponse response) throws HstComponentException {
    final MyComponentParamsInfo info = getComponentParametersInfo(request);
    final HippoBean siteContentBaseBean = request.getRequestContext().getSiteContentBaseBean();

    final HippoBean scope = request.getRequestContext().getSiteContentBaseBean().getBean(ATTR_MYCOMPONENT_DOCUMENT);

    try {
        final HstQuery hstQuery = HstQueryBuilder.create(scope).ofTypes(MyComponent.class).build();


        final HstQueryResult result = hstQuery.execute();
        request.setAttribute(ATTR_MYCOMPONENT_DOCUMENT, result.getHippoBeans());
    }catch (QueryException queryException) {
        LOG.warn("Exception occurred during creation or execution of HstQuery.", queryException);
    }

}

}

##################################

MyComponentParamsInfo.java

@FieldGroupList({
@FieldGroup(titleKey = “address”, value = { “street”, “city” }),
@FieldGroup(titleKey = “layout”, value = { “size” })
})
public interface MyComponentParamsInfo {
@Parameter( name = “street”,
displayName = “Street”,
required = true)
String getStreet();

@Parameter( name = "city",
            displayName = "City",
            required = false)
String getCity();

@Parameter(name = "size", defaultValue="medium")
@DropDownList({"small", "medium", "large"})
String getSize();

}

##################################

mycomponent.ftl

<#-- @ftlvariable name=“mycomponent” type=“org.example.bloomreach.beans.MyComponent” →
<#if mycomponent?has_content>


${mycomponent.street}



${mycomponent.city}


${mycomponent.size}



<#elseif isPreview>

No info has been select yet!

##################################

template

definitions:
config:
/hst:hst/hst:configurations/bloomreach/hst:templates:
/components.mycomponent:
jcr:primaryType: hst:template
hst:renderpath: webfile:/freemarker/bloomreach/catalog/mycomponent/mycomponent.ftl

##################################

cms

##################################

localhost
Does not show the fullfill property

Thanks in advance

Dear community,

is it any update on this,

Thanks in advance