• 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

Problem using html:radio

 
Ranch Hand
Posts: 284
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I have tried a lot and could not get a solution for my application. Actually i have a Jsp page which have two radio buttons that needs to get generated dynamically. I tried out with some options, but could not use them properly.
As am confused about using the html:radio tag so please bear with me.
here is my jsp-: check.jsp


here is the form bean-: CheckBean.java


and here is my action - CheckAction.java



the strut-config.xml


Now when am running my application am getting the error-:
javax.servlet.jsp.JspException: Cannot find bean: "CHOICES" in any scope

I have set CHOICES in request attribute still am getting error.

Later i tried to change the check.jsp as-:
<logic:iterate id="choice" name="checkbean" collection="CHOICES">
so name will be my bean name and collection would be the collection from action class. But i get another error as-:
javax.servlet.jsp.JspException: Cannot create iterator for this collection

Could anyone tell me how exactly i should use the tags and where am going wrong. I tried to google much but couldn't find a solution.

Thanks
 
Pranav Bhatt
Ranch Hand
Posts: 284
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anyone on this? Am i going in right direction?
 
Pranav Bhatt
Ranch Hand
Posts: 284
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have solved it myself.. ... The tut misguided me by writing put collection in action and i was wondering how to pass the attribute to jsp.
 
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you tell flow of Action and jsp calling?

I understands,

(here itself we should put CHOICES in session)>>check.jsp >> CheckAction>>checkSuccess.jsp
 
Pranav Bhatt
Ranch Hand
Posts: 284
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well yes actullay previously i was creating my collection inside the Action class so was having problem.
The flow as per my understanding is as-:
check.jsp->checkbean.jsp (for values in reset methods)->check.jsp(to fill form)->checkbean(for setters to set form fields)-> CheckAction (when finally i submit the form). in between the mapping relationships goes on backend as per struts-config.xml.

Actually when the control was coming to name="CHOICES" it was not able to find the collection in scope as it would check in my form bean and no collection is there in any scope with name "CHOICES".

So after keeping the collection in reset of my formbean am setting it in request scope. So now my jsp is able to find the collection to use as below-:


I had made some rough explanation hope it makes sense
 
passwords must contain 14 characters, a number, punctuation, a small bird, a bit of cheese and a tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic