2

Component1 - uses model1 - component1.jsp

Component2 - uses model2 - component2.jsp

Component1 --> Component link --> Component2

<jsp:include page="component2.jsp"></jsp:include> 

I want to reuse the JSP code from component2.jsp in my component1.jsp.

Is there a way to get use the component2.jsp which uses a different model?

I know that if both of them have same models it will work.

1
  • Can you edit your question and provide a bit more detail, like some of the source of model1 for example, which shows the Component Link field? Commented Jun 12, 2017 at 6:57

2 Answers 2

1

Each Tridion Component is has a Cchema and the DXA webapp model is created using the Field definitions in Schema.

So, as long as Component1 and Component2 have same Schema, they both have the same model or at least type castable

2
  • They are separate schema s Commented Jun 9, 2017 at 13:45
  • 1
    If you have different Schemas, you can map them to the same View Model type or to different View Model types which have a common base class. Commented Jun 10, 2017 at 16:52
1

You could try <dxa:entity entity="${component2}"/> not sure if it will work in your setup though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.