开发者

Blank a text field on click of a button

开发者 https://www.devze.com 2023-01-27 02:49 出处:网络
How to blank a text field on click of开发者_JAVA百科 a button in JSF?use f:ajax Your text field is obviosly binded to some property in backing bean. You can call the method of backing bean, which wil

How to blank a text field on click of开发者_JAVA百科 a button in JSF?


use f:ajax

Your text field is obviosly binded to some property in backing bean. You can call the method of backing bean, which will null the appropriate property. Specifying the f:ajax tag, you will mention what action should be called and what ui component will be updated.


----->>> JSPX File

< ice:inputText id="nameId" value="#{createBrandBean.brand.name}" size="30" maxlength="40" tabindex="2" onkeydown="moveFocus(event, 'aliasId')" />

< ice:commandButton value="Save" id="saveButton" action="#{createBrandBean.createBrand}" tabindex="5" styleClass="std-btn" />

--- >> in my createBrandBean.java File

private BrandVO brand; // Create a POJO Object

public String createBrand() {

brand.setName("");

or

brand = new BrandVO();

return "SUCCESS";

}


<input name="loginname" type="text" value="USERNAME" 
       size="10" onFocus="this.value=''"><br>


In actionListner you should use

txtField.setText("");
0

精彩评论

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