Skip to main content
Notice removed Draw attention by Alvin Reyes
Bounty Ended with Jeroen Suurd's answer chosen by Alvin Reyes
Tweeted twitter.com/#!/StackTridion/status/625721614760587264
added 71 characters in body
Source Link

I am new to java and was trying to write a model for a schema. I want to understand how a schema is linked with the model.

For e.g. I have schema with below details:

  1. heading (Text Field) - Single value
  2. menuLink (Embedded schema) - Multi value

[The embeded schema used here is 'link' which contains fields for creating a external or Tridion link]

When I write a model based on schema field names , it is something like

private String headline;
private List<Link> menuLink;

I also generate the getters and setters. I am able to display headline in my view, but not able to display any value from embedded fields i.e. menuLink

If I change this to:

private String headline;
//Changed to menuLinks instead of menuLink
private List<Link> menuLinks;

and generate getters and setters. This works fine with views.

The question here is why we need to use 'menuLinks' instead of 'menuLink' in the model even when the field name is menuLink? Is it because it is a multivalue field? How is this mapping done?

Also which datatype should be used for check-box while writing a model?

p.s. I do not have any guidelines for java MVC, so maybe I have missed something.

I am new to java and was trying to write a model for a schema. I want to understand how a schema is linked with the model.

For e.g. I have schema with below details:

  1. heading (Text Field) - Single value
  2. menuLink (Embedded schema) - Multi value

[The embeded schema used here is 'link' which contains fields for creating a external or Tridion link]

When I write a model based on schema field names , it is something like

private String headline;
private List<Link> menuLink;

I also generate the getters and setters. I am able to display headline in my view, but not able to display any value from embedded fields i.e. menuLink

If I change this to:

private String headline;
//Changed to menuLinks instead of menuLink
private List<Link> menuLinks;

and generate getters and setters. This works fine with views.

The question here is why we need to use 'menuLinks' instead of 'menuLink' in the model even when the field name is menuLink? Is it because it is a multivalue field? How is this mapping done?

p.s. I do not have any guidelines for java MVC, so maybe I have missed something.

I am new to java and was trying to write a model for a schema. I want to understand how a schema is linked with the model.

For e.g. I have schema with below details:

  1. heading (Text Field) - Single value
  2. menuLink (Embedded schema) - Multi value

[The embeded schema used here is 'link' which contains fields for creating a external or Tridion link]

When I write a model based on schema field names , it is something like

private String headline;
private List<Link> menuLink;

I also generate the getters and setters. I am able to display headline in my view, but not able to display any value from embedded fields i.e. menuLink

If I change this to:

private String headline;
//Changed to menuLinks instead of menuLink
private List<Link> menuLinks;

and generate getters and setters. This works fine with views.

The question here is why we need to use 'menuLinks' instead of 'menuLink' in the model even when the field name is menuLink? Is it because it is a multivalue field? How is this mapping done?

Also which datatype should be used for check-box while writing a model?

p.s. I do not have any guidelines for java MVC, so maybe I have missed something.

Notice added Draw attention by Alvin Reyes
Bounty Started worth 50 reputation by Alvin Reyes
Source Link

How is schema linked to a Model in DXA+Java MVP Implementation?

I am new to java and was trying to write a model for a schema. I want to understand how a schema is linked with the model.

For e.g. I have schema with below details:

  1. heading (Text Field) - Single value
  2. menuLink (Embedded schema) - Multi value

[The embeded schema used here is 'link' which contains fields for creating a external or Tridion link]

When I write a model based on schema field names , it is something like

private String headline;
private List<Link> menuLink;

I also generate the getters and setters. I am able to display headline in my view, but not able to display any value from embedded fields i.e. menuLink

If I change this to:

private String headline;
//Changed to menuLinks instead of menuLink
private List<Link> menuLinks;

and generate getters and setters. This works fine with views.

The question here is why we need to use 'menuLinks' instead of 'menuLink' in the model even when the field name is menuLink? Is it because it is a multivalue field? How is this mapping done?

p.s. I do not have any guidelines for java MVC, so maybe I have missed something.