Hi I have the followig code:
page1.jsp The ajax function called on click of button
function ajaxFunction()
{
var xmlHttp;
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
alert("Data loaded");
}
}
xmlHttp.open("GET","page2.jsp",true);
xmlHttp.send(null);
}
page2.jsp
<%@ page import="javax.jms.*" %>
<%!
private QPublisher qPublisher = null;
public class QPublisher {
private TopicPublisher publisher = null;
private TopicSession session = null;
public void configPublisher(){
TopicConnectionFactory factory = null;
TopicConnection connection = null;
try {
factory = new com.tibco.tibjms.TibjmsTopicConnectionFactory("tcp");
connection = factory.createTopicConnection("user","pwd");
session = connection.createTopicSession(false,javax.jms.Session.AUTO_ACKNOWLEDGE);
javax.jms.Topic topic = session.createTopic("topic1");
publisher = session.createPublisher(topic);
}
}
public void publish(String msg)
{
javax.jms.TextMessage message = session.createTextMessage();
message.setText(msg);
publisher.publish(message);
}
}
public void jspInit(){
qPublisher = new QPublisher();
qPublisher.configPublisher();
}
%>
<%
qPublisher.publish("This is a test for TT");
%>
If I call page2.jsp without using ajax, i.e from page1.jsp using
<form action="page2.jsp">
the message is picked by the subsciber and displayed.
but not by making an ajax..
I have basic idea of ajax, so please guide what am i missing?