Sangeetha.V
Sangeetha.V

Reputation: 115

How to load dynamic url using java servlets

Instead of *.jsp I need to do like case-58 or case-appId If we are seeing this case- means need to load a servlet. In that servlet I need to redirect to corresponding jsp file. Like this my web application need to run. I dont know how to implement this. Any one have idea means please give solution for this. Thanks in advance. For your reference we are using web.xml for servlet mappings..

Upvotes: 1

Views: 672

Answers (1)

Azimuts
Azimuts

Reputation: 1302

You can use use Guice Filtering

Serving different cases to diferent servlets or jsps, and no need to use web,xml ( just to register a Guice Listener)

public class ServletConfig extends GuiceServletContextListener {
@Override
protected Injector getInjector() {
    return Guice.createInjector(new ServletModule() {
        @Override
        protected void configureServlets() {
            super.configureServlets();

            serve("/").with(TestServlet.class);
        }
    });
}

}

http://blog.scottlogic.com/2012/05/31/building-web-services-using-guice.html

Upvotes: 1

Related Questions