ZK:zul从输入表单数据获取值 [英] ZK: zul get value from input form-data

查看:126
本文介绍了ZK:zul从输入表单数据获取值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要有关ZK框架的帮助.这就是我的情况.

I need a help about ZK framework. This is my situation.

我有一个html页面:

I have a html page:

<form id="frm1" action="http://localhost:8080/spuWebApp" METHOD="POST">
    <input type="hidden" id="codigoUnicoCliente" name="codigoUnicoCliente"  value="00000050055255">     
    <input type="button" onclick="myFunction()" value="Invar Spu POST URL">
</form>

然后,在提交表单后,我的zk项目在bridge.zul中接收数据.

Then, after submitting the form, my zk project recieves the data in bridge.zul.

<?init class="com.ibm.ibk.spu.view.BridgeChecker"?>

此类包含以下内容

public class BridgeChecker extends BaseWindow implements Initiator{


@Override
public void doInit(Page arg0, Map<String, Object> arg1) throws Exception {
    Bridge bridge = new Bridge();
    logger.debug("ANTIGUA MANERA");
    logger.debug(Executions.getCurrent().getParameterMap());
    logger.debug(Executions.getCurrent().getArg());
    logger.debug(Executions.getCurrent().getAttributes());

    bridge.setClienteCodigoUnicoFromURL(Executions.getCurrent().getParameter("codigoUnicoCliente"));

但是我无法读取该值.

我经常动脑筋.但是我无法成功地找到如何读取值的方法.可以帮助我阅读表单数据的人.非常感谢.

I am racking my brain a lot. But I couldnt succeed in find out how to read the values. Someone who can help me to read the form-data. I'd appreciate it a lot.

非常感谢.

推荐答案

它可与Executions.getCurrent().getParameter("codigoUnicoCliente")一起使用,但我不知道 myFunction()的作用,所以我将其替换为以下代码:

it work with Executions.getCurrent().getParameter("codigoUnicoCliente") but I do not know what myFunction() do, so I replace it with this code:

<form id="frm1" action="test.zul" METHOD="POST">
    <input type="hidden" id="codigoUnicoCliente" name="codigoUnicoCliente"  value="00000050055255">     
    <input type="submit" value="Invar Spu POST URL"> 
</form>

然后,我在 test.zul

<window apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('test.vm.TestViewModel')">

,然后在 TestViewModel

@Init
public void init(@ContextParam(ContextType.SESSION) Session session) {
   System.out.println(Executions.getCurrent().getParameter("codigoUnicoCliente"));
}

像魅力一样工作:)

这篇关于ZK:zul从输入表单数据获取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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