Valuelist中列内容的修改,例如要显示"hahahaha",但数据库里为"sdfdsf"

阅读更多

在jsp代码中这样写

 

 

相应的pojo中要加上getFirstNameAsString这个函数

public class Player {

   public Player()   {   }
   public Player(String name, String firstName, String middleName, String lastName, String status, String position)   {       id = "ID" + idSequence++;       this.name = name;       this.firstName = firstName;       this.middleName = middleName;       this.lastName = lastName;       this.status = status;       this.position = position;   }
   public String getId()   {       return id;   }
   public void setId(String id)   {       this.id = id;   }
   public String getName()   {       return name;   }
   public void setName(String name)   {       this.name = name;   }
   public String getFirstName()   {       return firstName;   }

//注意这个函数

  public String getFirstNameAsString()   {       return firstName + " as an String";   }      
   public void setFirstName(String firstName)   {       this.firstName = firstName;   }
   public String getLastName()   {       return lastName;   }
   public void setLastName(String lastName)   {       this.lastName = lastName;   }
   public String getMiddleName()   {       return middleName;   }
   public void setMiddleName(String middleName)   {       this.middleName = middleName;   }
   public String getPosition()   {       return position;   }
   public void setPosition(String position)   {       this.position = position;   }
   public String getStatus()   {       return status;   }
   public void setStatus(String status)   {       this.status = status;   }
   public String toString()   {       return firstName + " " + lastName;   }
   private static long idSequence;   private String id;   private String name;   private String firstName;   private String middleName;   private String lastName;   private String status;   private String position;

}

取自" http://localhost/wiki/index.php/Valuelist%E4%B8%AD%E5%88%97%E5%86%85%E5%AE%B9%E7%9A%84%E4%BF%AE%E6%94%B9%EF%BC%8C%E4%BE%8B%E5%A6%82%E6%80%A7%E5%88%AB%E4%B8%BA%E5%A5%B3%EF%BC%8C%E4%BD%86%E6%95%B0%E6%8D%AE%E5%BA%93%E9%87%8C%E4%B8%BA2"


你可能感兴趣的:(PHP,JSP)