小编Mis*_*isa的帖子

隐含的函数声明 - C99

我目前正在使用Xcode 4,在我的.pch文件中我有这个宏: #define localize(s) NSLocalizedString((s), nil).
当我尝试在某个.m文件中使用此宏时,我收到此警告:Implicit declaration of function 'localize' is invalid in C99.

这段代码编译没有问题,但我该如何解决这个问题,所以我没有得到警告?

macros xcode objective-c c99 pch

33
推荐指数
2
解决办法
5万
查看次数


在JSF2中渲染表单范围之外的组件

我正在创建一个简单的页面,在单击按钮后,将一个panelGroup替换为另一个.一,代码:

<h:body>

    <ui:composition template="/elements/templateWithMenu.xhtml">           
        <ui:define name="content">
            <div class="rightContent">

                <h:panelGroup id="lol" rendered="#{test.firstStep.booleanValue()}">

                    <h3>This should disappear</h3>

                    <h:form id="newPollForm1" rendered="#{test.firstStep.booleanValue()}"> 
                        <fieldset>
                            <h:commandLink value="Next" action="#{test.firstStepCompleted()}" >
                                <f:ajax execute="@all" render="lol" />
                            </h:commandLink>
                        </fieldset>
                    </h:form>

                </h:panelGroup>

                <h:panelGroup rendered="#{test.secondStep.booleanValue()}">
                    Works!
                </h:panelGroup>

            </div>     
        </ui:define>
    </ui:composition>

</h:body>
Run Code Online (Sandbox Code Playgroud)

支持bean只是将firstStep设置为false,将secondStep设置为true.

现在,当我尝试运行时,我得到了<f:ajax> contains an unknown id 'lol' - cannot locate it in the context of the component j_idt39.在谷歌搜索后,我发现对于表单范围之外的元素,我需要使用SEPARATOR_CHAR(:).那没用.所以我尝试搞乱#{component}和#{cc}的不同组合,但没有任何效果.我甚至发现了这个令人敬畏的解释,但同样,我失败了.如果我使用@all,一切正常(一个面板被另一个面板替换),但我真的需要渲染一个特定的组件.

救命?请?

jsf el java-ee jsf-2

4
推荐指数
1
解决办法
6919
查看次数

Java继承问题

我有一个抽象类Airplane,以及两个类PassengerAirplane和CargoAirplane,它们扩展了类Airplane.我还有一个可衡量的接口,以及实现它的两个类 - People和Containers.
因此,飞机可以自己做很多事情,并且有一种方法可以将可测量的东西添加到飞机上(称为addAMeasurableThing).PassengerAirplane/CargoAirplane和Airplane之间的唯一区别是addAMeasurableThing应该只接受People/Containers,而不是任何可衡量的东西.我该如何实现?

我试过:
飞机课:

public abstract Airplane addAMeasurableThing(Measurable m,int position);

PassengerAirplane类:

public Airplane addAMeasurableThing(Measurable m,int position){if(m instanceof People)...

CargoAirplane类:

public Airplane addAMeasurableThing(Measurable m,int position){if(m instanceof Containers)...

但是当我调试它时,我注意到CargoAirplane类中的addAMeasurableThing永远不会被调用,因为两种方法都具有相同的签名.那么如何调用相应的PassengerAirplane/CargoAirplane的addAMeasurableThing,具体取决于传递的可衡量事物的类型?

谢谢!

java inheritance abstract-class interface

1
推荐指数
1
解决办法
327
查看次数