jsf编写web编写软件有哪些程,刚开始<h:inputText>标签都可以读取到值,可是今天突然间都读取不到值了。

JSF - h:inputText
JSF - h:inputText
Advertisements
The h:inputText tag renders an HTML input element of the type "text".
&h:inputText value="Hello World!" /&
Rendered Output
&input type="text" name="j_idt6:j_idt8" value="Hello World!" /&
Tag Attributes
Attribute & Description
Identifier for a component
Reference to the component that can be used in a backing bean
A false suppresses rendering
styleClass
Cascading stylesheet (CSS) class name
A component&s value, typically a value binding
valueChangeListener
A method binding to a method that responds to value changes
Converter class name
Class name of a validator that&s created and attached to a component
A if true, requires a value to be entered in the associated field
A key, typically combined with a system-defined metakey, that gives focus to an element
Comma-separated list of content types for a form
accept-charset
Comma- or space-separated list of character encodings for a form. The accept-charset attribute is specified with the JSF HTML attribute named acceptcharset.
Alternative text for nontextual elements such as images or applets
Pixel value for an element&s border width
Character encoding for a linked resource
Coordinates for an element whose shape is a rectangle, circle, or polygon
Direction for text. Valid values are ltr (left to right) and rtl (right to left).
Disabled state of an input element or button
Base language of a resource specified with the href hreflang may only be used with href.
Base language of an element&s attributes and text
Maximum number of characters for text fields
Read-only sta text can be selected in a readonly field but not edited
Inline style information
Numerical value specifying a tab index
The name of a frame in which a document is opened
A title, used for accessibility, that describes an element. Visual browsers typically create tooltips for the title&s value
T for example, stylesheet
Width of an element
Element loses focus
Element&s value changes
Mouse button is clicked over the element
ondblclick
Mouse button is double-clicked over the element
Element receives focus
Key is pressed
onkeypress
Key is pressed and subsequently released
Key is released
onmousedown
Mouse button is pressed over the element
onmousemove
Mouse moves over the element
onmouseout
Mouse leaves the element&s area
onmouseover
Mouse moves onto an element
Mouse button is released
Form is reset
Text is selected in an input field
Process validation early in the life cycle
Example Application
Let us create a test JSF application to test the above tag.
StepDescription
1Create a project with a name helloworld under a package com.tutorialspoint.test as explained in the JSF - First Application chapter.
2Modify home.xhtml as explained below. Keep rest of the files unchanged.
3Compile and run the application to make sure business logic is working as per the requirements.
4Finally, build the application in the form of war file and deploy it in Apache Tomcat Webserver.
5Launch your web application using appropriate URL as explained below in the last step.
home.xhtml
&!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&
&html xmlns="http://www.w3.org/1999/xhtml"&
&title&JSF Tutorial!&/title&
&h2&h:inputText example&/h2&
&h3&Read-Only input text box&/h3&
&h:inputText value="Hello World!" readonly="true"/&
&h3&Read-Only input text box&/h3&
&h:inputText value="Hello World"/&
Once you are ready with all the changes done, let us compile and run the application as we did in JSF - First Application chapter. If everything is fine with your application, this will produce following result:
jsf_basic_tags.htm
Mobile First
Extra Links
Contact Us
Address: 388-A , Road no 22, Jubilee Hills, Hyderabad Telangana, INDIA-500033
& Copyright 2015. All Rights Reserved.今天看啥 热点:
在使用JSF技术的项目当中,我们经常要获得页面传来的值。传统的获取值的方法如下:Mapparams=FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();StringorgId=(String)params.get("orgId");但是,对于&h:selectOneMenu/&下拉列表框和&h:selectBooleanCheckBox/&复选框等,我们可以给这些标签加上监听事件,只要在该标签上有任何的操作在后台代码中都能获得标签的值。其中,我在实际项目开发过程中遇到了一个问题,最后才发现小小的区别。在使用复选框标签&h:selectBooleanCheckBox/&标签时,我们也可以通过事件监听的方式获得该复选框的值。如下代码:publicvoidvalueOfCheckBoxChange(ValueChangeEventevent){HtmlSelectBooleanCheckboxcheckbox=(HtmlSelectBooleanCheckbox)event.getComponent();booleancheckboxValue=(Boolean)checkbox.getValue();if(checkboxValue==true){Stringvalue=event.getOldValue().toString();}}该代码中,checkbox是获得的复选框对象。checkboxValue的值是判断该复选框是否选中,如果选中则为true,否则为false。其中,对象event有两个常用的方法,在别的地方event.getNewValue()方法表示标签被操作后的值。但是,在针对复选框时,event.getNewValue()方法获得的值表示该复选框是否被选中,即为true或false。如果你想去的该复选框的value值,则你的使用event.getOldValue()方法。在这里这两个方法的使用好似和其他地方有点区别。在这里只是给大家提个醒,在以后用到得时候就不会浪费更多的时间了。
暂无相关文章
相关搜索:
相关阅读:
相关频道:
&&&&&&&&&&&&&&&&
WEB编程教程最近更新汇聚2000万达人的兴趣社区下载即送20张免费照片冲印
扫码下载App
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!&&|&&
LOFTER精选
网易考拉推荐
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
阅读(2460)|
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
历史上的今天
在LOFTER的更多文章
loftPermalink:'',
id:'fks_086074',
blogTitle:'jsf1.2中--requiredMessage',
blogAbstract:'&&&& & 昨天在做一个关于国际化的web sample时,遇到一些问题,经努力得到解决。
&&&&&&& 开发工具:Netbeans 6.0。
&&&&&&& 服务器:GF v2 b53c(基本完全支持jsf1.2).说到服务器,这里说一下,tomcat 6.x不是完全支持jsf1.2的,据我所知,它支持的是jsp2.1和servlet 2.5,并不支持jstl1.2.故像&&&&&&
&&c:forEach items=\"#{BooksBean.books}\" var=\"book\"&&&&&&&&&&&&&&&&',
blogTag:'',
blogUrl:'blog/static/',
isPublished:1,
istop:false,
modifyTime:0,
publishTime:6,
permalink:'blog/static/',
commentCount:5,
mainCommentCount:3,
recommendCount:0,
bsrk:-100,
publisherId:0,
recomBlogHome:false,
currentRecomBlog:false,
attachmentsFileIds:[],
groupInfo:{},
friendstatus:'none',
followstatus:'unFollow',
pubSucc:'',
visitorProvince:'',
visitorCity:'',
visitorNewUser:false,
postAddInfo:{},
mset:'000',
remindgoodnightblog:false,
isBlackVisitor:false,
isShowYodaoAd:true,
hostIntro:'',
hmcon:'1',
selfRecomBlogCount:'0',
lofter_single:''
{list a as x}
{if x.moveFrom=='wap'}
{elseif x.moveFrom=='iphone'}
{elseif x.moveFrom=='android'}
{elseif x.moveFrom=='mobile'}
${a.selfIntro|escape}{if great260}${suplement}{/if}
{list a as x}
推荐过这篇日志的人:
{list a as x}
{if !!b&&b.length>0}
他们还推荐了:
{list b as y}
转载记录:
{list d as x}
{list a as x}
{list a as x}
{list a as x}
{list a as x}
{if x_index>4}{break}{/if}
${fn2(x.publishTime,'yyyy-MM-dd HH:mm:ss')}
{list a as x}
{if !!(blogDetail.preBlogPermalink)}
{if !!(blogDetail.nextBlogPermalink)}
{list a as x}
{if defined('newslist')&&newslist.length>0}
{list newslist as x}
{if x_index>7}{break}{/if}
{list a as x}
{var first_option =}
{list x.voteDetailList as voteToOption}
{if voteToOption==1}
{if first_option==false},{/if}&&“${b[voteToOption_index]}”&&
{if (x.role!="-1") },“我是${c[x.role]}”&&{/if}
&&&&&&&&${fn1(x.voteTime)}
{if x.userName==''}{/if}
网易公司版权所有&&
{list x.l as y}
{if defined('wl')}
{list wl as x}{/list}

我要回帖

更多关于 webservice java 的文章

 

随机推荐