最佳实践,如何在 JSF 中更改 css 文件(已解决:如何从托管 Bean 访问 JSF 2.0 资源)
我知道如何访问资源表单视图,但是如何从托管 Bean 访问 JSF 资源(例如编辑 css 文件)?或者我根本不应该尝试这样做,而应该考虑另一个解决方案?
更新: 这个想法是通过从托管 Bean 访问它来更改 css 文件 @McDowell 帮助了我,我很感激。但正如他所说,这并不是一个好主意。目标是让用户能够更改页面样式(颜色、字体、布局等)。正如我之前所说,使用 style 属性会很烦人,我的第二个想法是编写自定义渲染器并生成嵌入式样式表,但我是 java EE 和 JSF 的初学者,所以我不确定这是否是个好主意,也许还有其他更简单的方法吗?
I know how to access resources form view, but how can I access JSF resources from Managed Bean for example to edit css file ? Or I shouldn't try to do it at all, and think about another solution ?
Update:
The idea was to alter css file by accessing it from Managed Bean @McDowell helped me with that and I'm relay grateful. But as he said it's not relay a good idea. The goal is to give user ability to alter page style (colors, fonts, layout etc.). As I said earlier using style attribute would be hm.. annoying, my second idea is to write custom renderer and generate embedded style sheet but I'm beginner in java EE and JSF so I'm not sure if it is good idea, maybe there is other easier way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论