General discussion

Locked

JSP query string madness!

By rmg ·
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!

This conversation is currently closed to new comments.

8 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

JSP query string madness!

by rmg In reply to JSP query string madness!

Point value changed by question poster.

Collapse -

JSP query string madness!

by okujava In reply to JSP query string madness!

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
%>
<jsp:forward page="<%=path%>"/>

cheers

Collapse -

JSP query string madness!

by rmg In reply to JSP query string madness!

Poster rated this answer

Collapse -

JSP query string madness!

by rmg In reply to JSP query string madness!

How can implement an architecture like this???

Collapse -

JSP query string madness!

by rmg In reply to JSP query string madness!

Upping the ante

Collapse -

JSP query string madness!

by rcline In reply to JSP query string madness!

I suspect the cp is a controller flag which maps a URI to an action class. This is a standard JSP implementation.

Are you familiar with Struts? The Struts framework is a Jakarta project which also includes a controller. It is explained in moredetail here:

http://jakarta.apache.org/struts/doc-1.0.2/userGuide/building_controller.html

Collapse -

JSP query string madness!

by rmg In reply to JSP query string madness!

Poster rated this answer

Collapse -

JSP query string madness!

by rmg In reply to JSP query string madness!

This question was closed by the author

Back to Web Development Forum
8 total posts (Page 1 of 1)  

Related Forums