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.

  • 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? – Bart Koopman Jun 12 '17 at 6:57
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

  • They are separate schema s – Sandeep Deshmukh Jun 9 '17 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. – Rick Pannekoek Jun 10 '17 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, privacy policy and cookie policy

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