`

浅谈 BbossMVC 数据绑定

阅读更多
浅谈 BbossMVC 数据绑定,本文介绍BbossMVC框架的数据绑定功能。包括数字绑定,字符串绑定,日期类型绑定,日期数组类型绑定,bean对象绑定,List绑定,Map绑定,枚举类型绑定,枚举类型数组绑定。

相关的框架包请及时更新最新版本

本文涉及的技术包括:mvc,aop/ioc,taglib,jsp
目 录 [ - ]
    1.数据绑定实战策略-实例eclipse工程下载和部署以及浏览
    2.数据绑定实例-jsp页面
    3.数据绑定实例-控制器实现
    4.数据绑定控制器配置文件-bboss-helloworld.xml
   

1.数据绑定实战策略-实例eclipse工程下载和部署以及浏览

1.1.下载本文相关附件-mvc-databind.zip
http://dl.iteye.com/topics/download/6b4fc8b6-79dd-325f-b32a-4b69354b35a5
1.2.解压mvc-databind.zip ,将其中的工程导入eclipse即可查看文中相关的源代码
1.3.部署,准备好tomcat 6和jdk 15或以上的版本
1.4.在tomcat 6的conf\Catalina\localhost下增加mvc.xml文件,内容为:
<?xml version='1.0' encoding='utf-8'?>
<Context docBase="D:\workspace\bbossgroups-3.2\bestpractice\mvc\WebRoot" path="/mvc" debug="0" reloadable="false">
</Context>

用户可以根据自己的实际情况设置docBase属性的值
1.5.启动tomcat,输入以下地址即可访问mvc的数据绑定实例了:
http://localhost:8080/mvc/examples/index.page

2.数据绑定实例-jsp页面

   
<%--  
      
     *  Copyright 2008-2011 biaoping.yin  
     *  
     *  Licensed under the Apache License, Version 2.0 (the "License");  
     *  you may not use this file except in compliance with the License.  
     *  You may obtain a copy of the License at  
     *  
     *      http://www.apache.org/licenses/LICENSE-2.0  
     *  
     *  Unless required by applicable law or agreed to in writing, software  
     *  distributed under the License is distributed on an "AS IS" BASIS,  
     *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
     *  See the License for the specific language governing permissions and  
     *  limitations under the License.  
      
     --%>  
    <%@ page contentType="text/html;charset=UTF-8" language="java"  
        session="false"%>  
    <%@ taglib uri="/WEB-INF/commontag.tld" prefix="common"%>   
    <%@ taglib uri="/WEB-INF/pager-taglib.tld" prefix="pg"%>  
      
    <head>  
        <title>bboss-mvc - hello world,data bind!</title>  
        <script type="text/javascript"  
                src="../include/My97DatePicker/WdatePicker.js"></script>  
        <pg:config enablecontextmenu="false"/>  
            <script type="text/javascript">  
              
                function doquery(){  
                    $("#queryresult").load("sayHelloEnum.page",{sex:$("#sex").val()});  
                }  
                  
                function domutiquery(){  
                    $("#queryresult").load("sayHelloEnums.page",{sex:$("#sex").val()});  
                }  
            </script>   
    </head>  
    <body>  
                <h3>  
                    Hello World number bind Examples.  
                </h3>  
                <form action="sayHelloNumber.page" method="post">  
                <table cellspacing="0" >  
                    <tbody>  
                        <tr><td>  
                                请输入您的幸运数字:  
                            <input name="name" type="text">  
                            </td>  
                        </tr>  
                        <tr>  
                            <td>  
                                来自服务器的问候:  
                                <common:request name="serverHelloNumber"/>  
                                <pg:error colName="name"/>  
                            </td>  
                        </tr>  
                        <tr>  
                            <td><input type="submit" name="确定" value="确定">/td>                         
                        </tr>  
                    </tbody>  
                </table>  
                </form>  
                <h3>  
                    Hello World String bind Examples.  
                </h3>  
                <form action="sayHelloString.page" method="post">  
                <table cellspacing="0" >  
                    <tbody>  
                        <tr>  
                            <td>  
                                请输入您的名字:  
                            <input name="name" type="text">  
                            </td>  
                        </tr>  
                        <tr>  
                            <td>  
                                来自服务器的问候:  
                                <pg:empty requestKey="serverHello">  
                                    没有名字,不问候。  
                                </pg:empty>  
                                <pg:notempty requestKey="serverHello">  
                                    <common:request name="serverHello"/>  
                                </pg:notempty>  
                            </td>  
                        </tr>  
                        <tr>  
                            <td><input type="submit" name="确定" value="确定">/td>                         
                        </tr>  
                    </tbody>  
                </table>  
                </form>  
                <h3>  
                    Hello World Time bind Examples.  
                </h3>  
                <form action="sayHelloTime.page" method="post">  
                <table cellspacing="0" >  
                    <tbody>  
                        <tr>  
                            <td colspan="2">  
                                请输入您的幸运日期:  
                            </td>  
                        </tr>  
                        <tr >  
                            <td align="right">  
                           普通日期:  
                            </td>  
                            <td>  
                           <input id="d12" name="d12" type="text"  
                            onclick="WdatePicker({el:'d12'})" src="../include/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle"/>  
                           </td>  
                           </tr>  
                            <tr >  
                            <td align="right">  
                            sql日期:  
                            </td>  
                            <td>  
                            <input class="Wdate" type="text" name="stringdate" onClick="WdatePicker()">  
                            </td>  
                           </tr>  
                           <tr >  
                            <td align="right">  
                            timestamp精确具体时间:  
                            </td>  
                            <td>  
                            <input class="Wdate" type="text" name="stringdatetimestamp" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH/mm/ss'})">  
                            </td>  
                            </tr>  
                          
                        <tr>  
                            <td colspan="2">  
                                来自服务器的日期问候:  
                                <common:request name="utilDate" dateformat="yyyy-MM-dd"/>  
                                <common:request name="sqlDate" dateformat="yyyy-MM-dd"/>  
                                <common:request name="sqlTimestamp" dateformat="yyyy-MM-dd HH/mm/ss"/>  
                            </td>  
                        </tr>  
                        <tr>  
                            <td><input type="submit" name="确定" value="确定">/td>                         
                        </tr>  
                    </tbody>  
                </table>  
                </form>  
                <h3>  
                    Hello World Time Array bind Examples.  
                </h3>  
                <form action="sayHelloTimes.page" method="post">  
                <table cellspacing="0" >  
                    <tbody>  
                        <tr>  
                                                    <td colspan="2">  
                                请输入您的幸运日期:  
                              
                            </td>  
                        </tr>  
                        <tr >  
                            <td align="right">  
                           普通日期:  
                            </td>  
                            <td>  
                           <input id="d12s" name="d12s" type="text"  
                            onclick="WdatePicker({el:'d12s'})" src="../include/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle"/>  
                           </td>  
                           </tr>  
                            <tr >  
                            <td align="right">  
                            sql日期:  
                            </td>  
                            <td>  
                            <input class="Wdate" type="text" name="stringdates" onClick="WdatePicker()">  
                            </td>  
                           </tr>  
                           <tr >  
                            <td align="right">  
                            timestamp精确具体时间:  
                            </td>  
                            <td>  
                            <input class="Wdate" type="text" name="stringdatetimestamps" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH/mm/ss'})">  
                            </td>  
                            </tr>  
                          
                        <tr>  
                            <td colspan="2">  
                                来自服务器的日期问候:  
                                <common:request name="utilDates" dateformat="yyyy-MM-dd"/>  
                                <common:request name="sqlDates" dateformat="yyyy-MM-dd"/>  
                                <common:request name="sqlTimestamps" dateformat="yyyy-MM-dd HH/mm/ss"/>  
                            </td>  
                        </tr>  
                        <tr>  
                            <td><input type="submit" name="确定" value="确定">/td>                         
                        </tr>  
                    </tbody>  
                </table>  
                      
                </form>  
                <h3>  
                    Hello World Bean bind Examples.  
                </h3>  
                <form action="sayHelloBean.page" method="post">  
                <table cellspacing="0" >  
                    <tbody>  
                        <tr>  
                            <td>  
                                请输入您的名字:  
                            <input name="name" type="text">  
                            </td>  
                        </tr>  
                        <tr>  
                            <td>  
                                来自服务器的问候:  
                                <pg:null actual="${serverHelloBean}">  
                                    没有名字,不问候。  
                                </pg:null>  
                                <pg:notnull actual="${serverHelloBean}">  
                                    <common:request name="serverHelloBean" property="name"/>  
                                </pg:notnull>  
                                  
                            </td>  
                        </tr>  
                        <tr>  
                            <td><input type="submit" name="确定" value="确定">/td>                         
                        </tr>  
                    </tbody>  
                </table>  
                      
                </form>  
                  
                <h3>  
                    Hello World List<PO> bind  Examples.  
                </h3>  
                <form action="sayHelloBeanList.page" method="post">  
                <table cellspacing="0" >  
                    <tbody>  
                        <tr>  
                            <td>  
                                请输入您的名字:  
                            <input name="name" type="text">  
                            </td>  
                        </tr>  
                        <tr>  
                            <td>  
                                来自服务器的问候:  
                                <pg:list requestKey="serverHelloListBean" >  
                                    <pg:cell colName="name"/>  
                                </pg:list>  
                            </td>  
                        </tr>  
                        <tr>  
                            <td><input type="submit" name="确定" value="确定">/td>                         
                        </tr>  
                    </tbody>  
                </table>  
                      
                </form>  
                  
                <h3>  
                    Hello World Map<String,PO> bind  Examples.  
                </h3>  
                <form action="sayHelloBeanMap.page" method="post">  
                <table cellspacing="0" >  
                    <tbody>  
                        <tr><td>  
                                请输入您的名字:  
                            <input name="name" type="text">  
                            </td>  
                        </tr>  
                        <tr>  
                            <td>  
                                来自服务器的问候:  
                                <pg:beaninfo requestKey="serverHelloMapBean" >  
                                    <pg:cell colName="name"/>  
                                </pg:beaninfo>  
                            </td>  
                        </tr>  
                        <tr>  
                            <td><input type="submit" name="确定" value="确定"></td>                         
                        </tr>  
                    </tbody>  
                </table>  
                      
                </form>  
                  
                <h3>  
                    Hello World Array bind  Examples.  
                </h3>  
                <form action="sayHelloArray.page" method="post">  
                <table cellspacing="0" >  
                    <tbody>  
                        <tr>  
                            <td>  
                                请输入您的名字两次(一定要两次哦):  
                            <input name="name" type="text">  
                            <input name="name" type="text">  
                            </td>  
                        </tr>  
                        <tr>  
                            <td>  
                                来自服务器的问候:  
                                <pg:list requestKey="serverHelloArray" >  
                                    <pg:rowid increament="1"/> <pg:cell />  
                                </pg:list>  
                            </td>  
                        </tr>  
                        <tr>  
                            <td><input type="submit" name="确定" value="确定"></td>                         
                        </tr>  
                    </tbody>  
                </table>  
                      
                </form>  
                <h3>  
                    Hello World Enum bind  Examples.  
                </h3>  
                  
                <table >  
                      
                    <!--分页显示开始,分页标签初始化-->  
                        <tr >  
                            <th align="center">  
                                NAME:<select id="sex">  
                                <option value="F">F</option>  
                                <option value="M">M</option>  
                                <option value="UN">UN</option>  
                                </select>  
                            </th>  
                            <th>  
                                <input type="button" value="性别查询" onclick="doquery()"/>  
                                <input type="button" value="多性别查询" onclick="domutiquery()"/>  
                            </th>  
                        </tr>  
                        <tr >  
                            <td align="center">  
                                结果  
                            </td>  
                               
                            <td id="queryresult"></td>  
                        </tr>  
                </table>    
    </body>
 

3.数据绑定实例-控制器实现

3.1.控制器实现类


   
/** 
     *  Copyright 2008 biaoping.yin 
     * 
     *  Licensed under the Apache License, Version 2.0 (the "License"); 
     *  you may not use this file except in compliance with the License. 
     *  You may obtain a copy of the License at 
     * 
     *      http://www.apache.org/licenses/LICENSE-2.0 
     * 
     *  Unless required by applicable law or agreed to in writing, software 
     *  distributed under the License is distributed on an "AS IS" BASIS, 
     *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
     *  See the License for the specific language governing permissions and 
     *  limitations under the License.   
     */  
    package org.frameworkset.mvc;  
      
    import java.io.IOException;  
    import java.util.List;  
    import java.util.Map;  
      
    import javax.servlet.http.HttpServletResponse;  
      
    import org.frameworkset.util.annotations.MapKey;  
    import org.frameworkset.util.annotations.RequestParam;  
    import org.frameworkset.web.servlet.ModelMap;  
      
    /** 
     * <p> 
     * HelloWord.java 
     * </p> 
     * <p> 
     * Description: 
     * </p> 
     * <p> 
     * bboss workgroup 
     * </p> 
     * <p> 
     * Copyright (c) 2009 
     * </p> 
     *  
     * @Date 2011-6-4 
     * @author biaoping.yin 
     * @version 1.0 
     */  
    public class HelloWord  
    {  
      
        public String sayHelloNumber(@RequestParam(name = "name") int ynum,  
                ModelMap model)  
        {  
      
            if (ynum != 0)  
            {  
                model.addAttribute("serverHelloNumber", "幸运数字为[" + ynum + "]!");  
            }  
            else  
                model.addAttribute("serverHelloNumber", "幸运数字为[" + ynum  
                        + "]!,好像有点不对哦。");  
      
            return "path:sayHello";  
        }  
      
        public String sayHelloString(@RequestParam(name = "name") String yourname,  
                ModelMap model)  
        {  
      
            if (yourname != null && !"".equals(yourname))  
                model.addAttribute("serverHello", "服务器向您[" + yourname + "]问好!");  
            else  
                model.addAttribute("serverHello", "请输入您的名字!");  
            return "path:sayHello";  
        }  
      
        public String sayHelloTime(  
                @RequestParam(name = "d12", dateformat = "yyyy-MM-dd") java.util.Date d12,  
                @RequestParam(name = "stringdate", dateformat = "yyyy-MM-dd") java.sql.Date stringdate,  
                @RequestParam(name = "stringdatetimestamp", dateformat = "yyyy-MM-dd HH/mm/ss") java.sql.Timestamp stringdatetimestamp,  
                @RequestParam(name = "stringdatetimestamp") String stringdatetimestamp_,  
                ModelMap model)  
        {  
      
            model.put("utilDate", d12);  
            model.put("sqlDate", stringdate);  
            model.put("sqlTimestamp", stringdatetimestamp);  
            return "path:sayHello";  
      
        }  
          
        public String sayHelloTimes(  
                @RequestParam(name = "d12s", dateformat = "yyyy-MM-dd") java.util.Date[] d12,  
                @RequestParam(name = "stringdates", dateformat = "yyyy-MM-dd") java.sql.Date[] stringdate,  
                @RequestParam(name = "stringdatetimestamps", dateformat = "yyyy-MM-dd HH/mm/ss") java.sql.Timestamp[] stringdatetimestamp,  
                @RequestParam(name = "stringdatetimestamps") String[] stringdatetimestamp_,  
                ModelMap model)  
        {  
      
            model.put("utilDates", d12[0]);  
            model.put("sqlDates", stringdate[0]);  
            model.put("sqlTimestamps", stringdatetimestamp[0]);  
            return "path:sayHello";  
      
        }  
      
        public String sayHelloBean(ExampleBean yourname, ModelMap model)  
        {  
      
            if (yourname.getName() != null && !"".equals(yourname.getName()))  
                model.addAttribute("serverHelloBean", yourname);  
            else  
                ;  
      
            return "path:sayHello";  
        }  
      
        public String sayHelloBeanList(List<ExampleBean> yourname, ModelMap model)  
        {  
      
            model.addAttribute("serverHelloListBean", yourname);  
      
            return "path:sayHello";  
        }  
      
        public String sayHelloBeanMap(@RequestParam(name = "name") String yourname,  
                @MapKey("name") Map<String, ExampleBean> mapBeans, ModelMap model)  
        {  
      
            model.addAttribute("serverHelloMapBean", mapBeans.get(yourname));  
            return "path:sayHello";  
        }  
          
        public String sayHelloArray(@RequestParam(name = "name") String[] yournames,ModelMap model)  
        {  
            model.addAttribute("serverHelloArray",yournames);  
            return "path:sayHello";  
        }  
          
        /** 
         * 测试单个字符串向枚举类型值转换 
         * @param type 
         * @param response 
         * @throws IOException 
         */  
        public  void sayHelloEnum(@RequestParam(name="sex") SexType type,HttpServletResponse response) throws IOException  
        {  
            if(type != null)  
            {  
                if(type == SexType.F)  
                {  
                    response.setContentType("text/html; charset=GBK");  
                    response.getWriter().print("女");  
                }  
                else if(type == SexType.M)  
                {  
                    response.setContentType("text/html; charset=GBK");  
                    response.getWriter().print("男");  
                }  
                else if(type == SexType.UN)  
                {  
                    response.setContentType("text/html; charset=GBK");  
                    response.getWriter().print("未知");  
                }  
                      
            }  
              
              
        }  
        /** 
         * 测试单个字符串向枚举类型值转换 
         * @param type 
         * @param response 
         * @throws IOException 
         */  
        public  void sayHelloEnums(@RequestParam(name="sex") SexType[] types,HttpServletResponse response) throws IOException  
        {  
            response.setContentType("text/html; charset=GBK");  
            if(types != null)  
            {  
                if(types[0] == SexType.F)  
                {  
                      
                    response.getWriter().print("女");  
                }  
                else if(types[0] == SexType.M)  
                {  
                      
                    response.getWriter().print("男");  
                }  
                else if(types[0] == SexType.UN)  
                {  
                    response.getWriter().print("未知");  
                }                 
            }         
        }  
          
        public String index()  
        {         
            return "path:sayHello";  
        }  
    }  




3.2.依赖的值对象-ExampleBean


  
 /** 
     *  Copyright 2008 biaoping.yin 
     * 
     *  Licensed under the Apache License, Version 2.0 (the "License"); 
     *  you may not use this file except in compliance with the License. 
     *  You may obtain a copy of the License at 
     * 
     *      http://www.apache.org/licenses/LICENSE-2.0 
     * 
     *  Unless required by applicable law or agreed to in writing, software 
     *  distributed under the License is distributed on an "AS IS" BASIS, 
     *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
     *  See the License for the specific language governing permissions and 
     *  limitations under the License.   
     */  
    package org.frameworkset.mvc;  
      
      
    /** 
     * <p>ExampleBean.java</p> 
     * <p> Description: </p> 
     * <p> bboss workgroup </p> 
     * <p> Copyright (c) 2009 </p> 
     *  
     * @Date 2011-6-4 
     * @author biaoping.yin 
     * @version 1.0 
     */  
    public class ExampleBean  
    {  
        private String name = null;  
      
          
        public String getName()  
        {  
          
            return name;  
        }  
      
          
        public void setName(String name)  
        {  
          
            this.name = name;  
        }  
      
    }  




3.3.依赖的枚举类型对象-SexType


   
/* 
     *  Copyright 2008 biaoping.yin 
     * 
     *  Licensed under the Apache License, Version 2.0 (the "License"); 
     *  you may not use this file except in compliance with the License. 
     *  You may obtain a copy of the License at 
     * 
     *      http://www.apache.org/licenses/LICENSE-2.0 
     * 
     *  Unless required by applicable law or agreed to in writing, software 
     *  distributed under the License is distributed on an "AS IS" BASIS, 
     *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
     *  See the License for the specific language governing permissions and 
     *  limitations under the License. 
     */  
    package org.frameworkset.mvc;  
      
    /** 
     * <p>Title: SexType.java</p>  
     * <p>Description: </p> 
     * <p>bboss workgroup</p> 
     * <p>Copyright (c) 2008</p> 
     * @Date 2011-4-5 
     * @author biaoping.yin 
     * @version 1.0 
     */  
    public enum SexType {  
        F,M,UN  
      
    }  


4.数据绑定控制器配置文件-bboss-helloworld.xml

 
  <properties>  
        <property name="/examples/*.page"  
            path:sayHello="/examples/hello.jsp"  
            class="org.frameworkset.mvc.HelloWord">  
        </property>  
    </properties> 




附带说明一下,本文是参考bbossgroups 3.2版本功能编写
分享到:
评论
3 楼 yin_bp 2012-08-09  
控制器方法中参数的名称如果和input的name一致,可以不需要在参数前面加@RequestParam注解:
不一样时加注解进行映射
public String sayHelloString(@RequestParam(name = "name") String yourname,   
                ModelMap model) 

一样时可以不加注解:
public String sayHelloString(String name,   
                ModelMap model) 
2 楼 yin_bp 2011-06-29  
ainidehsj 写道
哈哈,跟spring有点类似,但是也有些特色。

bbossgroups支持的类型绑定比spring的要全,枚举和枚举数组spring就没有,参数绑定bbossgroups还可以直接指定数据格式(日期格式,数字格式),spring不行,而且spring设置非常麻烦。bbossgroups 对List<po>,Map<String,po>的支持也要比spring强啊
1 楼 ainidehsj 2011-06-28  
哈哈,跟spring有点类似,但是也有些特色。

相关推荐

    bboss mvcdemo 下载地址

    1. **模型(Model)**:BBoss MVCDemo支持多种数据访问方式,如JDBC、Hibernate或MyBatis,允许开发者根据项目需求选择合适的数据访问策略。模型层负责处理业务逻辑和数据操作,确保与视图和控制器的解耦。 2. **视图...

    Spring+MVC数据绑定大全+

    Spring MVC 数据绑定大全 Spring MVC 框架提供了强大的数据绑定机制,帮助开发者快速地将 HTTP 请求中的数据绑定到 JavaBean 对象中。数据绑定是指将 HTTP 请求中的参数转换为 Java 对象的过程。在 Spring MVC 中,...

    spring MVC数据绑定大全

    在Spring MVC中,数据绑定是一项核心功能,它允许开发者将用户输入的数据与控制器中的对象属性进行关联,简化了数据处理的复杂性。本文将详细介绍Spring MVC中的数据绑定,并提供实例帮助初学者理解。 1. **模型...

    Spring MVC数据绑定大全.rar

    "Spring MVC数据绑定大全.rar"这个压缩包很可能包含了全面讲解Spring MVC数据绑定技术的资料,如"Spring MVC数据绑定大全.pdf"。下面将详细阐述Spring MVC数据绑定的关键知识点。 1. **注解驱动的数据绑定**:...

    Spring MVC数据绑定概述及原理详解

    以下是对Spring MVC数据绑定的深入解释: **数据绑定概述** 在Spring MVC中,数据绑定是通过`DataBinder`组件实现的。当一个HTTP请求到达控制器方法时,Spring MVC会自动创建一个`DataBinder`实例,并使用`...

    C#使用数据绑定控件录入数据

    9. 表示层与业务逻辑层分离:数据绑定使得UI与数据模型之间的关系更加清晰,有利于实现MVC(Model-View-Controller)或MVVM(Model-View-ViewModel)架构,提高代码的可维护性和复用性。 10. LINQ to SQL 和 Entity...

    spring mvc 参数绑定漏洞

    3. **默认配置不当**:Spring MVC的默认配置可能允许过于宽松的数据绑定,例如允许空值绑定到非null字段,或者允许任意类型的参数绑定。 针对这些风险,开发者可以采取以下措施来增强Spring MVC应用的安全性: 1. *...

    .net MVC AJAX实现DropDownList数据绑定 城市联动

    .net MVC下,AJAX实现DropDownList数据绑定,并实现无刷新城市联动。 内含SQL Server 数据库执行语句,只要运行一下就OK了。 运行代码时注意别忘了更改成所使用数据库的ServerName,LoginName,Password。

    详解ASP.NET MVC之下拉框绑定四种方式

    *** MVC下拉框绑定是Web开发中常见的一项功能,开发者可以通过多种方式将数据绑定到下拉框控件中,以供用户进行选择。在本篇文档中,将详细介绍四种*** MVC下拉框绑定的方法,每种方法都有其适用场景,开发者可以...

    27 Spring MVC数据绑定InitBinder揭秘慕课专栏1

    背景在使用 SpingMVC 框架的项目中,经常会遇到页面某些数据要转换成类型是 Date、Integer、Double 等的数据绑定到控制器的实体。Sprin

    利用数据绑定控件录入数据

    在开发过程中,开发者通常会使用数据绑定框架,例如.NET中的WPF或WinForms,或者Web开发中的ASP.NET MVC或Vue.js等。这些框架提供了丰富的数据绑定功能,使得开发者能方便地将控件与数据源连接,实现数据的双向绑定...

    WPF数据绑定例子

    **WPF数据绑定详解** WPF(Windows Presentation Foundation)是微软.NET Framework的一部分,它提供了丰富的用户界面(UI)设计和开发能力。与传统的WinForm相比,WPF在很多方面都有显著提升,其中数据绑定机制是...

    数据绑定—wpf

    数据绑定是Windows Presentation Foundation(WPF)框架中的核心特性,它简化了用户界面(UI)与应用程序业务逻辑之间的数据交互。在WPF中,数据绑定允许开发者将UI元素的属性与数据源的属性关联起来,确保UI的更新...

    Spring In Action MVC 提交表单(2)-数据绑定和数据校验

    在实际开发中,我们可能使用诸如IntelliJ IDEA或Eclipse等IDE,它们提供了对Spring MVC数据绑定和校验的强大支持,包括代码提示、错误检测和自动修复。 综上所述,Spring MVC的数据绑定和数据校验机制为开发者提供...

    springmvc数据绑定示例程序

    本示例程序是基于Maven构建的一个项目,旨在演示如何在Spring MVC中实现数据绑定。 首先,Spring MVC的数据绑定主要分为两个方向:请求到模型(Request to Model)和模型到视图(Model to View)。前者是指从HTTP...

    WPF下DataGrid每行设置不同的ComboBox的数据绑定

    这个任务可以通过灵活的数据绑定和模板来实现。下面我们将详细讲解如何在WPF的DataGrid中为每行设置不同的ComboBox数据绑定。 首先,理解DataGrid的基本工作原理。DataGrid通常与一个数据源(如...

    WPF之数据绑定总结(博客源码)

    1.TextBox绑定后台的值(一次绑定,类似于赋值); 2.TextBox绑定后台的值(可通过改绑定的值自动更新值); 3.TextBox绑定另一个控件的属性值(随时更新值); 4.TextBox绑定另一个控件的属性值(双向更新); 5....

    ASP.NET MVC模型绑定的6个建议

    ASP.NET MVC 模型绑定是该框架中一个强大的...总之,ASP.NET MVC的模型绑定极大地简化了数据处理,但同时也需要谨慎处理以确保数据安全和代码可维护性。遵循上述建议,可以更高效、安全地使用模型绑定来构建应用程序。

    Spring MVC注解与数据绑定(含源码及结果图)

    1、有如下一个订单信息页面order.jsp(置于/WEB-INF/jsp目录下),按以下步骤实现一个使用POJO类型完成表单数据传输的SpringMVC数据绑定项目。 (1) 创建一个Order类来封装上述订单信息,其中各个属性的名称和数据类型...

    android官方数据绑定框架DataBinding使用

    Android DataBinding是Google推出的一种强大的数据绑定库,它旨在简化Android应用中的UI逻辑,通过将视图和数据模型直接关联起来,减少代码量并提高可读性。在本篇文章中,我们将深入探讨如何使用这个框架。 一、...

Global site tag (gtag.js) - Google Analytics