Wednesday, May 31, 2006

Struts Tips - Multi select list box "deselect all" problem

Problem
De-selecting all items from the multi select list box does not update the action form. Action form will still have the values pertaining to the previous selection.

Cause
When no items are selected from the list box, no data is sent for the parameter.

Solution
Add the below check in the action class:-

if (request.getParamter("list box name") == null) {
form.set(new String[]{});
}


This will clear the values of the earlier selection from the list box property

Saturday, April 01, 2006

JMS

Though I have used MQ Series in all the projects I have worked so far, i never got a chance to write a messaging program from scratch. Opportunity came when my ex-project mate requested me to take a training on JMS for his team members.

I started searching google for sample code that might help me write a simple "put" , "get" program, finally got one from Sun itself.

Assumptions
You are expected to have some basic understanding of messaging concepts.

H/W and S/W
This uses IBM MQ Series and the middleware, and tomcat servlet container.

What the program does




As shown above, this sample application has a text box where user can type something and on clicking "put" button, message will be send to a queue.

Clicking on "get" button will retrieve the first message in the queue and the message will be shown in the text box.

Logic for putting the message into queue