| Author |
request.getparameter in jsp not working
|
Padmaksha Mukhopadhyay
Greenhorn
Joined: Nov 27, 2012
Posts: 27
|
|
Hi I am facing a problem while running any jsp code
From my html page i am tring to pass a name to jsp and print it there
Everytime i click on submit it just goes to the jsp and shows the entire code instead of executing it
say here is my html program named ccform.html
And my jsp is named ccform.jsp
Now whenever i click on submit in html form the output i get in the browser is
Verify credit card info
Name = <%= (String)request.getParameter("name")%>
instead of
Name = (say) Sunny
And the path that is shows on top of the browser is
file:///C:/tomcat/webapps/myJSP/ccform.jsp
Please help for every program that uses request.getparameter it is doing the same thing. It is just redirecting me to the contents that i typed in my jsp program.
I have saved file type as .jsp
I have a project to do. I dont know what wrong i am doing.Anyone please help!!!
It would be wonderful of you
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56168
|
|
You should not be submitting the form to a JSP. That's a really bad practice.
The form should submit to a servlet for processing.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Stefan Evans
Bartender
Joined: Jul 06, 2005
Posts: 1002
|
|
>And the path that is shows on top of the browser is
>file:///C:/tomcat/webapps/myJSP/ccform.jsp
What is the url for the html page you are opening to submit the form from?
When you submit the form on your HTML page, it should try and load ccform.jsp which is in the same directory as the html page.
The fact that it ends up being a a file reference, indicates to me that you are loading the html page by double clicking it - ie opening it directly on your computer rather than through the server.
My suggestion would be to try the following URL: http://localhost:8080/myJSP/ccform.html
i.e. open the html file through Tomcat rather than directly on the browser.
Submitting the form from that URL should then invoke the tomcat server for the JSP.
|
 |
Padmaksha Mukhopadhyay
Greenhorn
Joined: Nov 27, 2012
Posts: 27
|
|
|
Thank you so so much Stephan Evans
|
 |
 |
|
|
subject: request.getparameter in jsp not working
|
|
|