Friday, February 22, 2008

surprising experience with Struts2

The action class has a Dto, which contains a Map<String, String> object. I want to 'put' an entry into it from the UI layer /jsp. or in otherwords... i will say <s:textfield name="['xyz']" /> and say the user enters 123 into the text field then it will result into an entry: ["xyz","123"]. Till here things are fine but in one case this wouldn't work...!!! Its a catch.

suppose the dto is enclosed in session scope then the same would result into ["xyz",""] i.e. null string. I found that this is never getting updated and when i removed the dto from the session scope then it gave ["xyz","123"] result. so whats the session scope doing here?

i tried thisway in the jsp:
<s: textfield name="['xyz']" />
<s:property value="" />

this resulted a textbox and a text: [xyz,''] thats the catch: i.e. when the jsp is being rendered itself the map is being put with key xyz if its not present in the map. and for this reson the text [xyz,] is being printed... supposing that this is not the case then it would have rendered a text as [,] i.e. empty map.

for this reason when the textbox is trying to put the value into the map, as the key is already present its unable to do so...

To discover this it took me 2 days of effort.. may b it saves some of ur efforts and stops u from reinventing the wheel...

thats for now.. watch the space for more interesting things to come up...

Monday, February 18, 2008

bank details,

i was searching the net to get the customer care number of UTI and found this site valuable in getting the banks number... :

probably someone is also looking for it... its simple googling that gave me this url.. ;)