English 中文(简体)
设置 strutts 2 中的 hashset 值
原标题:setting values for hashset in struts2

我在使用Struts2。 我在我的 Pojo 中有一个散列。 我正在尝试将值提交到 hashset 。 我无法改变我的收藏类型以列表 。

这里就是阿宝

Item{
Set<Person> personCollection;
long itemCode;

    public void setItemCode(long itemCode)
    {
        this.itemCode=itemCode;
    }
    public long getitemCode()
    {
        return itemCode;
    }
    public void setPersonCollection(Set<Person>personCollection)
    {
        this.personCollection=personCollection;
    }
    public Set<Person> getPersonCollection()
    {
        return personCollection;
    }
}

Person{
    String name;
    public void setName(String name)
    {
        this.name=name;
    }
    public String getName()
    {
        return name;
    }
}

行动和行动行动的行动

SubmitItem行动和行动行动的行动
{
     private Item item;
     public getItem()
     {
          return item;
     }
     public setItem(Item item)
     {
          this.item=item;
     }
     public String submitItem()
     {
           dao.submit(item);
     }
}

jjsp jsp jsp jsp jsp jsp jsp jsp jsp jsp jsp jsp jsp jsp jsp jsp jspp jsp jsp jspp jp jsp jspp jp jspp jp jspp jspp jspp jjspp jspp jspp jspp jp jsp jp jp jspp jspp jp jpp jp jp jsppp jp jsp jp jspp jp jp jsp jspp jspp jsp jp jsp jspp jsp jsp jp jpp jp jsp jp j jp jsp jsp j j jsp jsp jsp j j j jp jpppppp j j j j j j j j j j jppppppppppp jppppppp

  <s:text name=item.personCollection[0].name/>
  <s:text name=item.personCollection[1].name/>

so this doesnt work. When i submit my jjsp jsp jsp jsp jsp jsp jsp jsp jsp jsp jsp jsp jsp jsp jsp jsp jspp jsp jsp jspp jp jsp jspp jp jspp jp jspp jspp jspp jjspp jspp jspp jspp jp jsp jp jp jspp jspp jp jpp jp jp jsppp jp jsp jp jspp jp jp jsp jspp jspp jsp jp jsp jspp jsp jsp jp jpp jp jsp jp j jp jsp jsp j j jsp jsp jsp j j j jp jpppppp j j j j j j j j j j jppppppppppp jppppppp with above snippet it gives error, its not able to populate personCollection from Item.

So what should be naming convention in jjsp jsp jsp jsp jsp jsp jsp jsp jsp jsp jsp jsp jsp jsp jsp jsp jspp jsp jsp jspp jp jsp jspp jp jspp jp jspp jspp jspp jjspp jspp jspp jspp jp jsp jp jp jspp jspp jp jpp jp jp jsppp jp jsp jp jspp jp jp jsp jspp jspp jsp jp jsp jspp jsp jsp jp jpp jp jsp jp j jp jsp jsp j j jsp jsp jsp j j j jp jpppppp j j j j j j j j j j jppppppppppp jppppppp. Like if personCollection would have been a list I could have used item.personCollection[0].someProperty. But how do you set the name for collection of type set.

最佳回答

在您的提交动作中, 使用列表, 然后您可以在 jsp 中用索引使用此列表 。

您无法使用设定的设置在这里使用, 无法使用索引访问 。

在您的商业逻辑中,将列表转换成您可能需要的设定,用于进一步的组合。

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签