开发者

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

开发者 https://www.devze.com 2023-04-07 12:21 出处:网络
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

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

精彩评论

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