Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSTL forEach tag in struts problem

 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • 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
 
Stefan Willi
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • 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 ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64633
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stefan is correct. You can never use a tag as an attribute to another tag; Struts or otherwise.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18028
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • 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
Pie
Posts: 18028
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • 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
Author and ninkuma
Marshal
Pie
Posts: 64633
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic