users@glassfish.java.net

Servlet is not passing value to JSP, it passes 0 instead of the real value

From: <glassfish_at_javadesktop.org>
Date: Sat, 02 Feb 2008 11:49:02 PST

I have written the following code, but still variable value is coming zero.

Servlet calls JSP,and passes the value to JSP

JSP code:

String dialogidString= request.getParameter("dialogId");
if(dialogidString == null){
dialogidString = (String)request.getAttribute("dialogId");
}
int dialogid= new Integer(dialogidString).intValue();


Servlet code:
RequestDispatcher rd = null;
                             request.setAttribute("dialogId", dialogId);
                            rd=request.getRequestDispatcher("/jsp/tagDialog.jsp?dialogId="+dialogId);
                            rd.forward(request,response);

Also I tried,this in Servlet:

RequestDispatcher rd = null;
                             request.setAttribute("dialogId", dialogId);
                            rd=request.getRequestDispatcher("/jsp/tagDialog.jsp");

Still it passes 0 only & as per my prg, dialogId is more than 0,and this value is correct in Servlet
[Message sent by forum member 'shopperswing' (shopperswing)]

http://forums.java.net/jive/thread.jspa?messageID=257145