JMS taglib ver. 1.2

    Custom JSP taglib. Lets you deploy JMS service in your JSP pages.

For example:
 


<%@ taglib uri="taglib.tld" prefix="jms" %>

<jms:sendMessage queue="jms/Queue" queueConnectionFactory="jms/QueueConnectionFactory">
   <jms:textMessage>Hello from JSP</jms:textMessage>
</jms:sendMessage>

Tags are:

sendMessage

Body tag. Sends JMS message defined in the body. Parameters are:

1) topic JNDI name for topic
2) topicConnectionFactory JNDI name for TopicConnectionFactory
3) queue JNDI name for queue
4) queueConnectionFactory JNDI name for QueueConnectionFactory
5) context Context Id (see JNDI taglib)
6) contextScope scope for Context Id. Possible values are page, request, session or application. Defines scope for created variable. Default value is page.
7) topicId result of lookup for topic (see JNDI taglib)
8) topicScope scope for topicId. Possible values are page, request, session or application. Defines scope for created variable. Default value is page.
9) queueId result of lookup for queue (see JNDI taglib)
10) queueScope scope for queueId. Possible values are page, request, session or application. Defines scope for created variable. Default value is page.
11) topicConnectionFactoryId result of lookup for TopicConnectionFactory (see JNDI taglib)
12) topicConnectionFactoryScope scope for TopicConnectionFactory. Possible values are page, request, session or application. Defines scope for created variable. Default value is page.
13) queueConnectionFactoryId result of lookup for QueueConnectionFactory (see JNDI taglib)
14) queueConnectionFactoryScope scope for QueueConnectionFactory. Possible values are page, request, session or application. Defines scope for created variable. Default value is page.

Let us see more example. You may use JNDI names for queue (or topic) and QueueConnectionFactory (or TopicConnectionFactory) - see code piece above. Or you may deploy JNDI taglib and use results for Context and lookup tag:
 


<%@ taglib uri="jms-taglib.tld" prefix="jms" %>
<%@ taglib uri="jndi-taglib.tld" prefix="jndi" %>

<jndi:Context id="ctx">
  <jndi:setProperty name="java.naming.factory.initial">com.evermind.server.ApplicationClientInitialContextFactory</jndi:setProperty>
  <jndi:setProperty name="java.naming.security.principal">admin</jndi:setProperty>
</jndi:Context>

<jms:sendMessage context="ctx" queue="jms/Queue" queueConnectionFactory="jms/QueueConnectionFactory">
   <jms:textMessage>Hello from JSP</jms:textMessage>
</jms:sendMessage>

or
 


<jndi:Context id="ctx"/>
<jndi:lookup contextId="ctx" id="MyQueue" scope="session" name="jms/Queue"/>

<jms:sendMessage context="ctx" queueId="MyQueue" queueScope="session" queueConnectionFactory="jms/QueueConnectionFactory">
   <jms:textMessage>Hello from JSP</jms:textMessage>
</jms:sendMessage>

textMessage

Body tag. Produces text message. Parameters are: none

bytesMessage

Body tag. Produces bytes message. Parameters are: none

for downloading:

Library: jmstag.jar    Description: taglib.tld

© Coldbeans      Comments?

See also Coldtags suite - the largest collection of custom JSP tags.