• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Problems with Indexed Properties, Hidden Values and Logic Iterate Tag

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi to all.
I'm using Struts 1.3, Tomcat 6.0 and Eclipse.

I have a problem with Indexed Properties.
I have a jsp that should save hidden values and pass it to the linked Action.

I show you my code.

********
JSP PAGE
********

where
- 'listaSport' is a list containing a list of sports. This list is correctly populated by the previous Action through 'select' and 'optionsCollection' tags.
- 'hSportBean' is a LabelValueBean list where I have to save the select options.

***********
ACTION FORM
***********


******
ACTION
******


The problem is that I can't load in Action the hidden values saved in the jsp page.
I tried to print the values received

but I always obtain null values (for all indexes).

So, I don't know how to solve my problem.

I also followed guidelines in:
http://faq.javaranch.com/java/IndexedProperties
http://struts.apache.org/1.x/struts-taglib/indexedprops.html
http://mail-archives.apache.org/mod_mbox/struts-user/200604.mbox/%3C5B7D2ACE8204B748980CEB2DBFAB90B3972E53@mail.delta-informatique.net%3E
but with no success.

Can you help me?

Thanks a lot in advance.
 
Michele Giunti
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Help!
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Frankly, I don't see anything wrong with your code. It should work! Just a couple of questions:

Is the result of the System.out.println statements a null pointer exception, or is the value simply null?

Use your browser's "view source" option on this page. The hidden fields should look like this. do they?
 
Michele Giunti
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Merrill Higginson:
Frankly, I don't see anything wrong with your code. It should work! Just a couple of questions:

Is the result of the System.out.println statements a null pointer exception, or is the value simply null?

Use your browser's "view source" option on this page. The hidden fields should look like this. do they?



Dear Merrill, first of all tahnks for your reply.


About your questions.
1) I modified my Action to check the values returned from jsp. I don't get a NullPointer Exception. I just get null values. For examples, I print the first (index=0) LabelValueBean of the list but I get the following output:
lvb[0].label=null
lvb[0].value=null



2) Yes, I get what you expect.


So, I can't understand where is the problem.
 
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I ran into something similar to this once a long time back. The problem was that java.beans.Introspector.getBeanInfo() was being called on my form it was determining that my private ArrayList was a propert (not an indexed property). If I remember correctly my solution was to make sure that I had an indexed version of both getter and setter methods. I think I may have also had to play with the order that the methods appeared in my form class.

I was using java 1.4.2 at the time and when I used a debugger on the Introspector class it appeared to me that it was finding a non-indexed getter or setter and from that assuming that the property itself wasn't indexed. I can't be sure that this is your problem but its something you might want to try. I know I wasted a huge amount of time figuring it out.
 
Michele Giunti
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Tom Rispoli:
I ran into something similar to this once a long time back. The problem was that java.beans.Introspector.getBeanInfo() was being called on my form it was determining that my private ArrayList was a propert (not an indexed property). If I remember correctly my solution was to make sure that I had an indexed version of both getter and setter methods. I think I may have also had to play with the order that the methods appeared in my form class.

I was using java 1.4.2 at the time and when I used a debugger on the Introspector class it appeared to me that it was finding a non-indexed getter or setter and from that assuming that the property itself wasn't indexed. I can't be sure that this is your problem but its something you might want to try. I know I wasted a huge amount of time figuring it out.



Thanks for your reply.
Unfortunately, this is not my problem.
 
It's a beautiful day in this neighborhood - Fred Rogers. Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic