开发者

How to get value in a textbox from a JSF page to a Java Class?

I already created the bean, and it get开发者_开发百科s the value from the textbox, my problem is how can i pass it to another java class?


Just pass it as method argument the usual Java way. You can do it in the action method.

E.g.

<h:form>
    <h:inputText value="#{bean.input}" />
    <h:commandButton value="Submit" action="#{bean.submit}" />
</h:form>

with

private String input; // +getter +setter

public void submit() {
    YourAnotherClass yourAnotherClass = new YourAnotherClass();
    yourAnotherClass.process(input);
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜