asad_hussain
asad_hussain

Reputation: 2001

request.getParameter() not receiving the parameter value in jsp

I am trying to send book id of a book from a jsp file to another jsp.To do this i wrote this code inside BookSearch.jsp.

String bid=rs.getString(1);
            System.out.println("bid in search is "+bid);
            String url=rs.getString(3);
            System.out.println(url);
            String ref="/Summer/BookData.jsp?id="+bid+"";
            out.println("<a href="+ref+">"+"<img src="+ url + "style"+"=width:350px;height:350px>"+"</a>");

Now to receive the parameter i wrote this code inside BookData.jsp.

String bid=request.getParameter("bid");
System.out.println("value of bid is "+bid);

But in the console, the println statements prints these--

value of bid is null

Why BookData.jsp is unable to receive parameter ?

Upvotes: 0

Views: 757

Answers (1)

Olav Trauschke
Olav Trauschke

Reputation: 136

You have a parameter you call id in the url, which you give the value of the variable bid. You either need to look at the parameter id in BookData.jsp too or you need to name the parameter bid in the url too.

Upvotes: 1

Related Questions