2

In a JSP page, Image and some text content is to be loaded based on the user type.

Example : for userType1 i want to show image123 and for userType2 i want to show image567.

Could you help me how to get a Dynamic Component in JSP page using DXA 1.2 framework?

4

Your question is of very low quality, but I'll attempt an answer anyways.

First thing I think you should keep in mind is the way DXA is setup. DXA is an MVC application that uses view models, so we are not talking about Component anymore that you want to retrieve in your views. If you have set your Component Template to be a dynamic one, then from there on you can just consider it as any other item, and you deal with the mapped view model in your views.

If your question is actually about executing a broker query, and retrieving DCPs that way, then I think it makes sense if you edit your question and provide a bit more detail, so you can get more detailed answers too.

  • dont we need to use teaser in 1.2? – Raj Kumar Feb 22 '16 at 10:17
  • 1
    @RajKumar why would it, DCPs are mapped to Entities just like "normal" Components are. – Bart Koopman Feb 22 '16 at 13:45
  • Ok, if i am recalling correctly, in 1.01 we saw dcp was mapped using teaser only. – Raj Kumar Feb 22 '16 at 14:13
  • 2
    1.0.1 had no real DCP support, since that was missing in the DD4T version we used. You might be confusing it with the broker query that was executed, that relies on using teasers, but those were not even DCPs – Bart Koopman Feb 22 '16 at 14:20
  • Got it, we actually modified to support it using broker queries. Thanks +1 – Raj Kumar Feb 22 '16 at 14:29
1

You can see any example in existing DXA code, it works similarl to normal mapping process. Please follow below points.

  • Create CT with "Published as a DC" In CMS
  • Assign ViewName you want to handle the UI with.
  • In View use your View Model
  • Apply semantic mapping to View model as per your Schema.
  • Debug for any issue.

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.