spring mvc: How Can I give the <form:textarea /> tag a default value?

前端 未结 7 1587
悲&欢浪女
悲&欢浪女 2021-01-18 17:19

I have a problem with giving the tag a default value.
When I created a .jsp file as follow,



        
7条回答
  •  灰色年华
    2021-01-18 17:54

    You can also set the defaul text in the Model as well. Your jsp would have:

    
    

    and then in the Model, you'd have:

    private static final String DEFAULT_textareacontent = "Hello World";
    private String my-text-box = DEFAULT_textareacontent;
    

    Not sure if this is a best practice or not, but it seems to work for me.

提交回复
热议问题