Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the meaning of ? (question mark) in a URL string?

Tags:

html

url

jsp

What is the difference between using

href="../usermanagement/search_user.jsp?"

and

href="../usermanagement/search_user.jsp?pagename=navigation"

in file navigation.jsp?

like image 601
Sanjay Yadav Avatar asked Oct 09 '15 14:10

Sanjay Yadav


4 Answers

Its name is query string. After the question mark you can pass key-value pairs and use them server-side.

like image 197
viktor77 Avatar answered Nov 18 '22 08:11

viktor77


It is a query to pass paramters. ?pagename=navigation passes the value 'navigation' to the pagename parameter.

like image 30
Tyler Jennings Avatar answered Nov 18 '22 06:11

Tyler Jennings


The question mark ("?", ASCII 3F hex) is used to delimit the boundary between the URI of a queryable object, and a set of words used to express a query on that object. When this form is used, the combined URI stands for the object which results from the query being applied to the original object.

Source: w3.org - syntax for URIs as used in the WorldWide Web initiative

like image 2
nCardot Avatar answered Nov 18 '22 06:11

nCardot


Whenever we want to pass some parameter to JSP then we simply append "?" question mark after the JSP URL, and after that we mentioned the parameter name and its value.

"../usermanagement/search_user.jsp?" means you did not get any parameter on this JSP file.

"../usermanagement/search_user.jsp?pagename=navigation" with this URL you can get the value of the pagename parameter on JSP as by using this syntax:

String pagenNameValue=request.getParameter("pagename");

You will get "navigation" as the pageNameValue parameter value.

like image 1
shashank Avatar answered Nov 18 '22 07:11

shashank