Timeline for DD4T 2.0 with Java MVC - Is it possible to use the same CT for multiple components(based on same schema) schema) while using ViewModels Class
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 5, 2016 at 16:31 | history | edited | Shiva | CC BY-SA 3.0 |
Updating based on the user comments and provide some feedback as well.
|
Feb 4, 2016 at 23:07 | comment | added | Gulshan Thakur | Attached one snapshot in main question to explain things diagramatically | |
Feb 4, 2016 at 22:46 | comment | added | Gulshan Thakur | @ViewModel(viewModelNames = { "header_ct", "footer_ct"}, rootElementNames = { "content" }, setComponentObject = true, setRawData = false) public class HeaderAndFooter extends TridionViewModelBase { } component jsp for header view: <jsp:useBean id="header_ct" type="com.web.cms.model.HeaderAndFooter" scope="request" /> component jsp for footer view: <jsp:useBean id="footer_ct" type="com.web.cms.model.HeaderAndFooter" scope="request" /> | |
Feb 4, 2016 at 22:46 | comment | added | Gulshan Thakur | My issue is specific to - how to define the mapping in ViewModel Class if I am using same CT for multiple components(based on same schema); In below example - I have View Model class where I am forced to use 2 CT because I have 2 different component jsp view. | |
Jan 27, 2016 at 23:10 | comment | added | Shiva | A component template is different from a component presentation. You can have multiple component templates associated with the same component rendering different component presentations (ofc, you will have to code this). This is true if you are using Tridion with or without DD4T. I suggest trying out a simple example (try some use cases too) from online documentation (though multimedia) and I am hoping that it would clarify your question docs.sdl.com/LiveContent/content/en-US/… | |
Jan 27, 2016 at 21:26 | comment | added | Gulshan Thakur | I need separate viewModel class for C1 and C2. because C1 and C2 has different set of content(based on same schema) and C1 and C2 has separate component JSP or component view. | |
Jan 27, 2016 at 9:09 | comment | added | Raimond | You link VM1 to either S1 and / or CT1. All components published with that CT will then be able to use the view model. In your case, a rootElementNames = {"S1"} property on the @ViewModel annotation should be enough. | |
Jan 27, 2016 at 0:03 | comment | added | Gulshan Thakur | Hi Shiva Are you suggesting this - one CT(linked to schema S1) and Two components C1 and C2 (based on schema S1) and ViewModel Class VM1 (mapped to C1) and VM2(mapped to C2) . If yes can you give one sample for CT(Metafields) and Viewmodel Class; not sure how the linking will work | |
Jan 26, 2016 at 23:16 | history | edited | Shiva | CC BY-SA 3.0 |
Added link to Alberts documentation
|
Jan 26, 2016 at 23:08 | history | answered | Shiva | CC BY-SA 3.0 |