You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Trogrlic Zeljko <ze...@siemens.hr> on 2002/03/18 17:59:18 UTC
How to pass parameters to method in c:if
Hello,
I'm writing a presentation of the latest JSTL, but I have a problem with one
example.
In JSP, I need something like
<c:if test="${securityBean.check(request, response) }">
but it doesn't work. How can I pass parameters? All examples use only simple
getters. If someone knows the answer please reply ASAP because I have a
presentation in two days.
Thanks!
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: How to pass parameters to method in c:if
Posted by Mark Diggory <md...@latte.harvard.edu>.
Sorry, the last response was an error. -M.
Mark Diggory wrote:
>
>
> Shawn Bayern wrote:
>
>> On Mon, 18 Mar 2002, Dave Newton wrote:
>>
>>
>>> On Monday 18 March 2002 02:43 pm, you wrote:
>>>
>>>>> <c:if test="${securityBean.check(request, response) }">
>>>>>
>>>> The JSTL expression language does not support method invocations on
>>>> objects. You'll currently need to use a custom tag library or
>>>> scriptlet
>>>> code (with the former being recommended over the latter) if you want to
>>>> access arbitrary methods and pass arguments to them.
>>>>
>>> So, from a non-current tag/etc. user does this mean that I'd either
>>> want a custom tag for All Things Like That (i.e., <c:ifsecurecheck
>>> ...>) or, perhaps more OOish, <c:ifcheck param=MyBean> and use
>>> reflection to call a common method for everything I'd ever want to
>>> .check?
>>>
>>
>> Tags are a great mechanism for providing abstraction. If you want a
>> facility to call arbitrary methods from within a JSP page, Java
>> scriptlets
>> (<% %>) provide this already. Scriplets' problems don't just stem from
>> their syntax; they tend to make pages harder to maintain because they
>> don't create any meaningful abstraction.
>>
>> Tags do. When you design tags, I simply recommend you choose the most
>> convenient abstraction for your users.
>>
>> There's a theory in linguistic pragmatics (for actual human languages,
>> not
>> CS languages) that suggests language is a tradeoff between laziness and
>> effectiveness; as a speaker, you want to be lazy, but as a listener, you
>> want the speaker to provide as much information as is necessary. Since
>> everyone is both a speaker and a listener, languages end up being
>> balanced: not too verbose or too clipped, on average.
>>
>> Anyway, page authors and tag-library developers are in a similar
>> relationship. For every environment, there's a particular level of
>> "verbosity" that's appropriate; one isn't necessarily better than
>> others. JSTL works well with either approach; it encourages good
>> design when
>> unambiguous, but otherwise tries to avoid preaching about how you must
>> design your applications.
>>
>> --
>> Shawn Bayern
>> Author, "JSP Standard Tag Library" http://www.jstlbook.com
>> (coming this summer from Manning Publications)
>>
>>
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
>> <ma...@jakarta.apache.org>
>>
>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: How to pass parameters to method in c:if
Posted by Mark Diggory <md...@latte.harvard.edu>.
Shawn Bayern wrote:
> On Mon, 18 Mar 2002, Dave Newton wrote:
>
>
>>On Monday 18 March 2002 02:43 pm, you wrote:
>>
>>>><c:if test="${securityBean.check(request, response) }">
>>>>
>>>The JSTL expression language does not support method invocations on
>>>objects. You'll currently need to use a custom tag library or scriptlet
>>>code (with the former being recommended over the latter) if you want to
>>>access arbitrary methods and pass arguments to them.
>>>
>>So, from a non-current tag/etc. user does this mean that I'd either
>>want a custom tag for All Things Like That (i.e., <c:ifsecurecheck
>>...>) or, perhaps more OOish, <c:ifcheck param=MyBean> and use
>>reflection to call a common method for everything I'd ever want to
>>.check?
>>
>
> Tags are a great mechanism for providing abstraction. If you want a
> facility to call arbitrary methods from within a JSP page, Java scriptlets
> (<% %>) provide this already. Scriplets' problems don't just stem from
> their syntax; they tend to make pages harder to maintain because they
> don't create any meaningful abstraction.
>
> Tags do. When you design tags, I simply recommend you choose the most
> convenient abstraction for your users.
>
> There's a theory in linguistic pragmatics (for actual human languages, not
> CS languages) that suggests language is a tradeoff between laziness and
> effectiveness; as a speaker, you want to be lazy, but as a listener, you
> want the speaker to provide as much information as is necessary. Since
> everyone is both a speaker and a listener, languages end up being
> balanced: not too verbose or too clipped, on average.
>
> Anyway, page authors and tag-library developers are in a similar
> relationship. For every environment, there's a particular level of
> "verbosity" that's appropriate; one isn't necessarily better than others.
> JSTL works well with either approach; it encourages good design when
> unambiguous, but otherwise tries to avoid preaching about how you must
> design your applications.
>
> --
> Shawn Bayern
> Author, "JSP Standard Tag Library" http://www.jstlbook.com
> (coming this summer from Manning Publications)
>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: examples using Standard Taglib (with i18n) for interbalization
?
Posted by Shawn Bayern <ba...@essentially.net>.
On Tue, 19 Mar 2002, RAYMOND Romain wrote:
>
> in the source examples given I don't understand the easy way to map a
> request with a particular ressource bundle which will permit to use
> <fmt:message key="test1" /> ... based on user's language preference. A
> solution coulb be to use a ruser session parameter but is there an
> "automatic" method ?
>
> If you have an example or indications, thanks.
The <fmt:bundle> tag lets you set up a resource bundle family, either as
- a new default for a particular scope
- a scoped variable
- the default for its body
You can specify this family with a basename.
Is that what you're asking?
--
Shawn Bayern
Author, "JSP Standard Tag Library" http://www.jstlbook.com
(coming this summer from Manning Publications)
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
examples using Standard Taglib (with i18n) for interbalization ?
Posted by RAYMOND Romain <ro...@c-s.fr>.
hello,
in the source examples given I don't understand the easy way to map a
request
with a particular ressource bundle which will permit to use <fmt:message
key="test1" /> ...
based on user's language preference.
A solution coulb be to use a ruser session parameter but is there an
"automatic" method ?
If you have an example or indications, thanks.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: How to pass parameters to method in c:if
Posted by Shawn Bayern <ba...@essentially.net>.
On Mon, 18 Mar 2002, Dave Newton wrote:
> On Monday 18 March 2002 02:43 pm, you wrote:
> > > <c:if test="${securityBean.check(request, response) }">
> > The JSTL expression language does not support method invocations on
> > objects. You'll currently need to use a custom tag library or scriptlet
> > code (with the former being recommended over the latter) if you want to
> > access arbitrary methods and pass arguments to them.
>
> So, from a non-current tag/etc. user does this mean that I'd either
> want a custom tag for All Things Like That (i.e., <c:ifsecurecheck
> ...>) or, perhaps more OOish, <c:ifcheck param=MyBean> and use
> reflection to call a common method for everything I'd ever want to
> .check?
Tags are a great mechanism for providing abstraction. If you want a
facility to call arbitrary methods from within a JSP page, Java scriptlets
(<% %>) provide this already. Scriplets' problems don't just stem from
their syntax; they tend to make pages harder to maintain because they
don't create any meaningful abstraction.
Tags do. When you design tags, I simply recommend you choose the most
convenient abstraction for your users.
There's a theory in linguistic pragmatics (for actual human languages, not
CS languages) that suggests language is a tradeoff between laziness and
effectiveness; as a speaker, you want to be lazy, but as a listener, you
want the speaker to provide as much information as is necessary. Since
everyone is both a speaker and a listener, languages end up being
balanced: not too verbose or too clipped, on average.
Anyway, page authors and tag-library developers are in a similar
relationship. For every environment, there's a particular level of
"verbosity" that's appropriate; one isn't necessarily better than others.
JSTL works well with either approach; it encourages good design when
unambiguous, but otherwise tries to avoid preaching about how you must
design your applications.
--
Shawn Bayern
Author, "JSP Standard Tag Library" http://www.jstlbook.com
(coming this summer from Manning Publications)
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: How to pass parameters to method in c:if
Posted by Dave Newton <da...@solaraccess.com>.
On Monday 18 March 2002 02:43 pm, you wrote:
> > <c:if test="${securityBean.check(request, response) }">
> The JSTL expression language does not support method invocations on
> objects. You'll currently need to use a custom tag library or scriptlet
> code (with the former being recommended over the latter) if you want to
> access arbitrary methods and pass arguments to them.
So, from a non-current tag/etc. user does this mean that I'd either want a
custom tag for All Things Like That (i.e., <c:ifsecurecheck ...>) or, perhaps
more OOish, <c:ifcheck param=MyBean> and use reflection to call a common
method for everything I'd ever want to .check?
Just curious.
Thanks for your time,
Dave
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: How to pass parameters to method in c:if
Posted by Shawn Bayern <ba...@essentially.net>.
On Mon, 18 Mar 2002, Trogrlic Zeljko wrote:
> Hello,
>
> I'm writing a presentation of the latest JSTL, but I have a problem
> with one example.
>
> In JSP, I need something like
>
> <c:if test="${securityBean.check(request, response) }">
>
> but it doesn't work. How can I pass parameters? All examples use only
> simple getters. If someone knows the answer please reply ASAP because
> I have a presentation in two days.
>
> Thanks!
The JSTL expression language does not support method invocations on
objects. You'll currently need to use a custom tag library or scriptlet
code (with the former being recommended over the latter) if you want to
access arbitrary methods and pass arguments to them.
--
Shawn Bayern
Author, "JSP Standard Tag Library" http://www.jstlbook.com
(coming this summer from Manning Publications)
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>