Announcement Announcement Module
Collapse
No announcement yet.
problem injection bean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • problem injection bean

    hi,

    i use spring injection in a web app with spring mvc 2.5. My bean injected by spring is pidBeanView that have
    2 kind of lists (2 form with checkboxes -> 2 lists with a boolean value "checked" for spring form:bind). The list have the same content -> setTipologieIds = setTipologieId with all checked= false..i inject in a other controller and the same PidBeanView return a list getListaTipologieId whit a kind a differ in content. I try to compare the lists but before i try to remove in getListTipologiaId list the content not selected by user (first while). I try to compare both the list in a second While but incredible, the list have the same content ..why it happens? ..i have tried to remove data only in one list "getTipologiaId" but the other list (getTipologiaIds)change like that!the two lists seem to point to the same reference...So in a second while getTipologiasIds return empty!!
    Why? i have to uso a clone or addAll or Collections to copy the entire pidBeanView.getListaTipologieId() in a list tdr
    without using '=' like above??

    List<TipologiaDmsRemapping> temp = pidBeanView.getListaTipologieIds();
    List<TipologiaDmsRemapping> tdr = pidBeanView.getListaTipologieId();
    Iterator iter2 = tdr.iterator();
    while (iter2.hasNext())
    {
    TipologiaDmsRemapping tp = (TipologiaDmsRemapping)iter2.next();
    if (!tp.isSelected())
    {
    iter2.remove();
    }
    }
    Iterator iter = temp.iterator();
    while (iter.hasNext())
    {
    TipologiaDmsRemapping tipologdoc = (TipologiaDmsRemapping) iter.next();
    if (tdr.contains(tipologdoc))
    {

    iter.remove();
    pidBeanView.setTipologiadocScelta(tipologdoc);
    }
    }
    pidBeanView.setListaTipologieIds(temp);

    Thanks!

    Roby

  • #2
    Can you format your code to make it readable?

    Comment

    Working...
    X