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

JSP form processing

Irus Albert

Joined: Sep 14, 2010
Posts: 7

I have a jsp where I have written an HTML form. The name of the jsp file is "this.jsp". The code is :

I am submitting to this jsp itself. How can I access the value of the checked radio button?

I tried something like

But, that is giving null value.
Lester Burnham

Joined: Oct 14, 2008
Posts: 1337

This code doesn't do much of anything (it doesn't even compile, but I assume that's a copy/paste mistake). Try this instead:

Irus Albert

Joined: Sep 14, 2010
Posts: 7

Actually I am printing request.getParameter("choice") and it is giving null. I tried
Pradeep Prabhakaran

Joined: Sep 25, 2010
Posts: 7
I dont think you need to mention the name of the jsp page (if , you are submitting to the same page).
try this:

when you don't mention anything in the action, the form gets submitted to the same page.
Han Jie

Joined: Sep 24, 2010
Posts: 24
Irus Albert wrote:

you should invoke a method on request here, so you miss "()" behind keywords "getMethod"
it is a method not a field, reference to HttpServletRequest
I agree. Here's the link:
subject: JSP form processing
It's not a secret anymore!