英语翻译Adding the view and form tagsAll JavaServer Faces pages are represented by a tree of components,called a view.The view tag represents the root of the view.All JavaServer Faces component tags must be insie of a view tag,which is defined in
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/27 07:25:10
英语翻译Adding the view and form tagsAll JavaServer Faces pages are represented by a tree of components,called a view.The view tag represents the root of the view.All JavaServer Faces component tags must be insie of a view tag,which is defined in
英语翻译
Adding the view and form tags
All JavaServer Faces pages are represented by a tree of components,called a view.The view tag represents the root of the view.All JavaServer Faces component tags must be insie of a view tag,which is defined in the core tag library.
The form tag represents an input form component,which allows the user to input some data and submit it to the server,usually by clicking a button.All UI component tags the represent editable components(such as text fields and menus) must be nested in side the form tag.In the case of the greeting.Jsp page,some of the tags contained in the form are outputText,inputext,commandButton ,and message .You can specify an ID for the form tag.This ID maps to the associated form UI component on the server.
With the view and form tags added,our page looks like this (minus the HTML and HEAD tags):
… …
Adding a Label component
The outputText tag represents a label.the greting.Jsp page has two outputText tags.One of the tags displays the number0.The other tag displays the number 10:
… …
The value attributes of the tags get the values from the minimum and maximum properties of UserNumberBean using value expressions,which are used to reference data stored in other objects,such as beans.See”Backing Beans” on page 309 for more information on value expressions.
With the addition of the outputText tags(along with some static text),the greeting page looks like the following:
… …
Adding an Image
To display images on page,you use the graphicImage tag.The urlattribute of the tag specifies the path to the image file.Let’s add Duke to the page using a graphicImage tag:
… …
Adding a TextField
The imputText tag represents a text field component.In the guessNumber example,this text field takes an integer input value.The instance of this tag included in greeting.Jsp has three attributes:id,laber,and value
… …
The id attribute corresponds to the ID of the component object represented by this tag.In this case,an id attribute is required because the message tag(which is used to display validation error messages) needs it to refer to the user No component.
The label attribute specifies the name to be used by error messages to refer to the component.In this example,label is set to User Number.As an example,if a user were to enter 23,the error message that would be displayed is :
User Number:Validation Error:Value is greater than allowable maximum of 10.
The value attribute binds the userNo component value to the bean property UserNumberBean.userNumber,which holds the data entered into the text field..
After adding the imputText tag,the greeting page looks like the following:
英语翻译Adding the view and form tagsAll JavaServer Faces pages are represented by a tree of components,called a view.The view tag represents the root of the view.All JavaServer Faces component tags must be insie of a view tag,which is defined in
加入这项意见,并形成标签
所有JavaServer界面的网页是由一树的组成部分,所谓的看法.观点标签代表的根本的看法.所有JavaServer界面组件标签必须insie一期标签,它的定义是在核心标签库.
该表单标签代表着一种投入的形式组成,这使用户能够输入一些数据,并提交给服务器,通常是通过点击button.all的UI组件标签的代表可编辑组件(如文本字段和菜单) ,必须在嵌套方形式tag.in至于greeting.jsp页,其中一些标签载于表格outputtext ,inputext ,commandbutton ,和讯息.你可以指定一个ID为形式tag.this身份证地图向美联社形式的UI组件放在服务器上.
这一观点,并形成标签补充说,我们可以看到这样的(减去HTML和头部标签) :
… …
加入一个标签组件
该outputtext标签代表了label.the greting.jsp页有两个outputtext tags.one的标签显示number0.the其他标签显示号码10 :
… …
价值属性的标签获得价值,从最低和最高性能的usernumberbean利用价值的表述中,哪些是用来参考的数据储存在其他物体,如beans.see "后盾豆" ,对309页的更多信息,价值表情.
与增补的outputtext标签(加上一些静态文本) ,贺页看起来象如下:
… …
加入图像
显示图像时,你可以使用graphicimage tag.the urlattribute的标签指明的道路,以形象file.let奇摩放入杜克至该页面使用graphicimage标签:
… …
添加文本
该imputtext标签代表一个文本场component.in该guessnumber举例说,此文本字段需要一个整型输入值的实例此标签列入greeting.jsp有三个特质:身份证,laber和价值
… …
身份证属性对应的ID的组件对象为代表的这tag.in这种情况下,一个身分属性,是因为所需的信息标签(这是用来显示验证错误信息)的需要,它是指用户没有其它的组件.
标签属性指定的名字被人利用的错误讯息转介给元件.在这个例子中,标签,是一套以用户number.as为例,如果用户要进入23条的规定,错误信息将被显示的是:
用户号码:确认错误:价值大于所允许的最多10个.
价值属性的结症userno组成价值向bean属性usernumberbean.usernumber ,掌握数据进入文本字段..
而在加入imputtext标签,迎接页看起来象如下: