Hi I'm calling servlet from and i'm sending some data also. but i couldn't get the value from servlet. I got a value "null" only. Code from JSP: <jsp:forward page="/servlet/senthil"> <jsp aram name="prak" value="Prakash"> </jsp:forward> code from Servlet : String gh=req.getParameter("prak"); out.println("Value from JSP "+gh); Check it out and let me know the solution. TIA With regards Prakash
Try this in your jsp file: <FORM METHOD="POST" ACTION="/servlet/senthil"> <INPUT TYPE="TEXT" NAME="prak" VALUE="Prakash"> <INPUT TYPE="SUBMIT" VALUE="Send"> </FORM>
Joined: Sep 06, 2000
Dear Kapil, Thanks for your reply. Your has to work, but what probelm with my code. Is there any error or its totally mistake. let me know the details of how to call a servlet from JSP. with regards Prakash
Joined: Nov 03, 2000
Dear Prakash, I should have added little explanation for my recommendation. Well, jsp:forward lets you forward the request to another page. It has a single attribute, page, which consists of a URL. It is not capable of carrying a variable value with it. So, if you need to transfer any value and the value is coming from user input, then a 'form' should serve the purpose. If the value is coming from some internal calculation of some java bean, then you can use jsp:usebean, setProperty and getProperty to modify and retrieve bean properties. Hope it helps.
Hi frank How it will work. It will search like a sevlet class in the name of senthil?prak=prakash. I got a error like that only then what is the use of jsp aram tag. I'm using java webserver 2.0. let me know more details. with regards Prakash
Hi Prakash, I am not sure if you ever solved the problem. It is simple: you missed the terminating slash character for the "param" tag. <jsp:forward page="/servlet/senthil"> <jsp aram name="prak" value="Prakash" /> </jsp:forward> I put it after "Prakash" as above and tested it. It works file. Gopal