Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #6168

Re: JSF 1.2

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!z7g2000prh.googlegroups.com!not-for-mail
From lewbloch <lewbloch@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: JSF 1.2
Date Wed, 13 Jul 2011 11:32:35 -0700 (PDT)
Organization http://groups.google.com
Lines 62
Message-ID <f18aeddb-7d48-47aa-8547-b059c6737d23@z7g2000prh.googlegroups.com> (permalink)
References <4e1d5166$0$1538$426a74cc@news.free.fr> <9865pfF2qeU1@mid.individual.net>
NNTP-Posting-Host 172.19.63.131
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
X-Trace posting.google.com 1310581956 16315 127.0.0.1 (13 Jul 2011 18:32:36 GMT)
X-Complaints-To groups-abuse@google.com
NNTP-Posting-Date Wed, 13 Jul 2011 18:32:36 +0000 (UTC)
Complaints-To groups-abuse@google.com
Injection-Info z7g2000prh.googlegroups.com; posting-host=172.19.63.131; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-Header-Order ASELCHRU
X-HTTP-UserAgent Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.41 Safari/535.1,gzip(gfe)
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6168

Show key headers only | View raw


On Jul 13, 11:17 am, Chris Riesbeck <Chris.Riesb...@gmail.com> wrote:
> On 7/13/2011 3:03 AM, Pif - 34 wrote:
>
> > Hello,
>
> > I'm working on a project based on JSF1.2. In a XHTML document, I must
> > call a method using a parameter.
>
> > So, since this is not possible directly using standard syntax, I would
> > like to know if one of following solutions is possible that cut be
> > usefull in my code:
>
> > - use an include of a JSP template that do the code I need to place ? In
> > a <html ... > doc, you can only include <html subdocs ?
>
> > - include a JSP tag in the <html> that allow to place javacode ?
>
> > Do you have Id of workarounds ?
>
> For just one such method, you can create a function you can call in the
> JSP expression language. Just two steps:
>
>    - in an appropriate class, define a static method
>    - in a TLD file, declare the function
>
> Details at
>
>    http://download.oracle.com/javaee/1.4/tutorial/doc/JSPIntro7.html
>
> If I have many such methods, I define one "call" method in some utility
> class (error checking code removed) and the associated TLD
>
>    public static Object call(final Object obj, final String methodName,
> final Object arg)
>    throws IllegalAccessException, InvocationTargetException,
> NoSuchMethodException {
>     return obj.getClass()
>               .getMethod(methodName, arg.getClass())
>               .invoke(obj, arg);
>    }
>
> then I can write expressions like the following, where au is the prefix
> for my tag library:
>
>     "${au:call(user, 'getDomainRoles', domain)}"
>
> to call user.getDomainRoles(domain)

Why are people discussing JSP when the OP states that the problem is
in XHTML?

There are other ways, too - for example, set a member variable in a
page-level bean instead of passing a method argument.

I thought EL allowed passing arguments to methods.  I will have to
research this.  It's a problem I've faced before but I don't remember
the solution off the top of my head.  I'll be back on that.

--
Lew

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

JSF 1.2 Pif - 34 <fj@nospam.fr> - 2011-07-13 10:03 +0200
  Re: JSF 1.2 Chris Riesbeck <Chris.Riesbeck@gmail.com> - 2011-07-13 13:17 -0500
    Re: JSF 1.2 lewbloch <lewbloch@gmail.com> - 2011-07-13 11:32 -0700
      Re: JSF 1.2 Travers Naran <tnaran@gmail.com> - 2011-07-17 21:54 -0700

csiph-web