Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

How to return Sling model from Servlets and use same model using HTL?

NaziyaP
Level 2
Level 2

Hi All,

I have a Model which I refer in Sling servlet. How do i return this same model from my servlet in my HTML using HTL. I dont' want to do a ajax calls as this model has large data which should be processed at server end only. This Model's data is based on the request , therefore it should be returned from the service only.


Thank you in advance.

1 Accepted Solution
NaziyaP
Correct answer by
Level 2
Level 2

I found the solution.
Basically, i wanted to use the sling request with Model, I had set values in my model based ont he particular request , which i did using this.

     @SlingObject

    private SlingHttpServletRequest request;

and initailzed my values in

@PostConstruct

    protected void init()  method based on requests.

View solution in original post

2 Replies
Jörg_Hoh
Employee
Employee

Can you show us some relevant pieces of this model and and you envision to use it?

Jörg

NaziyaP
Correct answer by
Level 2
Level 2

I found the solution.
Basically, i wanted to use the sling request with Model, I had set values in my model based ont he particular request , which i did using this.

     @SlingObject

    private SlingHttpServletRequest request;

and initailzed my values in

@PostConstruct

    protected void init()  method based on requests.

View solution in original post