aspose file tools*
The moose likes JSP and the fly likes jsp:useBean    Action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "jsp:useBean    Action" Watch "jsp:useBean    Action" New topic
Author

jsp:useBean Action

colin shuker
Ranch Hand

Joined: Apr 11, 2005
Posts: 744
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

Joined: Jan 10, 2002
Posts: 61654
    
  67

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?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
colin shuker
Ranch Hand

Joined: Apr 11, 2005
Posts: 744
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

Joined: Jan 10, 2002
Posts: 61654
    
  67

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

Joined: Apr 11, 2005
Posts: 744
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

Joined: Jan 10, 2002
Posts: 61654
    
  67

In any action, order of the attributes is not important.
colin shuker
Ranch Hand

Joined: Apr 11, 2005
Posts: 744
Thanks, are the Attribute properties I've listed above also correct?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61654
    
  67

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

Joined: Jul 06, 2005
Posts: 1018
Yes read the specification.

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

specifically the useBean tag.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jsp:useBean Action