Monday, April 21, 2008

Another Session Iteration

<s:if test="#session.cartitems.size > 0"> <table> <s:iterator value="#session.cartitems"> <tr id="row_<s:property value="itemid"/>"> <td> <s:property value="itemName" /> </td> <td> <s:property value="listprice" /> </td> <td> <s:url id="removeUrl" action="removeItemFromCart"> <s:param name="itemid" value="itemid" /> </s:url> <s:a href="%{removeUrl}" theme="ajax" targets="basket">Remove</s:a> <s:a id="a_%{id}" theme="ajax" notifyTopics="/edit">Edit</s:a> </td> </tr> </s:iterator> </table> </s:if>

Tuesday, April 1, 2008

Iterating a List Value Struts2

<s:if test=""> 0"> <s:iterator value="#session.categorys"> <li><a href="<s:url action="itemlisthome.action"><s:param name="catalogid" value="#session.catalogs[catalogid-1].id"> <s:param name="categoryid" value="#session.categorys[id-1].id"> </s:url>"> <s:property value="#session.categorys[id-1].name"> </a> </li> </s:iterator> </s:if><s:if test=""> </s:if>

Struts 2 Tips and Tricks

OGNL treats a character in single-quotes as an actual character, not a String. So this statement will not return your desired result.

<s:if test="%{state=='N'}"> This will work. <s:if test="%{state=='NE'}"> </s:if>

Monday, March 24, 2008

File Count in a Folder

Recently I found a command that displays the Number of files in a ls command listing: Code: ls -l | wc -l Above will find the number of files in a directory, and it will send o/p as pipe to the wc -l, which outputs the number of lines in its input. To display all file including hidden and dot files, try Code: ls -lA | wc -l

Friday, March 14, 2008

Stripping white space

s = s.replaceAll(" +", ""); Here is the String BFI NS-16 after the replace BFINS-16

Thursday, February 21, 2008

cat and grep to omit some unwanted pattern on log file

The app I am debugging is toiled by some crappy domain redirecting output. I was looking for a way clear the catalina out file with some decent message. There is nice tutorial logTail Tutorial tailing the log. For there is a part where pattern omition is there,which worked quite well for me.

cat /usr/local/tomcat/logs/catalina.out | grep -v testing | grep -v url | grep -v
Redirecting This will omit the lines starting with testing Redirecting and url

Monday, February 11, 2008

Trendnet WiFI fiasco

When I moved my home I want to setup the wireless hookup in the new home. I was trying to get into the admin console with admin ip 192.168.1.10. For my surprise i am no way able to get in. After searching for while I found out Linksys router my neighbor have the same ip for its router console. I enabled my wifi connection alone and gone to admin console and renamed the router name. after setting up my wep and all I am still not able to get the wireless traffic comming to my computers. Again fiddling around the admin console I found some reason I am not able to release old DHCP address. This is how i released the DHCP. Swithched off the wireless router unplugged the Ethernet. Switched off the cable modem even the power, waited for 10 min. Plugged in the Cable modem powered the modem,waited for all the lights to come in, after three minutes plugged in the Router and powered in the router. At this point connected my router profile on the computer. Aha.. at last I am able to get the wifi. cool.