<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>techtamasha.com &#187; Struts</title>
	<atom:link href="http://www.techtamasha.com/category/struts/feed" rel="self" type="application/rss+xml" />
	<link>http://www.techtamasha.com</link>
	<description>a new play everyday</description>
	<lastBuildDate>Sat, 22 May 2010 11:49:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Generate dynamic id&#8217;s for struts html tags</title>
		<link>http://www.techtamasha.com/generate-dynamic-ids-for-struts-html-tags/72</link>
		<comments>http://www.techtamasha.com/generate-dynamic-ids-for-struts-html-tags/72#comments</comments>
		<pubDate>Tue, 23 Sep 2008 05:18:29 +0000</pubDate>
		<dc:creator>Nischal Shetty</dc:creator>
				<category><![CDATA[Struts]]></category>
		<category><![CDATA[dynamic style id struts tag]]></category>
		<category><![CDATA[generate id using scriptlet struts tag]]></category>
		<category><![CDATA[scriptlets in struts tag]]></category>
		<category><![CDATA[struts html generate dynamic id]]></category>
		<category><![CDATA[struts html tag dynamic style id]]></category>

		<guid isPermaLink="false">http://techtamasha.com/?p=72</guid>
		<description><![CDATA[Do you use struts tags to generate html content? If yes, then sooner or later you&#8217;ll come across a scenario where you would generate html elements with the same name but would need different id&#8217;s for each element. I faced a similar predicament recently. I had no other option but to use scriptlets to generate [...]]]></description>
			<content:encoded><![CDATA[<p>Do you use struts tags to generate html content? If yes, then sooner or later you&#8217;ll come across a scenario where you would generate html elements with the same name but would need different id&#8217;s for each element. I faced a similar predicament recently. I had no other option but to use scriptlets to generate id&#8217;s for the html elements. However, I soon found out using scriptlets within the struts html tags isn&#8217;t really straight forward.</p>
<p>Here&#8217;s the code I tried in my first attempt:</p>
<p><span style="color: #339966;">&lt;%int i=0;%&gt;</span></p>
<p><span style="color: #339966;">//iteration logic here</span></p>
<p><span style="color: #339966;">&lt;html:text property=&#8221;example&#8221; styleid=&#8221;example&lt;%=i%&gt;&#8221;&gt;</span></p>
<p>Well, if you write the code as shown above, the html code generated would be :</p>
<p><span style="color: #339966;">&lt;input type=&#8221;text&#8221; name=&#8221;example&#8221; id = &#8220;example&lt;%=i%&gt;&#8221;&gt;</span></p>
<p>and not</p>
<p><span style="color: #339966;">&lt;input type=&#8221;text&#8221; name=&#8221;example&#8221; id=&#8221;example0&#8243;&gt;</span></p>
<p>To get the expected result, i.e. for the scriptlet to work inside the struts html tag, write as below:</p>
<p><span style="color: #339966;">&lt;html:text property=&#8221;example&#8221; styleid=&#8217;&lt;%=&#8221;example&#8221;+i%&gt;&#8217;</span></p>
<p>That&#8217;s it. If any of you ever find out a way to generate different id&#8217;s for html elements with the same name using strtus tags exclusively then do let me know <img src='http://www.techtamasha.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.techtamasha.com/generate-dynamic-ids-for-struts-html-tags/72/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
