当前位置: 首页 > news >正文

企业网站建设计什么科目做网站然后卖

企业网站建设计什么科目,做网站然后卖,中山网页网站设计模板,网站原型图设计软件jsf标签每个JSF开发人员都知道ui#xff1a;include和ui#xff1a;param标签。 您可以包括一个facelet#xff08;XHTML文件#xff09;并传递一个对象#xff0c;该对象将在包含的facelet中可用#xff0c;如下所示#xff1a; ui:include src/sections/co… jsf标签 每个JSF开发人员都知道uiinclude和uiparam标签。 您可以包括一个faceletXHTML文件并传递一个对象该对象将在包含的facelet中可用如下所示 ui:include src/sections/columns.xhtmlui:param namecolumns value#{bean.columns}/ /ui:include 因此您可以在带有dynamich列的PrimeFaces DataTable中使用它pcolumns p:dataTable value#{bean.entries} vardata rowKey#{data.id} ......ui:include src/sections/columns.xhtmlui:param namedata value#{data}/ui:param namecolumns value#{bean.columns}//ui:include/p:dataTable 其中包含的facelet可能包含此代码 ui:composition xmlnshttp://www.w3.org/1999/xhtmlxmlns:phttp://primefaces.org/uixmlns:uihttp://java.sun.com/jsf/facelets...p:columns value#{columns} varcolumnf:facet nameheaderh:outputText value#{msgs[column.header]}//f:facet// place some input / select or complex composite component for multiple data types here.// a simple example for demonstration purpose:p:inputText value#{data[column.property]}//p:columns /ui:composition {bean.columns}是指描述这些列的特殊对象的列表。 我将此类对象命名为ColumnModel。 所以这是一个 列出ColumnModel。 ColumnModel具有例如属性标头和属性。 继续。 现在如果要添加对排序/过滤的支持我们可以使用动态路径这些路径引用包含排序或/和过滤功能的特定facelet文件。 简单地将src属性绑定到bean属性。 ui:include src#{bean.columnsIncludeSrc}ui:param namedata value#{data}/ui:param namecolumns value#{bean.columns}/ /ui:include 豆有类似的东西 private boolean isFilterRight; private boolean isSortRight// setter / getterpublic String getColumnsIncludeSrc() {if (isFilterRight isSortRight) {return /include/columnsTableFilterSort.xhtml;} else if (isFilterRight !isSortRight) {return /include/columnsTableFilter.xhtml;} else if (!isFilterRight isSortRight) {return /include/columnsTableSort.xhtml;} else {return /include/columnsTable.xhtml;} } 根据所设置的布尔权限包含了不同的方面。 因此将要包含的文件的决定放在Bean中。 为了更加灵活我们可以将表封装在一个复合组件中并将决策逻辑移至组件类。 cc:interface componentTypexxx.component.DataTablecc:attribute nameid requiredfalse typejava.lang.StringshortDescriptionUnique identifier of the component in a NamingContainer/cc:attribute nameentries requiredtrueshortDescriptionThe data which are shown in the datatable. This is a list of object representing one row./cc:attribute namecolumns requiredtrue typejava.util.ListshortDescriptionThe columns which are shown in the datatable. This is a list of instances of type ColumnModel./... /cc:interface cc:implementationp:dataTable value#{cc.attrs.entries} vardata rowKey#{data.id} ......ui:include src#{cc.columnsIncludeSrc}ui:param namedata value#{data}/ui:param namecolumns value#{cc.attrs.columns}//ui:include/p:dataTable /cc:implementation uiinclude如何工作 这是在构建视图时应用的标记处理程序。 在JSF 2中组件树根据POST请求构建两次一次在RESTORE_VIEW阶段一次在RENDER_RESPONSE阶段。 在GET上它在RENDER_RESPONSE阶段构建一次。 此行为在JSF 2规范中指定并且在Mojarra和MyFaces中相同。 如果页面作者使用条件包含或条件模板则必须在RENDER_RESPONSE中构建视图。 因此您可以确保uiinclude的src属性在渲染阶段之前不久就得到了评估。 但是到了重点 到目前为止我写的内容只是介绍了扩展uiinclude的动机。 最近我有一项任务要使用带有动态列的apdataTable和prowEditor。 在PrimeFaces展示柜中就是这样的 。 问题只是–这种编辑功能不支持pcolumns。 我的想法是动态地添加pcolumn标记多次但是具有不同的上下文参数。 您可以将其想象为uiinclude和uiparam在循环中。 在上面的示例中我们打算遍历List ColumnModel。 每次循环迭代都应在所包含的facelet中使ColumnModel类型的实例可用。 因此我编写了一个自定义标签处理程序以多次包含任何facelet。 package xxx.taghandler;import xxx.util.VariableMapperWrapper; import java.io.IOException; import java.util.List; import java.util.UUID; import javax.el.ExpressionFactory; import javax.el.ValueExpression; import javax.el.VariableMapper; import javax.faces.component.UIComponent; import javax.faces.view.facelets.FaceletContext; import javax.faces.view.facelets.TagAttribute; import javax.faces.view.facelets.TagAttributeException; import javax.faces.view.facelets.TagConfig; import javax.faces.view.facelets.TagHandler;/*** Tag handler to include a facelet multiple times with different contextes (objects from value).* The attribute value can be either of type java.util.List or array.* If the value is null, the tag handler works as a standard ui:include.*/ public class InlcudesTagHandler extends TagHandler {private final TagAttribute src;private final TagAttribute value;private final TagAttribute name;public InlcudesTagHandler(TagConfig config) {super(config);this.src this.getRequiredAttribute(src);this.value this.getAttribute(value);this.name this.getAttribute(name);}Overridepublic void apply(FaceletContext ctx, UIComponent parent) throws IOException {String path this.src.getValue(ctx);if ((path null) || (path.length() 0)) {return;}// wrap the original mapper - this is important when some objects passed into include via ui:param// because ui:param invokes setVariable(...) on the set variable mappper instanceVariableMapper origVarMapper ctx.getVariableMapper();ctx.setVariableMapper(new VariableMapperWrapper(origVarMapper));try {this.nextHandler.apply(ctx, null);ValueExpression ve (this.value ! null) ? this.value.getValueExpression(ctx, Object.class) : null;Object objValue (ve ! null) ? ve.getValue(ctx) : null;if (objValue null) {// include facelet only oncectx.includeFacelet(parent, path);} else {int size 0;if (objValue instanceof List) {size ((List) objValue).size();} else if (objValue.getClass().isArray()) {size ((Object[]) objValue).length;}final ExpressionFactory exprFactory ctx.getFacesContext().getApplication().getExpressionFactory();final String strName this.name.getValue(ctx);// generate unique Id as a valid Java identifier and use it as variable for the provided value expressionfinal String uniqueId a UUID.randomUUID().toString().replaceAll(-, );ctx.getVariableMapper().setVariable(uniqueId, ve);// include facelet multiple timesStringBuilder sb new StringBuilder();for (int i 0; i size; i) {if ((strName ! null) (strName.length() ! 0)) {// create a new value expression in the array notation and bind it to the variable namesb.append(#{);sb.append(uniqueId);sb.append([);sb.append(i);sb.append(]});ctx.getVariableMapper().setVariable(strName,exprFactory.createValueExpression(ctx, sb.toString(), Object.class));}// included facelet can access the created above value expressionctx.includeFacelet(parent, path);// reset for next iterationsb.setLength(0);}}} catch (IOException e) {throw new TagAttributeException(this.tag, this.src, Invalid path : path);} finally {// restore original mapperctx.setVariableMapper(origVarMapper);}} } 最重要的调用是ctx.includeFaceletparentpath。 JSF API中的 includeFacelet...方法在相对于当前标记的某个路径上包含了facelet标记。 类VariableMapperWrapper用于通过uiparam从名称到值的映射。 对于带有列的示例在每次调用includeFacelet...之前变量列还将映射到表达式{columns [0]}{columns [1]}等。 好吧不完全是这些表达式在列的位置应该是一个唯一的名称该名称再次映射到columns对象以避免可能的名称冲突。 映射器类如下所示 package xxx.util;import java.util.HashMap; import java.util.Map; import javax.el.ELException; import javax.el.ValueExpression; import javax.el.VariableMapper;/*** Utility class for wrapping a VariableMapper. Modifications occur to the internal Map instance.* The resolving occurs first against the internal Map instance and then against the wrapped VariableMapper* if the Map doesnt contain the requested ValueExpression.*/ public class VariableMapperWrapper extends VariableMapper {private final VariableMapper wrapped;private MapString, ValueExpression vars;public VariableMapperWrapper(VariableMapper orig) {super();this.wrapped orig;}Overridepublic ValueExpression resolveVariable(String variable) {ValueExpression ve null;try {if (this.vars ! null) {// try to resolve against the internal mapve this.vars.get(variable);}if (ve null) {// look in the wrapped variable mapperreturn this.wrapped.resolveVariable(variable);}return ve;} catch (Throwable e) {throw new ELException(Could not resolve variable: variable, e);}}Overridepublic ValueExpression setVariable(String variable, ValueExpression expression) {if (this.vars null) {this.vars new HashMapString, ValueExpression();}return this.vars.put(variable, expression);} } 在taglib XML文件中注册标签处理程序您就可以完成。 tagtag-nameincludes/tag-namehandler-classxxx.taghandler.InlcudesTagHandler/handler-classattributedescription![CDATA[The relative path to a XHTML file to be include one or multiple times.]]/descriptionnamesrc/namerequiredtrue/requiredtypejava.lang.String/type/attributeattributedescription![CDATA[Objects which should be available in the included XHTML files. This attribute can be eitherof type java.util.List or array. If it is null, the tag handler works as a standard ui:include.]]/descriptionnamevalue/namerequiredfalse/requiredtypejava.lang.Object/type/attributeattributedescription![CDATA[The name of the parameter which points to an object of each iteration over the given value.]]/descriptionnamename/namerequiredfalse/requiredtypejava.lang.String/type/attribute /tag 现在我可以在复合组件中使用它了 p:dataTable value#{cc.attrs.entries} vardata rowKey#{data.id} ......custom:includes src#{cc.columnsIncludeSrc} value#{cc.attrs.columns} namecolumnui:param namedata value#{data}//custom:includes /p:dataTable 一个典型的facelet文件和组件树包含一个非常规则的pcolumn标记这意味着我们能够使用DataTable的所有功能 ui:composition xmlnshttp://www.w3.org/1999/xhtmlxmlns:phttp://primefaces.org/uixmlns:uihttp://java.sun.com/jsf/facelets...p:column headerText#{msgs[column.header]}p:cellEditorf:facet nameoutputcustom:typedOutput outputType#{column.outputTypeName}typedData#{column.typedData}value#{data[column.property]}timeZone#{cc.timeZone}calendarPattern#{cc.calendarPattern} locale#{cc.locale}//f:facetf:facet nameinputcustom:typedInput inputType#{column.inputTypeName}typedData#{column.typedData}label#{column.inputTypeName}value#{data[column.property]}onchangehighlightEditedRow(this)timeZone#{cc.timeZone}calendarPattern#{cc.calendarPattern}locale#{cc.locale}//f:facet/p:cellEditor/p:column /ui:composition 注意 此方法可以应用于其他组件和用例。 InlcudesTagHandler可以正常运行。 例如我可以想象在没有基础MenuModel的情况下在PrimeFaces中创建动态Menu组件。 当然仍然需要某个模型类的列表或数组。 参考在我们的软件开发博客上 JCG合作伙伴 Oleg Varaksin的一个JSF标签包含了多个动态 。 翻译自: https://www.javacodegeeks.com/2013/06/multiple-dynamic-includes-with-one-jsf-tag.htmljsf标签
http://www.yutouwan.com/news/444881/

相关文章:

  • 视频网站怎么建网站建设费用算广告费吗
  • 昆明网站开发价格百度学术官网首页
  • 郑州区块链数字钱包网站开发周期建筑公司企业网站
  • 网站建设大神级公司千万别学服装设计
  • 电子商务公司网站建立前期准备桂林新闻桂林人论坛
  • dw做网站的导航栏怎么做软件开发者对要发布的软件进行数字签名
  • 怎么用本机做服务器发布网站旅游类网站建设教案
  • 自己做一个模版网站是怎么做的自己做网站的给微信取个什么名字好
  • 南京移动网站建设报价建设网站的公司
  • 什么叫网站域名广东手机网站建设报价
  • 可以注册邮箱的网站wordpress侧滑菜单
  • 宋庄网站建设wordpress目录主题
  • 深圳迈瑞医疗器械有限公司官网快速排名优化seo
  • 如何做网站服务器映射网络优化软件有哪些
  • 设计网站公司好评y湖南岚鸿ok有文化内涵又高雅的公司名字
  • 爱站关键词挖掘查询工具做网站类网站费用
  • 网站信息可以一键制作网站软件
  • dream网站怎么做框架商务网站建设的优势
  • 网站建设公司专业网站开发研发四川在线
  • 上海外贸建站北京的互联网企业
  • 建设论坛网站网站一键生成手机网站
  • 购物网站系统设计wordpress更改首页
  • 商用营销型网站建设抖音品牌推广方案
  • 广西网站建设推广网络服务机构
  • html网站开发 工具电商培训机构
  • 利用小说网站做本站优化个人免费域名注册网站
  • 做网站最便宜要多少钱做网页素材
  • 做seo怎么设计网站如何规划网站栏目
  • 网站资源整合与建设查询网站到期时间
  • 新乡网站建设报价网页代码查看