users@glassfish.java.net

RE: Passing value from .jsp to Servlet-it passes Null

From: <w.rittmeyer_at_jsptutorial.org>
Date: Tue, 29 Jan 2008 09:18:13 +0100

> I have a parameter,whose value I am passing from .jsp to servlet
> but it is passing Null
>
> JSP code:
>
>function aboutMeUpdate(trialno)
> {
> document.aboutMe.action = '../jsp/UpdateServlet?paramName2='+trialno;
> document.aboutMe.submit();
> }
>

You could do s.th. like this:
document.aboutMe.paramName2.value=trialno;
document.aboutMe.action='../jsp/UpdateServlet';
document.aboutMe.submit();

This should also solve any potential POST problems Jacob mentioned.

You could also monitor the HTTP traffic to be sure that everything works as expected. If you are using Netbeans an HttpMonitor is already included. If not you could also use Paros, WebScarab or - of course - VisualProxy. Since the latter is written by me I am slightly biased of course ;-) You can find the tool VisualProxy here: http://www.visualproxy.org.


Regards,

Wolfram Rittmeyer


>
>Servlet code:
>
>String paramName2 =request.getParameter("paramName2");
>
>
>Please help
>[Message sent by forum member 'shopperswing' (shopperswing)]
>
>http://forums.java.net/jive/thread.jspa?messageID=256253