【问题标题】:Importing class to JSF2 view to get the qualified name将类导入 JSF2 视图以获取限定名称
【发布时间】:2014-08-24 03:08:42
【问题描述】:

我是在 JSP 中完成的:

<%@ page
    import="org.example.applet.MyApplet"%>
<%

<div class="panel-body">
    <object type="application/x-java-applet"
        classid="java:<%=MyApplet.class.getName()%>.class"
        height="600" width="900">
        ...
        Applet failed to run. No Java plug-in was found.
    </object>
</div>

如何“将类名打印到 html/jsf2 视图中(在 xhtml 中)? 谢谢!

【问题讨论】:

    标签: java jsf-2 xhtml


    【解决方案1】:

    您需要在您的小程序中编写一个 getter 函数:

    public String getClassName(){
        return this.getClassName();
    }
    

    那么您需要将其称为 MyApplet.getClassName()。

    【讨论】:

    • 没有更简单的方法吗?这么多样板代码!所以 MyApplet 需要是 Spring-Component/EJB-Bean?
    猜你喜欢
    • 1970-01-01
    • 2014-11-15
    • 2012-10-12
    • 2017-08-04
    • 2023-03-19
    • 2018-02-27
    • 1970-01-01
    • 1970-01-01
    • 2016-09-30
    相关资源
    最近更新 更多