• 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 ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

RadioButtons in Different Rows Struts 2

Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi All,
I am developing one Quiz application using Struts 2 and hibernate, I am facing some problem with radio button. Please help me out!!!

My Classes are

I am having Question's object on my JSP.
Question :
id : 1
question : Is Java an Object Oriented Language?
List<Answer> : {Answer 1, Answer 2}

Answer 1:
id : 1
answer : Yes

Answer 2:
id : 2
answer : No

When I write code like

then it displays all the radio button in one row and also do not displays the answerStr from the class Answer. Instead of answerStr it displays string written by toString() method.

When I write

Then it displays Radio button with proper label which is Yes. but what about the other values in answersList?

I want like
1. Is Java an Object Oriented Language?
(Radio1) Yes
(Radio2) No

but it gives me like
2. Is Java an Object Oriented Language?
(Radio1) com.quize.beans.domain.Answer@177060f (Radio2) com.quize.beans.domain.Answer@1DR0D0f


[Thumbnail for JavaRanchImage.JPG]
What I am getting is.
    Bookmark Topic Watch Topic
  • New Topic