0

Hey i m using href for forwarding control to other page but it displays null when i want to get that attribute in other page..
Can any 1 suggest me what to do...

2
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by __avd
0

I think you are trying to read request attribute. Please show us your code. Also, don't forget to encase the code in code tags.

Edited by happygeek: fixed formatting

0

This is the code i m writing in my file to forward control to a servlet controller..
I m using MVC model 2 in my code..

out.println("<h2><a href = controllerPosts?action=newJavaThread.jsp?id="+i+">"+heading+"...</a></h2>");

In my controller class i m writing..

String userAction = request.getParameter("action");

            if(userAction.equals("newJavaThread.jsp"))
            {
                String id = request.getParameter("id");
                HttpSession session = request.getSession(false);
                session.setAttribute("Question", id);

                response.sendRedirect("newJavaThread.jsp");

but this code is not working properly rather a blank page is displayed...

0

Query parameters must be delimited by &.

out.println("<h2><a href = controllerPosts?action=newJavaThread.jsp&id="+i+">"+heading+"...</a></h2>");

Use RequestDispatcher's forward method instead of sendRedirect() method.

0

Do u hav any idea about session handling?

It doesn't matter. There are many ways to sort out problems like that. Of course you should be aware of session.

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.