从动态创建的inputText中获取价值 [英] Getting value from dynamically created inputText

查看:144
本文介绍了从动态创建的inputText中获取价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我的abc.xhtml页面中的代码片段:

The following is my code snippet in my abc.xhtml page :

<p:panelGrid id="pnlGrd_numOfLbl"
  style="align:center; width:100%;" cellpadding="5">
<c:forEach var="i" begin="1" end="${specificationMB.numOfLbl}" >
<p:row>
    <p:column width="50%">
        <p:outputLabel value="Label ${i}" />
    </p:column>
    <p:column width="50%">
        <p:inputText id="inputTxt_${i}" style="width:150px;" />
    </p:column>
</p:row>
</c:forEach>
</panelGrid>

这是我的panelGrid我根据
numOfLable动态生成inputText。生成后说2将生成用户将为每个inputText添加一些
文本,所以我的问题是如何获得dyanamically
生成的输入框的值。

This is my panelGrid I am generating inputText dynamically depending numOfLable. After generation say 2 will be generate user will add some text to each inputText so my Question is How can I get value of dyanamically generated inputbox.

谢谢。

推荐答案

为了获取动态生成的inputTexts的值。你可能会这样做。

In order to get the values of your dynamically generated inputTexts. You may do something like this.

<input type="text" id="inputTxt_${i}" name="inputTxt_${i}" style="width:150px;" />

然后在servlet中使用此代码检索文本值

Then retrieve the text value by using this code in servlet

String inputText1 = request.getParameter("nameOfFirstInputText");

这篇关于从动态创建的inputText中获取价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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