Wednesday, February 12, 2014

How to debug EL in the JSF page? I'd like to watch variable values, function calls an so on. The best solution would be an eclipse plugin, but any other possibility is better than guessing "Why this expression failed to render correctly?".
share|improve this question
add comment

2 Answers

up vote29down voteaccepted
Closest what you can get in JSF/Facelets is placing an  somewhere in the view:
 />
Pressing CtrlShiftD should then show a popup window with debug information about the component tree and all available request parameters and request/view/flash/session/application scoped variables. It's basically a representation of the content of all those maps.
The hotkey is by the way configureable by hotkey attribute so that you can choose another whenever it clashes with browser default hotkeys, as it would do in Firefox; CtrlShiftD would by default show the Add bookmarks dialogue. Here's how you could make it to listen on CtrlShiftX instead:
 hotkey="x" />
You'd usually also like to hide it in non-development stage, so add a rendered condition like that:
 hotkey="x" rendered="#{facesContext.application.projectStage == 'Development'}" />
In the shown debug information, the information provided about scoped variables isn't that great as you would expect. It only shows the Object#toString() outcome of all scoped variables which defaults tocom.example.Bean@hashcode. You can't explore their properties and the values of their properties directly like as you could do in debug view of Eclipse's debugger. You'd need to implementtoString() on the class accordingly so that as much as possible relevant information is returned (if necessary, you can even let Eclipse autogenerate it by rightclick source code > Source > Generate toString()):
@Override
public String toString() {
    return String.format("Bean[prop1=%s,prop2=%s,prop3=%s]", prop1, prop2, prop3);
}
As to method calls, just put a breakpoint on the Java source code the usual way. Eclipse will kick in there as well when EL calls the method. If it's a managed bean, you'll also just see its properties in the Eclipse debugger.
share|improve this answer
 
Finally I use normal eclipse debugger end ui:debug. –  mrzasa Dec 6 '11 at 8:09 
 
+1 for getting  to work (for a rather sad definition of work) –  Thorbjørn Ravn Andersen Apr 3 '12 at 13:28
 
Hi BalusC, I was thinking of asking a similar question but it seems better to just post it here... I followed yourDebug JSF lifecycle article on your blog. Other than the debugging mechanisms you suggest here and on that article, is it possible to dive into JSF implementation source? I have a problem on my view with the tags. The rendering isn't as expected and I can give no meaning as to why it is the way it is. I was thinking of diving into JSF source. Would it make sense and if it would, would you be able to point me to a resource to get started? –  Murat Jan 9 '13 at 9:45 
1 
@Murat: start with a breakpoint on encodeAll() method of the desired UIComponent class. –  BalusCJan 9 '13 at 10:29
add comment

5 comments:

for ict 99 said...

Great Article
JSF Online Training | JSF Training | JSF Training Courses | Java Training Institutes in Chennai | Java Training in Chennai | Java Course in Chennai | JSF Interview Questions

oakleyses said...

jordan pas cher, chanel handbags, nike outlet, michael kors pas cher, kate spade outlet, replica watches, longchamp pas cher, nike free, jordan shoes, christian louboutin shoes, nike free run, louis vuitton outlet, oakley sunglasses, ray ban sunglasses, polo ralph lauren, ugg boots, christian louboutin uk, air max, louis vuitton outlet, ugg boots, tiffany jewelry, polo ralph lauren outlet online, burberry pas cher, prada outlet, nike air max, gucci handbags, sac longchamp pas cher, ray ban sunglasses, louboutin pas cher, louis vuitton, uggs on sale, tiffany and co, oakley sunglasses, louis vuitton outlet, ray ban sunglasses, longchamp outlet, louis vuitton, longchamp outlet, replica watches, nike roshe, polo outlet, oakley sunglasses, cheap oakley sunglasses, oakley sunglasses wholesale, christian louboutin, christian louboutin outlet, tory burch outlet

oakleyses said...

lululemon canada, nike air max, burberry outlet, oakley pas cher, burberry handbags, coach outlet store online, kate spade, michael kors outlet, michael kors, nike air force, true religion jeans, true religion outlet, michael kors, polo lacoste, nike tn, new balance, abercrombie and fitch uk, michael kors outlet, uggs outlet, michael kors outlet, ralph lauren uk, michael kors outlet online, replica handbags, coach outlet, true religion outlet, coach purses, nike free uk, sac vanessa bruno, mulberry uk, michael kors outlet online, michael kors outlet online, michael kors outlet online, north face, uggs outlet, converse pas cher, hogan outlet, nike air max uk, hollister pas cher, sac hermes, nike roshe run uk, hollister uk, nike air max uk, true religion outlet, timberland pas cher, vans pas cher, ray ban pas cher, guess pas cher, ray ban uk

raybanoutlet001 said...

kobe byrant shoes
mlb jerseys
michael kors outlet store
cheap true religion jeans
oakley sunglasses
nike huaraches
links of london
cheap mlb jerseys
adidas nmd
michael kors handbags clearance
cheap jordan shoes
kobe shoes
michael kors handbags
yeezy boost
nike huarache
michael kors handbags sale
michael kors handbags
nike kobe sneakers
nike huarache
air jordan retro
tiffany and co jewellery
ralph lauren online
http://www.uggoutlet.uk

بروكر said...

I definitely love this site.
https://slashdot.org/~prokr2020
https://prokr2020.livejournal.com/
https://prokr2020.cms.webnode.com/khdmat-brwkr/
https://www.prokr.net/ksa/jeddah-water-leaks-detection-isolate-companies/