本文整理汇总了Java中javax.faces.component.html.HtmlInputText类的典型用法代码示例。如果您正苦于以下问题:Java HtmlInputText类的具体用法?Java HtmlInputText怎么用?Java HtmlInputText使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HtmlInputText类属于javax.faces.component.html包,在下文中一共展示了HtmlInputText类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: validate
import javax.faces.component.html.HtmlInputText; //导入依赖的package包/类
/**
* Validates if the user input and captchaInputField contain the same value
*
* @param context
* FacesContext for the request we are processing
* @param component
* UIComponent we are checking for correctness
* @param value
* the value to validate
* @throws ValidatorException
* if validation fails
*/
@Override
public void validate(final FacesContext context,
final UIComponent captchaInputField, final Object value)
throws ValidatorException {
String userInput = (String) value;
String captchaKey = (String) JSFUtils
.getSessionAttribute(Constants.CAPTCHA_KEY);
if (userInput != null && userInput.equals(captchaKey)) {
JSFUtils.setSessionAttribute(Constants.CAPTCHA_INPUT_STATUS,
Boolean.TRUE);
} else {
HtmlInputText htmlInputText = (HtmlInputText) captchaInputField;
htmlInputText.setValid(false);
JSFUtils.setSessionAttribute(Constants.CAPTCHA_INPUT_STATUS,
Boolean.FALSE);
htmlInputText.setValue("");
String text = JSFUtils.getText(BaseBean.ERROR_CAPTCHA,
(Object[]) null);
throw new ValidatorException(new FacesMessage(
FacesMessage.SEVERITY_ERROR, text, null));
}
}
开发者ID:servicecatalog,项目名称:oscm,代码行数:35,代码来源:CaptchaValidator.java
示例2: setup
import javax.faces.component.html.HtmlInputText; //导入依赖的package包/类
@Before
public void setup() {
validator = new CaptchaValidator();
sessionMock = new HttpSessionStub(Locale.ENGLISH);
context = new FacesContextStub(Locale.ENGLISH) {
@Override
public ExternalContext getExternalContext() {
ExternalContext exContext = spy(new ExternalContextStub(
Locale.ENGLISH));
doReturn(sessionMock).when(exContext).getSession(false);
return exContext;
}
};
inputField = new HtmlInputText() {
@Override
public String getClientId(FacesContext ctx) {
return "";
}
};
}
开发者ID:servicecatalog,项目名称:oscm,代码行数:22,代码来源:CaptchaValidatorTest.java
示例3: testRIManyInputAttributes
import javax.faces.component.html.HtmlInputText; //导入依赖的package包/类
public void testRIManyInputAttributes() throws IOException
{
HtmlInputText out = new HtmlInputText();
out.setValue("Plain value");
out.setId("OutId");
out.setTitle("Title");
out.setStyleClass("Style Class");
out.setOnclick("on click");
out.setOnclick("on click");
out.setOndblclick("on dblclick");
out.setOnkeydown("on keydown");
out.setOnkeyup("on keyup");
out.setOnkeypress("on keypress ");
out.setOnmousedown("on mousedown");
out.setOnmousemove("on mousemove");
out.setOnmouseout("on mouseout ");
out.setOnmouseover("on mouseover ");
out.setOnmouseup("on mouseup ");
UIViewRoot root = createTestTree(out, "testRIManyInputAttributes()");
renderRoot(root);
root = createTestTree(out, "testRIManyInputAttributes() 2");
renderRoot(root);
}
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:27,代码来源:CoreRenderKitPerf.java
示例4: testSimplePassThroughAttribute
import javax.faces.component.html.HtmlInputText; //导入依赖的package包/类
public void testSimplePassThroughAttribute() throws Exception
{
_responseWriter.startDocument();
HtmlInputText inputText = new HtmlInputText();
inputText.getPassThroughAttributes().put("data-test", "test");
_responseWriter.startElement("div", inputText);
_responseWriter.startElement("div", null);
_responseWriter.startElement("input", null);
_responseWriter.writeAttribute("name", "test", null);
_responseWriter.endElement("input");
_responseWriter.endElement("div");
_responseWriter.endElement("div");
_responseWriter.endDocument();
Assert.assertEquals("<?xml version='1.0' encoding='UTF-8'?>\n" +
"<partial-response id=\"j_id1\"><div data-test=\"test\"><div><input name=\"test\"/></div></div></partial-response>", _stringWriter.toString());
}
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:17,代码来源:XmlResponseWriterTest.java
示例5: testValueExpressionPassThroughAttribute
import javax.faces.component.html.HtmlInputText; //导入依赖的package包/类
public void testValueExpressionPassThroughAttribute() throws Exception
{
externalContext.getRequestMap().put("test", Boolean.TRUE);
_responseWriter.startDocument();
HtmlInputText inputText = new HtmlInputText();
inputText.getPassThroughAttributes().put("data-test", new MockValueExpression("#{test}", Boolean.TYPE));
_responseWriter.startElement("div", inputText);
_responseWriter.startElement("div", null);
_responseWriter.startElement("input", null);
_responseWriter.writeAttribute("name", "test", null);
_responseWriter.endElement("input");
_responseWriter.endElement("div");
_responseWriter.endElement("div");
_responseWriter.endDocument();
Assert.assertEquals("<?xml version='1.0' encoding='UTF-8'?>\n" +
"<partial-response id=\"j_id1\"><div data-test=\"true\"><div><input name=\"test\"/></div></div></partial-response>", _stringWriter.toString());
}
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:18,代码来源:XmlResponseWriterTest.java
示例6: testRendererLocalNamePassThroughAttribute
import javax.faces.component.html.HtmlInputText; //导入依赖的package包/类
public void testRendererLocalNamePassThroughAttribute() throws Exception
{
_responseWriter.startDocument();
HtmlInputText inputText = new HtmlInputText();
inputText.getPassThroughAttributes().put(Renderer.PASSTHROUGH_RENDERER_LOCALNAME_KEY, "test");
_responseWriter.startElement("div", inputText);
_responseWriter.startElement("div", null);
_responseWriter.startElement("input", null);
_responseWriter.writeAttribute("name", "test", null);
_responseWriter.endElement("input");
_responseWriter.endElement("div");
_responseWriter.endElement("div");
_responseWriter.endDocument();
Assert.assertEquals("<?xml version='1.0' encoding='UTF-8'?>\n" +
"<partial-response id=\"j_id1\"><test><div><input name=\"test\"/></div></test></partial-response>", _stringWriter.toString());
}
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:17,代码来源:XmlResponseWriterTest.java
示例7: testValueExpressionPassThroughAttribute
import javax.faces.component.html.HtmlInputText; //导入依赖的package包/类
public void testValueExpressionPassThroughAttribute() throws Exception
{
externalContext.getRequestMap().put("test", Boolean.TRUE);
_responseWriter.startDocument();
HtmlInputText inputText = new HtmlInputText();
inputText.getPassThroughAttributes().put("data-test", new MockValueExpression("#{test}", Boolean.TYPE));
_responseWriter.startElement("div", inputText);
_responseWriter.startElement("div", null);
_responseWriter.startElement("input", null);
_responseWriter.writeAttribute("name", "test", null);
_responseWriter.endElement("input");
_responseWriter.endElement("div");
_responseWriter.endElement("div");
_responseWriter.endDocument();
Assert.assertEquals("<div data-test><div><input name=\"test\"></div></div>", _stringWriter.toString());
}
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:17,代码来源:HtmlResponseWriterTest.java
示例8: validate
import javax.faces.component.html.HtmlInputText; //导入依赖的package包/类
@Override
public void validate(FacesContext context, UIComponent uiComponent, Object value) throws ValidatorException {
Pattern pattern = Pattern.compile("\\[email protected]\\w+\\.\\w+");
Matcher matcher = pattern.matcher(
(CharSequence) value);
HtmlInputText htmlInputText
= (HtmlInputText) uiComponent;
String label;
if (htmlInputText.getLabel() == null
|| htmlInputText.getLabel().trim().equals("")) {
label = htmlInputText.getId();
} else {
label = htmlInputText.getLabel();
}
if (!matcher.matches()) {
FacesMessage facesMessage
= new FacesMessage(label
+ ": not a valid email address");
throw new ValidatorException(facesMessage);
}
}
开发者ID:PacktPublishing,项目名称:Java-EE-7-Development-with-NetBeans-8,代码行数:25,代码来源:EmailValidator.java
示例9: keyUpListener
import javax.faces.component.html.HtmlInputText; //导入依赖的package包/类
/**
* Listener que escucha las peticiones del field codigo y llama al
* correspondiente {@link KeyListener} cuando un evento ocurre, si el
* correspondiente {@link KeyListener} no maneja el evento, se setea a null
* el objeto seleccionado
*
* @param event
*/
public void keyUpListener(final AjaxBehaviorEvent event) {
Object submitted = ((HtmlInputText) event.getSource())
.getSubmittedValue();
FacesContext fc = FacesContext.getCurrentInstance();
if (keyListener != null) {
boolean bool = keyListener.onBlur(this, event, submitted);
// Tratar cuadno se selecciona un valor nulo
if (!bool) {
getValueExpression().setValue(fc.getELContext(), null);
createFacesMessage(FacesMessage.SEVERITY_WARN,
COMPONENT_PICKER_INPUT_NOT_FOUND,
COMPONENT_PICKER_INPUT_NOT_FOUND);
}
}
}
开发者ID:fpuna-cia,项目名称:karaku,代码行数:26,代码来源:PickerField.java
示例10: unBind
import javax.faces.component.html.HtmlInputText; //导入依赖的package包/类
/**
* Triggered on the save event from the metadata editor.
* <p/>
* On this event, either HtmlSelectOneMenu input value or the HtmlInputText
* value is propagated to the parameter's singleValue (depending on the
* whether or not the user has selected the "Other" option).
* @param context the UI context
* @param editorForm the Faces HtmlForm for the metadata editor
* @param parameter the associated parameter
* @throws SchemaException if an associated Faces UIComponent cannot be located
*/
@Override
public void unBind(UiContext context,
UIComponent editorForm,
Parameter parameter)
throws SchemaException {
UIInput menu = findInputComponent(context,editorForm);
UIInput text = getOtherComponent().findInputComponent(context,editorForm);
String sMenuValue = getInputValue(menu);
String sTextValue = Val.chkStr(getInputValue(text));
text.setValue(sTextValue);
if (sMenuValue.equalsIgnoreCase(getOtherCodeKey())) {
parameter.getContent().getSingleValue().setValue(sTextValue);
if (text instanceof HtmlInputText) {
((HtmlInputText)text).setStyle("visibility:visible;");
}
} else {
parameter.getContent().getSingleValue().setValue(sMenuValue);
if (text instanceof HtmlInputText) {
((HtmlInputText)text).setStyle("visibility:hidden;");
}
}
}
开发者ID:GeoinformationSystems,项目名称:GeoprocessingAppstore,代码行数:34,代码来源:InputSelectWithOther.java
示例11: testWithoutPassThroughAttribute
import javax.faces.component.html.HtmlInputText; //导入依赖的package包/类
public void testWithoutPassThroughAttribute() throws Exception
{
_responseWriter.startDocument();
HtmlInputText inputText = new HtmlInputText();
_responseWriter.startElement("div", inputText);
_responseWriter.startElement("div", null);
_responseWriter.startElement("input", null);
_responseWriter.writeAttribute("name", "test", null);
_responseWriter.endElement("input");
_responseWriter.endElement("div");
_responseWriter.endElement("div");
_responseWriter.endDocument();
Assert.assertEquals("<?xml version='1.0' encoding='UTF-8'?>\n" +
"<partial-response id=\"j_id1\"><div><div><input name=\"test\"/></div></div></partial-response>", _stringWriter.toString());
}
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:16,代码来源:XmlResponseWriterTest.java
示例12: testWithoutPassThroughAttribute
import javax.faces.component.html.HtmlInputText; //导入依赖的package包/类
public void testWithoutPassThroughAttribute() throws Exception
{
_responseWriter.startDocument();
HtmlInputText inputText = new HtmlInputText();
_responseWriter.startElement("div", inputText);
_responseWriter.startElement("div", null);
_responseWriter.startElement("input", null);
_responseWriter.writeAttribute("name", "test", null);
_responseWriter.endElement("input");
_responseWriter.endElement("div");
_responseWriter.endElement("div");
_responseWriter.endDocument();
Assert.assertEquals("<div><div><input name=\"test\"></div></div>", _stringWriter.toString());
}
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:15,代码来源:HtmlResponseWriterTest.java
示例13: testSimplePassThroughAttribute
import javax.faces.component.html.HtmlInputText; //导入依赖的package包/类
public void testSimplePassThroughAttribute() throws Exception
{
_responseWriter.startDocument();
HtmlInputText inputText = new HtmlInputText();
inputText.getPassThroughAttributes().put("data-test", "test");
_responseWriter.startElement("div", inputText);
_responseWriter.startElement("div", null);
_responseWriter.startElement("input", null);
_responseWriter.writeAttribute("name", "test", null);
_responseWriter.endElement("input");
_responseWriter.endElement("div");
_responseWriter.endElement("div");
_responseWriter.endDocument();
Assert.assertEquals("<div data-test=\"test\"><div><input name=\"test\"></div></div>", _stringWriter.toString());
}
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:16,代码来源:HtmlResponseWriterTest.java
示例14: testRendererLocalNamePassThroughAttribute
import javax.faces.component.html.HtmlInputText; //导入依赖的package包/类
public void testRendererLocalNamePassThroughAttribute() throws Exception
{
_responseWriter.startDocument();
HtmlInputText inputText = new HtmlInputText();
inputText.getPassThroughAttributes().put(Renderer.PASSTHROUGH_RENDERER_LOCALNAME_KEY, "test");
_responseWriter.startElement("div", inputText);
_responseWriter.startElement("div", null);
_responseWriter.startElement("input", null);
_responseWriter.writeAttribute("name", "test", null);
_responseWriter.endElement("input");
_responseWriter.endElement("div");
_responseWriter.endElement("div");
_responseWriter.endDocument();
Assert.assertEquals("<test><div><input name=\"test\"></div></test>", _stringWriter.toString());
}
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:16,代码来源:HtmlResponseWriterTest.java
示例15: validarForm
import javax.faces.component.html.HtmlInputText; //导入依赖的package包/类
public boolean validarForm(HtmlInputText inputText,Object d){
if(!d.toString().isEmpty())
{
inputText.setStyle("border:1px #ddd solid");
return true;
}
else
{
inputText.setStyle("border-color:red");
return false;
}
}
开发者ID:JIGAsoftSTP,项目名称:NICON,代码行数:13,代码来源:EmpresaBean.java
示例16: validateAlphaSpace
import javax.faces.component.html.HtmlInputText; //导入依赖的package包/类
/**
* Validates that the passed field only contains alphabetic characters and spaces
* @param context
* @param component
* @param value
* @throws ValidatorException
*/
public void validateAlphaSpace(FacesContext context, UIComponent component, Object value) throws ValidatorException {
String valueString = (String) value;
if (!valueString.matches("[a-zA-Z ]+")) {
HtmlInputText htmlInputText = (HtmlInputText) component;
FacesMessage facesMessage = new FacesMessage(htmlInputText.getLabel() + ": only alphabetic and space characters are allowed.");
throw new ValidatorException(facesMessage);
}
}
开发者ID:CCSU-CS416F16,项目名称:CS416F16CourseInfo,代码行数:16,代码来源:ValidationUtils.java
示例17: validateState
import javax.faces.component.html.HtmlInputText; //导入依赖的package包/类
public void validateState(FacesContext context, UIComponent component, Object value) throws ValidatorException {
String valueString = (String) value;
if (!states.contains(valueString)) {
HtmlInputText htmlInputText = (HtmlInputText) component;
FacesMessage facesMessage = new FacesMessage(htmlInputText.getLabel() + ": Not state abbreviation");
throw new ValidatorException(facesMessage);
}
}
开发者ID:CCSU-CS416F16,项目名称:CS416F16CourseInfo,代码行数:10,代码来源:ValidationUtils.java
示例18: validateZipCode
import javax.faces.component.html.HtmlInputText; //导入依赖的package包/类
public void validateZipCode(FacesContext context, UIComponent component, Object value) throws ValidatorException {
String valueString = (String) value;
if (!zipCodes.contains(valueString)) {
HtmlInputText htmlInputText = (HtmlInputText) component;
FacesMessage facesMessage = new FacesMessage(htmlInputText.getLabel() + ": Not one of the allowed zip codes");
throw new ValidatorException(facesMessage);
}
}
开发者ID:CCSU-CS416F16,项目名称:CS416F16CourseInfo,代码行数:10,代码来源:ValidationUtilsSoln.java
示例19: validate
import javax.faces.component.html.HtmlInputText; //导入依赖的package包/类
@Override
public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
String emailAddress = (String)value;
HtmlInputText htmlInputText = (HtmlInputText)component;
if (!emailAddress.matches("[A-Za-z0-9][email protected][A-Za-z0-9]+.[A-Za-z0-9]+")){
FacesMessage facesMessage = new FacesMessage(htmlInputText.getLabel()+": email format is not valid");
throw new ValidatorException(facesMessage);
}
}
开发者ID:CCSU-CS416F16,项目名称:CS416F16CourseInfo,代码行数:10,代码来源:EmailValidator.java
示例20: getAsObject
import javax.faces.component.html.HtmlInputText; //导入依赖的package包/类
@Override
public Object getAsObject(FacesContext context, UIComponent cmp, String value) {
if (value != null && cmp instanceof HtmlInputText) {
// trim the entered value in a HtmlInputText before doing
// validation/updating the model
return value.trim();
}
return value;
}
开发者ID:awizen,项目名称:gangehi,代码行数:12,代码来源:StringTrimConverter.java
注:本文中的javax.faces.component.html.HtmlInputText类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论