Struts2.3 dojo autocompleter onChange を呼び出し、jquery ajax を使用して autocompleter 値に従ってテキスト フィールドを更新しています。オートコンプリータの入力値がデータベースにない場合、アクションを呼び出して、最初にそのアイテムをデータベースに追加します。
私のJavaScriptコード:-
dojo.event.topic.subscribe("/value", function(value, key, text, widget){
var itemcode=value; 
var data = {itemID:itemcode,itemDes:''};          
$.post("jsondefault/callAJax.action", data, function(data, textStatus) {
    if(data.itemDes.length===0){
    alert("Ihis item is not saved please save it first."); 
    window.location = "/actionName.action";
    }else{
        $('#itdes').val(data.itemDes);
    }
}, "json");
});
jsp コード:-
<div class="pull-left " style="width: 48%;">
<label id="item1">Item Code<br></label>
<s:url id="itemList" action="/jsondefault/createCoupon2" method="getItems" />               
<sx:autocompleter id="itemC" href="%{itemList}" forceValidOption="true" size="24"              
name="item" autoComplete="false" showDownArrow="false" valueNotifyTopics="/value">
</sx:autocompleter>
</div> <div class="pull-right " style="width: 48%;"> 
<label id="itdes1">Item Description</label>
<input type="text" placeholder="Item Description" id="itdes">
</div>