Discussion Locked

JSP query string madness!

0 helpful
8 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am learning Java Server Pages and I have come across a website that uses JSP and I can't figure out how they constructued it. They seem to use their index.jsp as some kind of controller for all other pages, for example:

http://www.scient.com/index.jsp?cp=/SC/leadership/main.jsp

It looks like index.jsp is calling the file main.jsp in the directory leadership which is in the directory SC, but I cant figure out what the cp= does and how the whole things works. Can anyone help with this? Ive been struggling for weeks! Thanks!

8 replies

by okujava

I think it is pretty simple. first, you must see the String after ? as a name=value pair. so in the jsp I would have something like:
<%
String path = request.getParameter("cp");
//do something as manage the session or the
//user or other
%>

cheers

This discussion is closed to new replies.