aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Refining Understanding of JSTL variable scope versus JSP declaration Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Refining Understanding of JSTL variable scope versus JSP declaration" Watch "Refining Understanding of JSTL variable scope versus JSP declaration" New topic
Author

Refining Understanding of JSTL variable scope versus JSP declaration

Tyler Wright
Ranch Hand

Joined: Jun 25, 2009
Posts: 40
Hi all,

1) JSP scripting elements are very jsp translation to java class oriented.
2) JSP delcarations are class or instance variables
3) JSP scriptlet variables are local vars.
This is clear...if you look at compiles JSPs this is crystal clear.

Now:
JSTL action tags cannot access any JSP declaration or scriptlet variables unless those variables are placed into a scope and of course the default scope is page scope.

So, this means JSTL communicates to other JSTL elements only through scope.
The means by which variables are declared and removed from scope using only JSTL is with <c:set> or <c:remove>.

Is this conceptualization accurate?

I have more to add but, let's see how this flies...

Oh one more thing...looking through the java file for a scriptless JSP page which uses only JSTL, reveals that all of the manipulation of data occurs in the methods that were inserted into the file per the use of JSTL.
Each of these methods, seems to be very self contained and communicate only through the "scoping" mechanism.


SCJP SCJD
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Is this conceptualization accurate?

It sounds fine. JSTL variables are scoped attributes. Scriptlets variables are just Java variables.

Each of these methods, seems to be very self contained and communicate only through the "scoping" mechanism.

I think it's up to the container provider to decide how to manage this, and using a method is probably the cleanest way to do it.


[My Blog]
All roads lead to JavaRanch
 
Consider Paul's rocket mass heater.
 
subject: Refining Understanding of JSTL variable scope versus JSP declaration