Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RadioButtons in Different Rows Struts 2

 
Sanket L Shah
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • 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.
Exa.
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


PLEASE HELP ME OUT




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