This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
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

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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
Similar Threads
Radio button
how show values in jsp from getting database
setting a radio button
Pass radio button to servlet