从复合组件中获取支持组件中的呈现的html代码 [英] Get rendered html code in Backing Component from Composite Component

查看:70
本文介绍了从复合组件中获取支持组件中的呈现的html代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取已发布的表单数据在后台的后备组件中 processUpdates方法?

How can I get the posted form data in the backing component in the processUpdates method?

@Override
    public void processUpdates(FacesContext context) {
//get here rendered html code
}

还是可以通过decode方法获取已过帐的表单数据?

Or can I get the posted form data in the decode method?

: 我的目标是获取已发布的表单数据-不获取生成的html代码(对不起,我不是很准确)

: My goal is to get the posted form data - Not to get the generated html code (Sry I wasn't precisely)

推荐答案

目前尚不清楚您要达到什么目标.我的意思是,在高水平上.

It is unclear what you want to achive, yet. I mean, at high level.

UIComponent.decodeprocessUpdates是中等级别的生命周期API,当您要扩展该框架时,应将其覆盖.

UIComponent.decode and processUpdates are medium-level lifecycle APIs which should be overriden when you want to extend the framework.

如果您只需要使用框架,则需要一个托管bean ,而不是一个支持组件.

If you just need to use the framework, you need a managed bean, not a backing component.

此外,通常只有扩展UIInput的组件才需要在这些阶段中挂接,因为它们绑定到value="#{...}"值表达式(后者又引用了托管bean) (在大多数情况下),并且需要将这些值与绑定表达式进行同步.

Furthermore, generally only components that extend UIInput need to hook in those phases, because they are bound to a value="#{...}" value expression (which in turn refers to a managed bean, in most cases), and need to synchronize those values with the bound expression.

我怀疑您正在使您的生活变得毫无用处:如果您对框架的运行方式没有很好的了解,那么钩入中级或低级API确实是一件痛苦的事情.

I suspect you are uselessly complicating your life: hooking into medium or low-level APIs is a real pain if you don't have an excellent understanding about how the framework operates.

无论如何,输入组件中的标准请求参数 decode 是这样的:

Anyway, the standard request parameters decode into input component is this:

String clientId = this.getClientId(context);

Map<String, String> requestMap = context.getExternalContext().getRequestParameterMap();

String newValue = requestMap.get(clientId);
if (newValue != null) 
{
    this.setSubmittedValue(newValue);
}

请发布完整的xhtml facelet代码(不是合成代码,而是发布使用的合成代码),这样我就可以理解您要去的地方,并且可以尝试将您指向正确的工具来使用.

Please, post the full xhtml facelet code (not the composite one, but the facelet using that composite), so I can understand where you want to go and I can try to point you to the right tool to use.

这篇关于从复合组件中获取支持组件中的呈现的html代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆