??xml version="1.0" encoding="utf-8" standalone="yes"?>欧洲亚洲一区二区三区,最美情侣韩剧在线播放,天堂美国久久http://www.aygfsteel.com/bzbaifan/category/51701.htmlzh-cnTue, 12 Nov 2013 15:34:03 GMTTue, 12 Nov 2013 15:34:03 GMT60Java Web目调试http://www.aygfsteel.com/bzbaifan/archive/2013/11/12/406275.htmlgps梦想gps梦想Tue, 12 Nov 2013 15:30:00 GMThttp://www.aygfsteel.com/bzbaifan/archive/2013/11/12/406275.htmlhttp://www.aygfsteel.com/bzbaifan/comments/406275.htmlhttp://www.aygfsteel.com/bzbaifan/archive/2013/11/12/406275.html#Feedback0http://www.aygfsteel.com/bzbaifan/comments/commentRss/406275.htmlhttp://www.aygfsteel.com/bzbaifan/services/trackbacks/406275.html
工作中会带一些实习生或新人,大多~Zl验Q项目调试是他们很头疼的问题Q代码出了问题往往束手无{了Q很影响工作效率。其实代码调试是有步骤可循的Q代码出了问题要做的W一件事情是定位问题Q只有知道问题出在哪才能解决?/div>

一个Java Web目通常是由前端和后端组成的Q请求是由前端发送给后台代码处理的,所以我们要做的W一件事情就是确定问题出在前端还是后端,先要保证前端发送给后端的请求参数是对的Q有些同学在h参数不对或者请求根本没有到辑֐台的情况下盲目地L查后C码是不对的?/p>

前台h通常通过form、超链接或ajax{方法提交给后台Q我们必ȝ定提交的链接是对的,然后是参敎ͼ提交的参数我们可以通过览器地址或者一些浏览器调试工具Q例如火狐的firebugQ得到?/p>

如果h链接是对的、参C是对的,那就是后台的问题了,后台问题通常通过eclipse的debug工作调试Q但有一U情况,是开发中会运用一些mvc框架Q例如struts2、spring
mvc{,我们在后台某个地方加断点Ҏ没反应Q这时候有个很单的ҎQ把断点加到control层的代码入口处,如果q没反应Q那是框架配置问题了,要检查配|对不对?/p>

 


gps梦想 2013-11-12 23:30 发表评论
]]>
析JAVA面向对象思想http://www.aygfsteel.com/bzbaifan/archive/2012/09/15/387768.htmlgps梦想gps梦想Sat, 15 Sep 2012 03:06:00 GMThttp://www.aygfsteel.com/bzbaifan/archive/2012/09/15/387768.htmlhttp://www.aygfsteel.com/bzbaifan/comments/387768.htmlhttp://www.aygfsteel.com/bzbaifan/archive/2012/09/15/387768.html#Feedback0http://www.aygfsteel.com/bzbaifan/comments/commentRss/387768.htmlhttp://www.aygfsteel.com/bzbaifan/services/trackbacks/387768.html对象Q你可以理解成一U具有属性和行ؓ的实体,它可向外部提供服务。而用这个对象,可忽略其内部的细节,只需要知道用这U服务时?#8220;投入”?#8220;产出”卛_Q因此,“高内聚、低耦合”是面向对象编E的基本思想?/span>

略D一例,qx我们工作中要删除某条数据Q一般不是真?/span>delete掉,而是用一?/span>status标识Q?/span>status?/span>-1表示删除Q你写删除接口时完全可以q么写:

Class UserService{

       private UserDao userDao;

              public void deleteUser(User user){

                     user.setStatus(-1);

                     userDao.update(user);

}

}

       q个逻辑其实执行的是更新操作Q但接口名仍?/span>deleteUserQ因为它提供的确实是删除“服务”Q调用接口时我只需要知道我调用q个接口时会删除对象Q至于它怎么实现Q我不着?/span>

       Java中到处是指针引用Q习惯了使用c语言指针的程序员往往会ؕ用指针,而破坏了面向对象的思想Q比如,我要查询某个用户的密码,有h可能会这么写Q?/span>

       Class UserService{

              private UserDao userDao;

                     public void queryUserPasswd(int id,User user){

                            String passwd=userdao.getUserPasswd(id)

User.setPasswd(passwd);

}

}

       q种写法在语法上没什么问题,也能得到正确的|但传?/span>user对象q来有些不妥了Q我要得到密码,传个用户的密码,只要l个id可以把密码q回l调用者了Q干嘛要让h再传个对象进来?

       作ؓ一个项目经理,在工作过E中Q确实会遇到令h哭笑不得的接口,像上面那个删除接口吧,有h会这么写Q?/span>

Class UserService{

              public void deleteUser(UserDao userDao ,User user){

                     user.setStatus(-1);

                     userDao.update(user);

}

}

q接口写得,让h怸着头脑了,我删除一?/span>user对象Q还要传?/span>userDaol你Q意思是你ؓ我提供服务,我还要给个工L你,q说不通吧Q?/span>

Java是纯_的面向对象语言Q写JavaE序时要时刻CQ你在ؓ别h提供服务Qؓ别h提供服务׃应该提出q多的附加要求。这个问题在使用MVC模式分层思想的时候体现得更加严重。在使用MVC模式开发的时候,往往整个项目分成几层:action层?/span>service层、数据库处理层(dao层){等Q每一层往往׃同的E序员编写,q时候要格外提醒自己在ؓ别h提供服务。在一个新目开始的时候往往会出C个问题:在增加某条数据时Q要对这条数据的字段q行验证Q不能ؓI或者长度过长等{,如果没有验证Ҏ抛错Q在分层~写接口Ӟ开发h员经常想q个验证应该在上层或者下层做吧,我这边得到的数据是正的Q最后导致谁都没做验证。只要你C了提?#8220;服务”的思想Q就不应该要求别人给你的数据是正的Q而是应该处理各种非正帔R题,保证用户l你的Q何数据你都能l出相应的返回,当然Q在实际的项目中目l理可能规定数据验证?/span>service层做?/span>



gps梦想 2012-09-15 11:06 发表评论
]]>
Android Adapter详解http://www.aygfsteel.com/bzbaifan/archive/2012/07/06/382348.htmlgps梦想gps梦想Fri, 06 Jul 2012 03:19:00 GMThttp://www.aygfsteel.com/bzbaifan/archive/2012/07/06/382348.htmlhttp://www.aygfsteel.com/bzbaifan/comments/382348.htmlhttp://www.aygfsteel.com/bzbaifan/archive/2012/07/06/382348.html#Feedback0http://www.aygfsteel.com/bzbaifan/comments/commentRss/382348.htmlhttp://www.aygfsteel.com/bzbaifan/services/trackbacks/382348.html

Android Adapter 是将数据l定?/span>UI 界面上的桥接cR?/span> Adapter负责创徏和显C每个项目的?/span>View和提供对下层数据的访问。支?/span>Adapterl定?/span>UI控g必须扩展Adapter View抽象cR创ql承?/span>AdapterView的控件和创徏新的AdaptercLl定它们是可能的?/span>

Android pȝ本n提供了两U现成的Adapter 供我们用?/span>

1.ArrayAdapterQ它是一个绑?/span>ViewCl对象的通用cR默认情况下Q?/span>ArrayAdapterl定每个对象?/span>toString值到layout中预先定义的TextViewI间上。构造函数允许用户用更加复杂的Layout或者通过重写getViewҎ来扩展类从而?/span>TextView的替代物

2.SimpleCursorAdapterQ它l定View?/span>Content Provider 查询q回的游标上。指定一?/span>XML layout定义Q然后将数据集的每一列的值绑定到layout中的一?/span>View

 

写自qAdaptercd现更多复杂的UI界面和数据绑?/span>

   
public class MyAdapter extends SimpleAdapter {
    
      
private LayoutInflater mInflater;
      
private Context context;
      
private List<Map<String,Object>> list;
      
private int resource;
      
private String[] tags;
      
private int[] ids;
      
public MyAdapter(Context context, List<Map<String,Object>> items, int resource,
              String[] tags,
int[] ids) {
          
super(context, items, resource, tags, ids);
          
          
this.mInflater = LayoutInflater.from(context);
          
this.context = context;
          
this.list = items;
          
this.resource = resource;
          
this.tags = tags;
          
this.ids = ids;
      }
      
      
public int getCount() {
          
return list.size();
      }
      
      
public Object getItem(int position) {
          
return list.get(position);
      }
      
      
public long getItemId(int position) {
          
return position;
      }
      
      
public View getView(final int position, View convertView, ViewGroup parent) {
          convertView 
= super.getView(position, convertView, parent);
          
if (convertView == null) {  
              Toast.makeText(context, 
"this is null"2000).show(); 
             
         
          } 
else {   
              
          } 
         
          ImageView more 
= (ImageView) convertView.findViewById(R.id.iv_more); 
          
          more.setOnClickListener(
new View.OnClickListener() {
              
public void onClick(View arg0) {
                  Intent intent 
= new Intent(context, VehicleInfoActivity.class);
                  intent.putExtra(
"vehicleID", VehicleListActivity.idList.get(position));
                  intent.putExtra(
"CameraID""0");
                  Toast.makeText(context, 
"sssssss"2000).show();  
                  context.startActivity(intent);
                  
      
              }
          });
          
          
return convertView;
      }
}

主要重蝲getCount ҎQ?/span>getViewҎ getItemҎ getItemIdҎQ?/span> 参数解析Q?/span>contextQ传入的上下?/span>Activity, items l定数据的列?/span>, resource layout布局ID, tags l定数据?/span>key, ids Item 中对?/span>key的资?/span>ID?/span> ?/span>getView中自定义Item里面的事件监听,自定义新的重载后的显C界面返?/span> convertView?/span> 如果需要用到父类SimpleAdapter 昄效果需要调?/span>super.getViewҎ?/span> convertView 赋倹{?/span>



gps梦想 2012-07-06 11:19 发表评论
]]>
JAVA?=与equals()用法的区?/title><link>http://www.aygfsteel.com/bzbaifan/archive/2012/05/15/378176.html</link><dc:creator>gps梦想</dc:creator><author>gps梦想</author><pubDate>Tue, 15 May 2012 03:56:00 GMT</pubDate><guid>http://www.aygfsteel.com/bzbaifan/archive/2012/05/15/378176.html</guid><wfw:comment>http://www.aygfsteel.com/bzbaifan/comments/378176.html</wfw:comment><comments>http://www.aygfsteel.com/bzbaifan/archive/2012/05/15/378176.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/bzbaifan/comments/commentRss/378176.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/bzbaifan/services/trackbacks/378176.html</trackback:ping><description><![CDATA[ <p style="margin-top: 0pt; margin-bottom: 0pt;" class="p16"><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'>在java?=="是用来比较两者储存值的地址是否相同Q比如A==BQ就是比较A和B所储存值的地址是否相同?/span><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'><o:p></o:p></span></p><p style="margin-top: 0pt; margin-bottom: 0pt;" class="p16"><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'>再来看看equals()的?nbsp;</span><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'><o:p></o:p></span></p><p style="margin-top: 0pt; margin-bottom: 0pt;" class="p16"><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'>在java中有q两U情况存在:</span><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'><o:p></o:p></span></p><p style="margin-top: 0pt; margin-bottom: 0pt;" class="p16"><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'>      1、用objectcM的equals()ҎQ这个是java中最初的equals()Ҏ</span><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'><o:p></o:p></span></p><p style="margin-top: 0pt; margin-bottom: 0pt;" class="p16"><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'>         如果你自定义一个类AQƈ且没有去l承其他的类Q这时A中的equals()</span><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'><o:p></o:p></span></p><p style="margin-top: 0pt; margin-bottom: 0pt;" class="p16"><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'>         的功能就是比较两者储存值的地址是否相同。因为所有的c都l承object</span><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'><o:p></o:p></span></p><p style="margin-top: 0pt; margin-bottom: 0pt;" class="p16"><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'>         c,而objectcM有equals()q样的方?/span><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'><o:p></o:p></span></p><p style="margin-top: 0pt; margin-bottom: 0pt;" class="p16"><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'>        objectcM的equals()Ҏ的源代码如下Q?/span><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'><o:p></o:p></span></p><p style="margin-top: 0pt; margin-bottom: 0pt;" class="p16"><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'>          public boolean equals(object obj)</span><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'><o:p></o:p></span></p><p style="margin-top: 0pt; margin-bottom: 0pt;" class="p16"><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'>          {</span><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'><o:p></o:p></span></p><p style="margin-top: 0pt; margin-bottom: 0pt;" class="p16"><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'>            return this == obj;</span><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'><o:p></o:p></span></p><p style="margin-top: 0pt; margin-bottom: 0pt;" class="p16"><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'>          }</span><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'><o:p></o:p></span></p><p style="margin-top: 0pt; margin-bottom: 0pt;" class="p16"><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'> </span><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'><o:p></o:p></span></p><p style="margin-top: 0pt; margin-bottom: 0pt;" class="p16"><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'>         从这D代码中Q我们可以再ơ确定,q种情况下的equals()Ҏ的功能是</span><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'><o:p></o:p></span></p><p style="margin-top: 0pt; margin-bottom: 0pt;" class="p16"><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'>         比较两者储存值的地址?/span><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'><o:p></o:p></span></p><p style="margin-top: 0pt; margin-bottom: 0pt;" class="p16"><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'> </span><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'><o:p></o:p></span></p><p style="margin-top: 0pt; margin-bottom: 0pt;" class="p16"><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'> </span><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'><o:p></o:p></span></p><p style="margin-top: 0pt; margin-bottom: 0pt;" class="p16"><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'>      2、自定义一个类BQ但Bcȝ承了cc,而ccM的equals()Ҏ已经被重写过</span><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'><o:p></o:p></span></p><p style="margin-top: 0pt; margin-bottom: 0pt;" class="p16"><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'>            了,q种情Ş需要具体情况具体分析了Q但大部分被重写的equals()?/span><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'><o:p></o:p></span></p><p style="margin-top: 0pt; margin-bottom: 0pt;" class="p16"><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'>            法所拥有的功能就是比较两者储存值的内容是否相同Q而不再是比较地址</span><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'><o:p></o:p></span></p><p style="margin-top: 0pt; margin-bottom: 0pt;" class="p16"><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'>            了。比如:创徏一个String对象  String str1 = new String("1");</span><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'><o:p></o:p></span></p><p style="margin-top: 0pt; margin-bottom: 0pt;" class="p16"><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'>            String str2 = new String("1");  </span><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'><o:p></o:p></span></p><p style="margin-top: 0pt; margin-bottom: 0pt;" class="p16"><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'>            q时str1.equals(str2)比较的就是str1和str2中储存值的内容是否相同 </span><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'><o:p></o:p></span></p><p style="margin-top: 0pt; margin-bottom: 0pt;" class="p16"><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'>            了,因ؓStringcM的equals()p重写了,但这q不意味着所有被重写</span><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'><o:p></o:p></span></p><p style="margin-top: 0pt; margin-bottom: 0pt;" class="p16"><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'>            q的equals()Ҏ都是用来比较内容?因ؓ目前我所遇到的只有这U情</span><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'><o:p></o:p></span></p><p style="margin-top: 0pt; margin-bottom: 0pt;" class="p16"><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'>            况,如果大家有兴可以去多研I研I?/span><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'><o:p></o:p></span></p><p style="margin-top: 0pt; margin-bottom: 0pt;" class="p16"><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'>ȝ:"=="只有一U用法,而equals()有两U用法,只是所使用的环境不一栯已?/span><span style='font-family: "宋体"; font-size: 10.5pt; mso-spacerun: "yes";'><o:p></o:p></span></p><!--EndFragment--><img src ="http://www.aygfsteel.com/bzbaifan/aggbug/378176.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/bzbaifan/" target="_blank">gps梦想</a> 2012-05-15 11:56 <a href="http://www.aygfsteel.com/bzbaifan/archive/2012/05/15/378176.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <a href="http://www.aygfsteel.com/" title="狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频">狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频</a> </div> </footer> վ֩ģ壺 <a href="http://" target="_blank">޽</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ǩ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">׿</a>| <a href="http://" target="_blank">̷</a>| <a href="http://" target="_blank">ԭ</a>| <a href="http://" target="_blank">ׯ</a>| <a href="http://" target="_blank">ٳ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ͽ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">۽</a>| <a href="http://" target="_blank">ߺ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ž</a>| <a href="http://" target="_blank">˴</a>| <a href="http://" target="_blank">̷</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">᰸</a>| <a href="http://" target="_blank">ʩ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ˮ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ӱ</a>| <a href="http://" target="_blank">۶</a>| <a href="http://" target="_blank">Ϫ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">΢ɽ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>