File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes request.getparameter in jsp not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "request.getparameter in jsp not working " Watch "request.getparameter in jsp not working " New topic

request.getparameter in jsp not working

Padmaksha Mukhopadhyay

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

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

Joined: Jan 10, 2002
Posts: 63866

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.

[Asking smart questions] [About Bear] [Books by Bear]
Stefan Evans

Joined: Jul 06, 2005
Posts: 1580
>And the path that is shows on top of the browser is

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

Joined: Nov 27, 2012
Posts: 27
Thank you so so much Stephan Evans
I agree. Here's the link:
subject: request.getparameter in jsp not working
It's not a secret anymore!