I had an attack of the stupids. I was wrapping a form served by a different server into a portlet and passing what it had been sent back. It had about 15 arguments and I had dutifully created one argument in my portlet for each thing that could be sent. Most of these were <input type=”image”> tags, which send an X and Y co-ordinate of where the image was clicked, but only if the image was clicked.

I was faced with going through all of these by hand and if one of them was set, that was the one to send to the remote machine.

Now, to pass things around Portal they need to be page parameters also. This meant I was faced with creating 15 page parameters to get the portlet working.

Then, to add to the fun, Portal won’t let you create page parameters of the form userClick.x; it doesn’t like the ‘.’ in the name.

Aha, says I, I will create a redirect servlet that will transliterate userClick.x (and the other pile of arguments) into userClickX and then send it back. Fortunately there are methods that will allow you to generate a URL to do a callback like this.

Then in the portlet, if the argument was set, translate it back again so I can call out to the external server.


This was my attack of the stupids. Looking at things like they are significant when they’re not. What was significant was the URL being sent to the back-end map server, which the browser had aldready constructed for me.

Instead all I needed to do was send the two housekeeping variables back (cookies and some portal-specific things) and a new variable called mapParams, which it constructed from looping through the parameters and ignoring the ones I wanted to send back in their own right. This was then escaped using the URL encode and placed in the variable.

Back in the portlet, just append this to the string to go to the back-end and off y’go.

So, 15 arguments and a lot of repeated code down to 3. Just make sure you are looking at the right problem.

Back to writing functional specs, can’t have fun all day.