开发者

How to call a method with argment in an input component?

I want to call a method with parameter that return a string.

public String MyMethod(Intege开发者_如何学Cr param) {
    String xx=......;
    return xx;
}

And I want to display this result in <p:inputText>. How can I do this? I'm using primefaces.


Let's say you have the following:

private String someField;

public String getSomeField() {
   return someField;
}

public String setSomeField(String input) {
    someField = input;
}

Then you can access this property in your .xhtml file which contains the <p:inputText> like this:

<p:inputText value="#{nameOfYourManagedBean.someField}" />

Alright? I'd still recommend you to read a book or something, since this is very basic stuff.


Thank you for your answers, my classBean contain a reference of anotherClass like this

bean user {.... Profils idProfil}

So when I've tried to call beanUser.selectedProfil.nameProfil in p:inputText, it works fine. Thank's

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜