aspose file tools
The moose likes JSF and the fly likes JSP in JSF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "JSP in JSF" Watch "JSP in JSF" New topic


amarshi mohanty
Ranch Hand

Joined: Jul 01, 2008
Posts: 110
Hi All,
Can I use scriplets to define a list inside a jsf file(.xhtml).


SCJP (97%), SCWCD (95%))
H Jetly
Ranch Hand

Joined: Aug 26, 2010
Posts: 41

Why would you want to use a scriplet?
Which scenario would a scriplet score over the managed bean ?

JSF gives you a managed bean, you can write all the code present in the scriplets in the managed bean.

Harsh Jetly
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16537

It's not even that good an idea to use scriptlets on plain old JSPs, except in occasional small doses.

Scriptlets are logic. JSF is an implementation of MVC. In MVC, you don't put logic on the View.

Also, JSF is not a linear translation of the View definition into Java code the way JSPs are. Instead the view is compiled into a data tree. Positional logic such as JSTL and scriptlets don't fit into the tree and the results can be unpredictable. And usually bad.

Customer surveys are for companies who didn't pay proper attention to begin with.
I agree. Here's the link:
subject: JSP in JSF