In servlet we can do this.

<servlet-mapping>
<servlet-name>exampleServlet</servlet-name>
<url-pattern>/example</url-pattern>
</servlet-mapping>

But how to do it for jsp file ?


Thanks..

There is no reason to do it for jsp. What are you trying to accomplish?

I just wondering, if servlet can why jsp can not.

I like mapping because it can manipulating the pattern.

Anyway, I think I can do this with RequestDispatcher, but in the second thought, it's not a good idea. It will makes a lot of servlet. :)

Thanks javaAddict for you comment. So the conclusion is only servlet can mapping.

So the conclusion is only servlet can mapping.

Actually, I've never seen JSPs being mapped. From what I know you map servlets because, the servlet you define, is just the class name. But you cannot call class names, you need to map it to a url. So it is like saying what is the url of the java-servlet-class you created.
But for JSPs, they can go directly to the url. No mapping is needed.
Now if it can be done I don't know, but I am sure that it is not needed

OK javaAddict, I got the points

Thanks for you reply

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.