Forums Register Login

When is PageContext needed?

+Pie Number of slices to send: Send
Many things that a JSP might use, like request and respoonse are already available without a PageContext call. Local variables would, I assume, also be available. For example, instead of

I could have


So you can use EL or an expression to get at local variables. This means that the times that PageContext is actually needed is fairly limited. Or am I missing something? Thanks.

Ken
+Pie Number of slices to send: Send
 

Originally posted by Ken Duncan:
So you can use EL... to get at local variables.


Have you tried this? You might be quite surprised!
+Pie Number of slices to send: Send
 

Originally posted by Marc Peabody:

Have you tried this? You might be quite surprised!



No, I haven't tried it. I guessed it would be true but since you've put it that way, I guess it is the case rather that EL has a big gap in its capabilities. Thanks.

ken
+Pie Number of slices to send: Send
 

Originally posted by Ken Duncan:
... I guess it is the case rather that EL has a big gap in its capabilities.


I used to feel this way when I first started using EL. Since then I've found that if I don't write a bunch of scriptlet to create local variables (which I shouldn't be doing anyway), then this "gap in capabilities" isn't at all an issue.

In most cases [ie anything that's MVC] your bean setup code will not even be in a JSP, so you have to place your beans in some scope (most go in request scope) pretty much no matter what. In a real world context, EL is pretty stinkin' slick.
+Pie Number of slices to send: Send
 

Originally posted by Ken Duncan:
I guess it is the case rather that EL has a big gap in its capabilities.

To add to Marc's response...

No, there is no gap. The JSTL and the EL were purposefully designed to remove the need for scriptlets on the pages. The inability to reference scripting variables is quite deliberate as, when using the JSTL and EL, there shouldn't even be any scripting variables.
[ January 28, 2008: Message edited by: Bear Bibeault ]
If a regular clown is funny, then a larger clown would be funnier. Math. Verified by this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 645 times.
Similar Threads
Big Decimal to String
Rounding BigDecimal Calculation Yielded Wrong Result
BigDecimal ROUND_HALF_EVEN rounding mode and the number of digits to the right of the decimal point
[ . . . and thanks]how to make from double "235.97999999993036" to double "235.97"
How to perform manipulation on form-bean variables??
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 22:56:16.