0

Hello everyone,

I need to pass some parameters from my servlet to my JSP. I am able to access 2 of my parameters from the request object, but one of them is returning null value.

Here's my servlet snipet:

            request.setAttribute("selectedA", aBook);
            request.setAttribute("selectedB", bBook);
            request.setAttribute("book_ref", book_ref);
            logger.info("book_ref = " + book_ref);  // <-- The value for book_ref is correct in my servlet.
            RequestDispatcher rd = request.getRequestDispatcher("/jsp/book.jsp");
            rd.forward(request, response);

From my JSP, here's the snipet: The first two parameters are coming back alright. The last one comes back null. In my servlet, I do a printout, and the value of book_ref is correct. Anything I am missing????

            A-Book =  ${param.selectedA} <br>
            B-Book = ${param.selectedB} <br>
            Book-Ref = ${param.book_ref}

Edited by peter_budo: Moved to JSP section for Java web development

3
Contributors
4
Replies
11
Views
2 Years
Discussion Span
Last Post by new_2_java
0

I would suggest to debug, because two parameters before this one are fine. It does look like you are actually pushing NULL instead of some value for book_ref

0

Thank you Peter.

Actually, the logger spits out the value of book_ref alright in my servlet. But, when I try to access it from my JSP, it returns null.

The value of book_ref is coming from mySQL table, whereas the balue of aBook and bBook are coming from my other JSP form passed as parameter to my servlet, and i simply forward them along with my book_ref to my respond JSP [book.jsp].

I tried to debug from my eclipse, but how can i perform a step debug on my JSP? Thanks.

0

What do you mean by step debugging?
If you are referring to debug capabilities of eclipse where you can debug servlets during runtime, such runtime debugging is not available in eclipse for JSP. JSP debugging during runtime are available in "intellij idea" tool.

Edited by subramanya.vl

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.