• 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

JSTL forEach tag in struts problem

 
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi, i facing a problem in jstl , i using foreach tag to iterate the list ,

it working , but the problem is when i want to put struts checkbox into jstl, it give me error



can i set the value of checkbox as above code ? or what are the correct way to do so ? thank you
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you get an compile Error, then try



You must not use the c ut tag, you simply can use the EL.

I have not tried this code, but think, this should work.

Stefan
[ April 08, 2005: Message edited by: Stefan Willi ]
 
Sheriff
Posts: 67746
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
Stefan is correct. You can never use a tag as an attribute to another tag; Struts or otherwise.
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bear Bibeault:
Stefan is correct. You can never use a tag as an attribute to another tag; Struts or otherwise.



No?

 
Tim Holloway
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Seriously, the ability to place expressions in attributes is dependent on how the tag was defined.

However, the <html:checkbox> tag is a Struts tag and it should be coded according to Struts constraints.

You don't need a <c ut> tag here, because you can use EL and just say:



Note that "bean,myname is incorrect. Use a dot, not a comma, just like in regular Java.

Also, this only works if you include the Struts.el jar!

The normal Struts classes don't support EL.

This question would have been more appropriate for the Struts forum, BTW.
 
Bear Bibeault
Sheriff
Posts: 67746
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

No?



Clarification:

You can never use a tag as an attribute to another custom tag; Struts or otherwise.

Tim's example shows a custom tag being used as an attribute to an HTML tag, which is, of course, fine and dandy since the HTML tag is merely template text.
[ April 08, 2005: Message edited by: Bear Bibeault ]
 
Anything worth doing well is worth doing poorly first. Just look at this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic