javascript - Display messages in JSP, When java bean class get affected? -
please don't hesitate edit question , if not clear.
currently have situation when server
sends response
,i need reflect message in jsp
when bean class
changes.
my bean class be,
public class information { public linkedlist<string> information = null ; public linkedlist<string> getinformation() { return information; } public void setinformation(linkedlist<string> information) { this.information = information; system.out.println("list : "+this.information); } }
my thread
running affect bean class , when response server
class producer extends thread{ linkedlist<string>() list = new linkedlist<string>(); information info = new information(); public void run() { if(connectionprotocol.protocol != null){ try { response = connectionprotocol.protocol.receive(); if(response != null){ system.out.println("listener response : \n"+response+"\n"); list.add("eventlinkeventlinkconnected event received.."); info.setinformation(list); } } } } }
i need display information in jsp when bean class affected or modified.
also aware of ajax , used situation every 5 sec accessing bean.i getting null if there no message in bean.and every thing works fine.
my ajax be,
function pingaction(){ $.ajax( { type: "post", url: "pingaction", async: true, data : "userid="+encodeuricomponent(userid)+"&securekey="+encodeuricomponent(securekey)+"&sid="+math.random() , cache:false, contenttype: "application/x-www-form-urlencoded; charset=utf-8", scriptcharset: "utf-8" , datatype: "html", error: function (xhr, ajaxoptions, thrownerror) { //alert("status :"+xhr.status+"\nthrownerror : "+thrownerror+"\nresponsetext : "+xhr.responsetext); xhr.abort(); }, success: function( responsedata , status){ //alert("pingaction response data : "+ responsedata +"\nstatus : "+status); if(responsedata != "null" && responsedata.length != 0 && responsedata != null){ //process view response in jsp } } , complete:function(){ timer = settimeout(pingaction, 5000); } } ); }
but there empty response coming when server didn't send message added in list.because calling pingaction()
function every 5 sec.
good answers appreciated.
Comments
Post a Comment