在Struts1.3中,从Jsp页面到Java中的操作 [英] In Struts1.3, From Jsp page to action in Java

查看:68
本文介绍了在Struts1.3中,从Jsp页面到Java中的操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Jsp的新手,并且我的工作应用程序基于Struts1.3.我有一个Jsp页面,该页面显示基于providerId的记录,可能是记录应该是一个还是多个,这取决于记录的存在. 我的Jsp页面代码是:

I am new to Jsp, and My working application is based on Struts1.3. I have a Jsp page which display the records basis on the providedId, may be record should be one or more than one it depends on the existence of records. My Jsp page code is:

<html:form method="post" action="properties.do" styleId="propertyform">
  <logic:iterate id="JobsForm" name="<%=Constant.JOBFORMLISTSECOND%>">
    <tr>
      <td>
        <html:text property="asfrom" name="JobsForm" styleClass="fieldbox2" styleId="textfield50"/>
      </td>

      <td>
        <html:select property="withauthority" name="JobsForm">
          <html:option value="0">Select</html:option>
          <html:options collection="<%=Constant.INSTALLEDBY%>" property="value" labelProperty="label"/>
        </html:select>
      </td>
    </tr>
  </logic:iterate>

  <table>
    <tr>
      <td>
        <img onclick="submitPropertyForm(),update()" src="images/new.jpg" />
      </td>
    </tr>
  </table>
</html:form>

而且,我需要的是,在单击按钮后,我需要给定属性的所有值,但我无法做到这一点,我在动作中只得到了所有属性的一个值.

And, What i need, after clicking on the button I need all the values of given properties but I am unable to do this, I got only one value of all properties in my action my action is like.

JobsForm jobsForm = (JobsForm) form;
System.out.println("asFrom:::" + jobsForm.getAsfrom());
System.out.println("withAuth:::" + jobsForm.getWithauthority());  

您可以指导我如何执行此操作.或者我必须做什么?获取所有属性的所有值.

Can you guide me how to do this.Or What i have to do? for getting all the values of all properties.

非常感谢,

推荐答案

您要基本上,您需要提供类似asfrom[n]的名称,其中n是循环索引.

Basically, you need to provide names like asfrom[n] where n is your loop index.

Struts 确实提供索引标签,尽管文档列出了一些您可能只想使用JSTL的原因.那只是取决于您的需求.

Struts does provide indexed tags, although the documentation lists some reasons you might just want to use JSTL. That just depends on your needs.

请注意,格式化代码时请多加注意,以确保您自己和他人的利益.适当的缩进和空格使用使结构和意图 far 易于沟通,这是一种判断是否有人在乎他们的代码的方法.我还删除了一些不必要的JSP来描述问题.

On a side note, please take care when formatting your code, both for your benefit, and that of others. Proper indentation and whitespace usage make structure and intent far easier to communicate, and it's one way to tell if someone cares about their code. I also removed some JSP not necessary to describe the problem.

这篇关于在Struts1.3中,从Jsp页面到Java中的操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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