• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to forward radio button input from one jsp to another?

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry if it's a dumb question: I have a jsp page ("A") which has a table, the 1st column is radio buttons, so the user could pick up a row from the table, then click the submit button, so that some more details of that row could be showed in another page, "B".

I specify in struts-submit-congig.xml file that the action associated with page A will be forward to page B. However, when i tried to find out which row has been selected from page A by calling "request.getParameter("id")" in B.jsp, i got "null". In another word, submit of page A doesn't seem to forward the check status of radio buttons to page B.

The name of the input of radio buttons is defined as "id". what else can be missing? It used to work when i put all logic (including constructing the table data) in page A's action class. btw, i have way much more experience in Java than in JSP.

Thank you so much!
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What you may be missing is that the parameter doesn't automatically get forwarded from JSP A to JSP B without some action on your part in Action A.

Here's the sequence of events:
  • JSP A is rendered and sent to the browser
  • The user presses the submit button, thereby sending all form elements as parameters attached to the request object.
  • If you've defined and coded an ActionForm, Struts automatically populates the ActionForm bean with the values in the parameters.
  • the Execute() method on Action A is called, and has access to both the parameters and the form bean. It can then take whatever action is necessary based on that information.
  • Action A forwards to JSP B. If the action does nothing to pass along the information it read, it is lost! In order to pass the information along to JSP B, Action A takes the information from the ID parameter and either places it directly in the request object using the setAttribute() method, or puts it in an ActionForm bean which is then placed in the request object.
  • JSP B then reads the information from the request, either by using Struts tags that access the ActionForm bean, or by calling the request.getAttribute() method.

  •  
    Did Steve tell you that? Fuh - Steve. Just look at this tiny ad:
    a bit of art, as a gift, the permaculture playing cards
    https://gardener-gift.com
    reply
      Bookmark Topic Watch Topic
    • New Topic