• Post Reply Bookmark Topic Watch Topic
  • New Topic

Convention for placement of jsp:useBean  RSS feed

 
Jacob Fenwick
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there anything special about where you put a jsp:useBean? I've been putting them at the top of my jsps before the opening html tag.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66157
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They just need to go before their first reference.

Putting them at the top of the page is a fine convention.
[ August 21, 2006: Message edited by: Bear Bibeault ]
 
Rusty Smythe
Ranch Hand
Posts: 93
Mac Objective C Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
McConnell would argue that putting the definition as close to the first use as possible is the way to go.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66157
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that's a fine idea for Java code.

In JSPs, I prefer to put actions that generate no markup near the top of the page to keep them easier to find amongst the sea of markup, and to keep the markup generation as clear as possible. To each.
[ August 21, 2006: Message edited by: Bear Bibeault ]
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I prefer to put them at the top too. It's easier to find them back in a glance.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!