• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp:useBean Action

 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there, when using the useBean action, I'm not clear what possible
combinations are allowed for the attributes
"id","class","beanName","type","scope".
I'm pretty sure "scope" is optional and does not depend on the other attributes.

Thanks very much for any help.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64724
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you read the section on useBean in the JSP Specification? If not, that's the best place to start. If so, what specific questions do you have regarding it?
 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, where do I find the JSP specification?
Is that in the sun site?
I'm just unsure which combinations of "id","class","beanName","type"
I can use
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64724
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Links are in the JSP FAQ.

If you are going to be writing web apps, you should have copies of the JSP, Servlet and JSTL specifications open on your desk.
 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, I have put those specifications on my desktop, I already have icons on desktop for the Java API and Servlet API.

Anyway, I've looked at the useBean tag:
Can someone confirm this is correct please:

<jsp:useBean ATTRIBUTES >
ATTRIBUTE "id" --- Mandatory
ATTRIBUTE "scope" --- Optional
ATTRIBUTE "class" --- Optional (But CANNOT use "beanName")
ATTRIBUTE "beanName" --- Optional (BUT CANNOT use "class", MUST use "type")
ATTRUBUTE "type" --- Optional

Also, can theses attributes be places in ANY order within the tag??
Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64724
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In any action, order of the attributes is not important.
 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, are the Attribute properties I've listed above also correct?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64724
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sort of. Sometimes it's more complex than just a yes or no.

For example, the class attribute is only optional if the named object already exists as a scoped variable in the target scope. In that case, type is no longer optional.

This is why you didn't find a handy-dandy little table. The interactions between the attributes and the environment need to be taken into account.
 
Stefan Evans
Bartender
Posts: 1692
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes read the specification.

But I find this referenceto be a lot easier to refer to.

specifically the useBean tag.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic