In my JSP web application, I want to redirect sample users to a different page from the real users.

Currently we do something like

if((user.getName().equalsIgnoreCase("Sample")) ...

This is (a) hardcoded and (b) executed for each normal user as well.

Is there a better way to handle this logic?

I am loathe to redirect these users via Javascript validation - which is one of the suggestions given internally


This might be better done through security groups.

Pseudo code:

| improve this answer | |

I don't see a problem redirecting sample users like that. We are using this technic too so that we could use functional tests.

Another solution is writing a filter which you can then switch off.

| improve this answer | |

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.