To implement a small function of the interface, the dropdown box reads the database information, displays it in the streets, clicks the selected value, and stores it in the database.
below look at the interface effect:
first, introduce the implementation of the following interface JSP code:
<span style= "FONT-FAMILY:KAITI_GB2312;FONT-SIZE:18PX;" > <div class= "Formitem" >
<div class= "F_label" >
<span class= "Red" >*</span> User name:
</div>
<div class= "F_item" ></span>
<span style= "FONT-FAMILY:KAITI_GB2312;FONT-SIZE:18PX;" > <!--This is the data that will be read from the database and displayed to the interface--></span>
<span style= "FONT-FAMILY:KAITI_GB2312;FONT-SIZE:18PX;" > <input type= "text" id= "Realname" name= "Realname"/> <input type= "hidden" "Name=" Allotuuid "id="
Allotuuid "/> <input type= hidden" id= "userid" name= "userid"
/>
</div>
</div></ Span>
Javascrip Implementation
<span style= "FONT-FAMILY:KAITI_GB2312;FONT-SIZE:18PX;" > $ (function () {
createselect (' Realname ', {
valuefieldid: ' userid '), Get hidden field ID
textField: ' Realname ',//Interface text box display value
selectboxheight:200,
valuefield: ' userid ', url: ' ${path}/assetqueryusername/ Queryrealname.json ', Checkbox:false
});</span>
Valuefield, the equivalent of getting the ID of the user name, upload it to the background, to operate ()
Action Layer
<span style= "FONT-FAMILY:KAITI_GB2312;FONT-SIZE:18PX;" >/****
* Query User name * * *
@author
* *
/@Controller @RequestMapping (value = "/ Assetqueryusername ") Public
class Assetqueryusernameaction extends Baseaction {
@Autowired
private Assetqueryusernameservice Assetqueryusernameservice;
/***
* Inquire the name of the asset issuing person
/@RequestMapping (value = "/queryrealname.json", method = {
Requestmethod.get , requestmethod.post})
@ResponseBody public
Object queryrealname (snuser snuser, httpservletrequest request {
list data = (list) assetqueryusernameservice.queryrealname (Snuser,
request);
return data;
}
</span>
Service Layer
<span style= "FONT-FAMILY:KAITI_GB2312;FONT-SIZE:18PX;" > @Service public
class Assetqueryusernameservice extends Baseservice<snuser, string> {
/***
* Query the name of the asset issue * *
@param realname
* @param userid *
@param request
* @return
/Public List Queryrealname (Snuser snuser,
httpservletrequest request) {
String hql = "from Snuser where userlevel= ' 0 '"; c12/>//query User Object
list<snuser> listuser = this.listbyhql (HQL);
Returns the list set return
Listuser
}
}
</span>
Here to use the SPRINGMVC technology, follow-up article will be specific introduction, a simple small function to achieve, try to try, very simple ~