• 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

Retaining Radio Button Values After Refresh

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am trying to make a form that consists of several radio buttons. After clicking the submit button the result will be shown on the same page. I want to add this feature to my program so that after submitting the form and presenting the results, user can see his selected fields.

I have tried this code but it did not work.



"stat" is the name of my java package that I have called in this .jsp file and I have defined setcolor() and getcolor() in that java package.

Any suggestions or comments would be appreciated.
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Two things:
  • Java scriptlets have been discredited for 10 years now. You should be using the EL and JSTL.
  • In Java, strings are not compared with == but with the .equals() method.
  • If you are expressing colors as numbers (that's wierd to being with), why are you storing the numbers as strings?
  •  
    Ati Sai
    Greenhorn
    Posts: 3
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thank you for your response. I am very new to Servlets and JSPs development. Can you introduce a book or a good source that I can use?
    And with regards to colors and storing them as number, that was an example of what I am doing. In fact I am working on creating a calculator that its parameters should be entered via a form that consists of both textfields and radio buttons.
     
    Bear Bibeault
    Sheriff
    Posts: 67747
    173
    Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Make sure whatever book or tutorial that you use is up-to-date and focuses on the JSTL and EL rather than Java scriptlets.

    If you are new to JSP and servlets, I also recommend reading these articles:
  • The Secret Life of JSPs
  • The Front Man

  •  
    Ati Sai
    Greenhorn
    Posts: 3
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thank you so much for your prompt response.
     
    reply
      Bookmark Topic Watch Topic
    • New Topic