This tag is used to create the input text box in the page. The user can enter any text in this box. This is same as html input tag with type "text". This tag has additional feature of displaying value only, not the widget of the box. You can set the style definition and style class when this attribute is set to true. This component also has ability to be visible or not visible according to the role of the user. In the same way, it also has the ability to be enable or disable according to the user role. This component also has the capability to render the id for the component just the same as we have mentioned in the id attribute of the tag. Normally the naming system of JSF renders the id for the component with some additional text, typically with id of the form as prefix. But this component has an attribute forceId which forces the component to render the same id mentioned in the id attribute.
Code Description :
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<f:view>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>t:inputText example</title>
<style type="text/css">
<!--
body{
background-color:#fff2f2;
margin-top:30;
}
.inputstyle{
background-color:#99CCCC;
}
-->
</style>
</head>
<body >
<h:form>
<center>
<t:inputText id="it1" value="Enter number" rendered="true" required="false"
dir="ltr" style="color:#0033CC; font-weight:bold"
styleClass="inputstyle"
title="Enter the number of your choice."/></p>
<t:inputText id="it2" value="displaying value only" rendered="true"
required="false" dir="ltr"
style="color:#0033CC; font-weight:bold" styleClass="inputstyle"
title="This is input text box but displaying value only"
displayValueOnly="true"
displayValueOnlyStyle="font-style: italic;
color:#000000; background-color:#66CCFF;"/>|
</center>
</h:form>
</body>
</html>
</f:view>
Rendered Output :

Html Source Code :
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>t:inputText example</title>
<style type="text/css">
<!--
body{
background-color:#fff2f2;
margin-top:30;
}
.inputstyle{
background-color:#99CCCC;
}
-->
</style>
</head>
<body >
<form id="_idJsp0" name="_idJsp0" method="post"
action="/tomahawk_tags/pages/inputText.jsf"
enctype="application/x-www-form-urlencoded">
<center>
<input id="_idJsp0:it1" name="_idJsp0:it1" type="text"
value="Enter number" dir="ltr"
title="Enter the number of your choice." style="color:#0033CC;
font-weight:bold" class="inputstyle" /></p>
<span id="_idJsp0:it2" style="font-style: italic; color:#000000;
background-color:#66CCFF;" class="inputstyle" dir="ltr"
title="This is input text box but displaying value only">
displaying value only
</span>
</center>
<input type="hidden" name="_idJsp0_SUBMIT" value="1" />
<input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState"
value="rO0ABXVyABNbTGphdmEubGFuZy5PYmplY3Q7kM5YnxBzKWwCAAB4cAAAAANzcg
BHb3JnLmFwYWNoZS5teWZhY2VzLmFwcGxpY2F0aW9uLlRyZWVTdHJ1Y3R1cmVN
YW5hZ2VyJFRyZWVTdHJ1Y3RDb21wb25lbnRGWRfYnEr2zwIABFsACV9jaGlsZH
JlbnQASltMb3JnL2FwYWNoZS9teWZhY2VzL2FwcGxpY2F0aW9uL1RyZWVTdHJ1
Y3R1cmVNYW5hZ2VyJFRyZWVTdHJ1Y3RDb21wb25lbnQ7TAAPX2NvbXBvbmVudE
NsYXNzdAASTGphdmEvbGFuZy9TdHJpbmc7TAAMX2NvbXBvbmVudElkcQB+AARb
AAdfZmFjZXRzdAATW0xqYXZhL2xhbmcvT2JqZWN0O3hwdXIASltMb3JnLmFwYW
NoZS5teWZhY2VzLmFwcGxpY2F0aW9uLlRyZWVTdHJ1Y3R1cmVNYW5hZ2VyJFRy
ZWVTdHJ1Y3RDb21wb25lbnQ7uqwnyBGFkKoCAAB4cAAAAAFzcQB+AAJ1cQB+AA
cAAAACc3EAfgACcHQAM29yZy5hcGFjaGUubXlmYWNlcy5jb21wb25lbnQuaHRt
bC5leHQuSHRtbElucHV0VGV4dHQAA2l0MXBzcQB+AAJwcQB+AAx0AANpdDJwdA
AjamF2YXguZmFjZXMuY29tcG9uZW50Lmh0bWwuSHRtbEZvcm10AAdfaWRKc3Aw
cHQAIGphdmF4LmZhY2VzLmNvbXBvbmVudC5VSVZpZXdSb290cHB1cQB+AAAAAA
ADdXEAfgAAAAAABXVxAH4AAAAAAAdwcHBwcHBwc3IAEGphdmEudXRpbC5Mb2N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wcH
BwdAADbHRycHBwcHBwcHBwcHBwcHBwcHBwcHQAH2NvbG9yOiMwMDMzQ0M7IGZv
bnQtd2VpZ2h0OmJvbGR0AAppbnB1dHN0eWxlcHQAIEVudGVyIHRoZSBudW1iZX
Igb2YgeW91ciBjaG9pY2UucHBwcHBwcHB1cQB+AAAAAAADdXEAfgAAAAAAB3Vx
AH4AAAAAABt1cQB+AAAAAAAJdXEAfgAAAAAAA3VxAH4AAAAAAAdxAH4AD3EAfg
ApcQB+ADR0AAtfaWRKc3AwOml0MnNxAH4AJT9AAAAAAAAMdwgAAAAQAAAAAXEA
fgAncQB+ACl4cHBwdAAVZGlzcGxheWluZyB2YWx1ZSBvbmx5cHEAfgApcQB+AD
hwcQB+AClwcHBwcHEAfgA5cHBwcHBwcHBwcHBwcHBwcHBwcHEAfgA6cQB+ADtw
dAAwVGhpcyBpcyBpbnB1dCB0ZXh0IGJveCBidXQgZGlzcGxheWluZyB2YWx1ZS
Bvbmx5cHBxAH4AKXQAPGZvbnQtc3R5bGU6IGl0YWxpYzsgY29sb3I6IzAwMDAw
MDsgYmFja2dyb3VuZC1jb2xvcjojNjZDQ0ZGO3BwcHB4eHEAfgAb" />
</form>
<!-- MYFACES JAVASCRIPT -->
</body>
</html>
This tag contains attributes given below :
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Tomahawk inputText tag
Post your Comment