菜鸟跪求高手指教
小弟最近在做一个注册界面,用struts+spring+hibernate,数据库用mysql   
 用户名字段的jsp如下:   
  <tr>  
              <td> 用户名 </td>  
              <td>  <html:text   property= "username "   />  
                          <html:button   property= "checkcode "   onclick= "checkusername() "> 检测用户名 </html:button>  </td>    
 设想在用户注册前先确认一下该名字在数据库中是否已存在,点击      检测用户名      按钮搜索数据库,并弹出一个小窗口给出用户名是否已存在的信息,请问这一段   判断程序应该写在哪(jsp或者还是新建一个action或者其他什么地方),怎么写.小弟现在一点头绪也没,求各位高手指教     
------解决方案--------------------建议是用action的好。写你这个流程,难倒不难,只是工作两和细节倒是很多的。
------解决方案--------------------如果要使弹出窗口 就简单了   
 function opennew(newurl,windowName,width,height,scrollbars) 
 { 
 	var returnValue; 
 	var theLeft,theTop   
 	theLeft=(screen.width-width)/2-2 
 	theTop=(screen.height-height)/2 
 	returnValue = window.open(newurl,windowName, 'width= '+width+ ',height= '+height+ ',scrollbars= '+scrollbars+ ',status=0,toolbar=0,resizable=0,left= '+theLeft+ ',top= '+theTop+ ' ');//.focus(); 
 	returnValue.focus();   
 	return returnValue; 
 }   
 function checkusername(){ 
    var url=......... 
    var userName=...... 
 url =  .......  // 把userName 传值到action中     
 opennew(url, 'asdf ',400,300, 'no ') 
 }   
 这样在url对应的action中 根据传来的userName 判断了 
 在输出到页面上     
 如果要是在当前页面 显示这个用户名是否存在  
 肯定的需要action 了 
 这个是需要使用ajax 技术  
 建议看看dwr 用dwr 作这类东西很简单