Posts

Showing posts from March, 2010

HTML code parsing and truncation

Many a times we run in to situations where we need to parse the HTML response text and truncate it. Truncation might be situational and needs might be different in every case. All we want is that when the HTML text is truncated, markup/HTML tags should be properly closed, else it will distort the UI. Below is the sample code which parses a given HTML text and truncates it based on the provided limit. While calculating the length of truncated text, length of markup/HTML tags will not be considered because those tags will not take space on UI/Web page (HTML tags are rendering tags). For example you have following HTML text: <html> <body> <span>This is sample text, and I want to <b>truncate</b> it, can you please help me! </body> </html> and you want to truncate it, so that the length of text displayed on HTML page should be 50, but you don't want length of HTML tags to be considered while calculating truncated text length. In this sit

Something intresting for Spring and Flex Lovers

Flex is emerging as a powerful user interface technology and now we have one more gift from spring source to for flex lovers. Spring now provides set of library and configurations which we can use to directly integrate Flex and spring. Now we can access spring beans directly from Flex application on fly. We don't need to go through complex configuration of BlazeDS , just define beans and expose them with special tags so that Flex application can use it. Belwo are few links for interested friends: http://coenraets.org/blog/flex-spring http://www.springsource.org/spring-flex Right now I am evaluating it and so far this looks very promising. I'll try to post a small sample application which might be helpful.... Enjoy your development on Flex with Spring... Thanks -- Surya