Announcement Announcement Module
Collapse
No announcement yet.
how to pass one bean value to another bean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to pass one bean value to another bean

    I am trying to process the name in two different beans as follows. Basically the original "get/setName" for name is working fine. I am tyring to process this name in another bean by name "set/getNamesAsString" so that I can use it in another part of jsp. Is it possible to do it like this. It is not working. Can anyone help me in this.
    Code:
    public class MyForm {
    
       private String name;
     
       public void setName(String name){
          this.samples = samples;
       }
    
       public String getname(){
          return name;
       }
        private List<String> namesAsString;   
      
      private String names = this.name;
    
      public List<String> getNamesAsString(){
          
           return namesAsString;
           
       }
               
       public void setNamesAsString(String names){
          
            String[] multiSamples = name.split("\r\n|\r|\n");
            List<String> multiNames = new ArrayList();
    
            for(int i=0; i <= multiSamples.length-1; i++){
                if(multiSamples[i] != null && multiSamples[i].length() != 0){
                    
                  multiNames.add(multiSamples[i]);                          
                }          
            }
           
           this.namesAsString = multiNames;
           
       }
    
    }
    Thanks

  • #2
    Please don't post duplicates.

    Comment


    • #3
      Originally posted by mdeinum View Post
      Please don't post duplicates.
      I am sorry about that. As a newbee, I am not sure where my query stands, hence I had topost it twice.

      Comment

      Working...
      X