4

I've been working with JSP and I know it's possible to put breakpoints and check any attribute value and add watchers. I'm getting started on JSF and I thought that the same idea was possible.

In the .xhtml file, I added: <ui:debug />

And ctrl + shift + D opens a new tab (facelets.ui.DebugOutput) and there's possible to evaluate.

I need to check a very basic expression such as:

<h:messages id="photoConfirmation" class="warning" rendered="#{selection.date != null and (!selection.hasPhoto() or !selection.photo)}">Photo is required</h:messages>

And facelets.ui.DebugOutput shows:

<HtmlMessages globalOnly="false" id="photoConfirmation" inView="true" layout="list" redisplay="true" rendered="false" showDetail="false" showSummary="true" styleClass="warning" tooltip="false" transient="false">

Isn't very useful for me bc I don't what's exactly the value of date, hasPhoto and photo. How can I add breakpoints in XHTML on IntelliJ to debug it? When I click to put a breakpoint in the line nothing happens (see the image below, for some reason I could add the breakpoint to a specific line but not the others).

enter image description here

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Daniela Morais
  • 2,125
  • 7
  • 28
  • 49
  • And also see https://softwareengineering.stackexchange.com/questions/181691/should-a-complex-el-expression-be-replaced-by-a-single-javabean-getter – Kukeltje Jun 04 '20 at 06:59
  • Also look at the second answer of this question https://stackoverflow.com/a/8275990/10547108. Evaluating the EL (see https://stackoverflow.com/questions/35668553/evaluate-el-expression-from-bean-in-jsf-page) in a test bean or something like that and showing the ouput could also help – fuggerjaki61 Jun 04 '20 at 07:09
  • I updated my question, thanks! – Daniela Morais Jun 04 '20 at 13:40
  • 2
    Don't think there is going to be any other 'answer' or solution than the two answers in https://stackoverflow.com/questions/8266953 posted by @fuggerjaki61 already. But personally I often create an `isPhotoRequired(selection)` method in my beans for this or even in my service and do `#{bean.isPhotoRequired(selection)}` in my page. Keeping the EL simple. But you can also set a breakpoint in the method from the other link posted by fuggerjaki61: https://stackoverflow.com/questions/35668553 and maybe set some breakpoints deeper down... – Kukeltje Jun 08 '20 at 13:58

0 Answers0