Copyright (c) SEMM NL All rights reserved.
Author : Paul Hamaker. Part of JavaLessons.com

A query string is what follows the question mark in a URL.

It must NOT contain spaces as such !

This one consists of two parts, fullname and city, separated by & .

%20 indicates a space, URL-encoded, an alternative is + .

The entire string is retrieved this way.

Its parts can be accessed like this.

null, if it's not there.

=============

Since JSP2.0 we can use the Expression Language, EL.

EL alternative ( Dollar sign + CURLY brackets ! ).

Easier EL alternatives for parameters.

Notice the syntax :


.getQueryString()
.queryString

Most objects mentioned earlier, like session, application etc. can be reached through pageContext.

=============

NOTES

=============

With the exception of
  the alphabet,
  digits,
+    &    %    -

and a couple more, many characters need encoding to be used in a URL.
!   has to be   %21
@   has to be   %40

etc.

A class that can do this for you, is

java.net.URLEncoder :
strencoded = URLEncoder.encode ( regularstr ) ;

It can also decode.

.