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

Difference between <jsp:invoke> and <jsp:doBody> actions

Johnnie Smith
Greenhorn

Joined: May 02, 2012
Posts: 23
Hello, I want to know the difference between <jsp:invoke> and <jsp:doBody> actions in JSP 2.0. According to the specification, both perform the same task of invoking the body of a tag. But <jsp:doBody> operates on the body of the tag instead of on a specific fragment passed as an attribute.

I have used <jsp:doBody> successfully but I have not yet managed to understand the meaning of "specific fragment passed as an attribute".

Can somebody elaborate more on the use of <jsp:invoke> and explain the difference between the 2 actions, perhaps with the help of a small example?

Thanks & Regards,
John.
Amrit pandey
Greenhorn

Joined: Jun 28, 2010
Posts: 19
To understand the difference between <jsp:invoke> and <jsp:doBody> , we must first understand what is fragment:

============================================================================================================================================
JSP Fragment :

JSP Fragments is a new feature of JSP 2.0 that allows page authors to create custom action fragments that can be invoked. It allows a portion of JSP code to be encapsulated into a Java object that can be passed around and evaluated zero or more times. Template text and expression evaluations can be included in JSP fragments.

============================================================================================================================================

There can be more than one fragment for a JSP page. If we notice carefully, we will find that invoke has a required attribute called "fragment", whereas doBody has not.

Hence , <jsp:doBody> operates only on the body of the tag instead of a specific fragment (as it does not have "fragment" attribute to operate on a particular fragment )

"specific fragment passed as an attribute" means the specific fragment out of many more fragments in the JSP page on which <jsp:invoke> has to be applied.


Hope it might have clarified some of your doubts, feel free to share if you have any more question on this,


Thanks

Amrit Pandey

Thanks & Regards,
Amrit Pandey
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference between <jsp:invoke> and <jsp:doBody> actions