Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

How to access sling servlet on page load

Avatar

Level 3

Sorry for what is a simple question, I'm a total AEM newbie and not very good at Java either.

I'm doing an IP redirection script, it redirects the user to a different website based on his location. I'm using the Maxmind database to get the location using the IP. I'm stuck at a simple thing, where do I place the servlet so that the script runs before the page loads? Any pointers on how I should go around this?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
2 Replies

Avatar

Correct answer by
Community Advisor

Avatar

Level 3

Thanks, just what I needed. The sample code pointed me in the right direction :-)