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...

Recommended Answers

All 5 Replies

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.

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...

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.

Do u hav any idea about session handling?

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.