|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
MQ JSP output |
« View previous topic :: View next topic » |
Author |
Message
|
mq_spyder |
Posted: Mon Apr 03, 2006 2:58 pm Post subject: MQ JSP output |
|
|
Newbie
Joined: 20 Sep 2005 Posts: 6 Location: Atlanta, USA
|
Hello all,
I have written a small JSP to accept values 'Name' and 'Zip' and put them on a queue after concatinating. It works perfectly fine but everytime 2 extra (junk like) characters get added to the beginning of the string. I am running WMQ v6.0 on Win XP.
Can somebody help me?
Thanks
jsp code
Code: |
<%@ page language="java" import="java.util.*,java.io.*,java.net.*,java.sql.*,com.ibm.mq.*" %>
<%@ page contentType="text/html" %>
<%
String temp=request.getParameter("Enter");
String userName=request.getParameter("userName").trim();
String zipCode=request.getParameter("zipCode").trim();
String data=userName+","+zipCode;
String qManager = "AAA"; // Queue Manger Name
MQQueueManager qMgr;
String myHost = "111.11.11.11"; // Host Name
int myPort = 1414; //Port number
String myChannel = "SYSTEM.ADMIN.SVRCONN"; // Server Connection channel name
MQEnvironment.port=myPort;
MQEnvironment.hostname=myHost;
MQEnvironment.channel=myChannel;
MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,MQC.TRANSPORT_MQSERIES);
MQException.log=null;
qMgr = new MQQueueManager(qManager);
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT ;
MQQueue queueName = qMgr.accessQueue("BBB",openOptions); //Enter your queue name
MQMessage MQ_Message = new MQMessage();
MQ_Message.writeUTF(data);
MQPutMessageOptions pmo = new MQPutMessageOptions();
queueName.put(MQ_Message,pmo);
queueName.close();
qMgr.disconnect();
out.println("<h3>SSN Search Request has been sent ...</h3>");
%>
|
html code
Code: |
<html>
<script language="JavaScript" type="text/javascript">
function checkform()
{
flag=true;
if (document.mqForm.userName.value == "")
{
alert( "userName should not be empty." );
mqForm.userName.focus();
flag=false;
return flag ;
}
if (document.mqForm.zipCode.value == "")
{
alert( "zipCode should not be empty." );
mqForm.zipCode.focus();
flag=false;
return flag ;
}
if(flag)
{
return true ;
}
}
</script>
</head>
<form name="mqForm" action="mqPut.jsp" onsubmit="return checkform();">
<BR><BR><BR><BR><BR>
<TABLE border="0" ALIGN="CENTER" >
<TR ALIGN="LEFT"><TH>Enter Name<TD><input type="text" name="userName" maxlength="15" >
<TR ALIGN="LEFT"><TH>Enter Zip Code<TD><input type="text" name="zipCode" maxlength="5" >
</TABLE>
<CENTER><BR><input type="submit" value="Submit"></CENTER>
</form>
</html> |
|
|
Back to top |
|
 |
wschutz |
Posted: Mon Apr 03, 2006 3:37 pm Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
The "junk" is the UTF length. Try writeBytes() instead of writeUTF() _________________ -wayne |
|
Back to top |
|
 |
mq_spyder |
Posted: Mon Apr 03, 2006 7:50 pm Post subject: |
|
|
Newbie
Joined: 20 Sep 2005 Posts: 6 Location: Atlanta, USA
|
That worked like a charm. Thank you very much, Wayne. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|