Finding a JSF managed bean implementation class while analyzing Facelets code [duplicate]

可紊 提交于 2019-12-14 03:24:26

问题


You are analyzing the Facelets code of a very large JSF web application written by others (e.g. during a production incident) and you want to find the bean class that is implementing a bean, knowing its name as it comes in EL expression.

You didn't write it and the bean's name does not match any Java class in the project.

You can't assume that the class is annotated.

While there are several methods to reach to the same result, I hope this question can document the best practices to solve this problem.

NOTE: This question is not about how to enable an IDE option to do so, it is about how to deal with it, without IDE support. I have made many searches and haven't found this question in StackOverflow, in the terms expressed here.


回答1:


Print it!

(-) Requires to redeploy.

  • Edit the XHTML file to write out the class' name

<!-- #{msg.getClass().getSimpleName()} -->  
  • Redeploy the modified XHTML file

  • Reload the page

Look for Annotations

(-) Not always works

  • Search for the annotation ("@ManagedBean") across the workspace and find the annotation.

Look in Face-Config

  • Search in faces-config.xml (e.g. ResourceBundles)

IDE Support

  • E.g. Eclipse with JBoss Tools EL proposals / autocomplete / code assist in Facelets with Eclipse


来源:https://stackoverflow.com/questions/48608449/finding-a-jsf-managed-bean-implementation-class-while-analyzing-facelets-code

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!