Le Jeudi 6 Novembre 2003 12:56, [EMAIL PROTECTED] a �crit : > Quoting Charles-Alexandre Sabourdin <[EMAIL PROTECTED]>: > > I have gone quickly through it :( and I am not confortable with the new > notation you mention but I hope their might be a simpler solution then > building a tag library ;) > > > I tryied to find answers form forum and within the archive but I never > > had answer so here is my probleme : > > > > I am trying to do a developpement in JSP1.2 (XML) instead of JSP1.1 > > using > > > > tag %=% and %% instead of <%=..%> et <%..%> > > I would like to change the style of div with an iteration: > > Mycode is the following > > <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2" > > xmlns:tiles="/WEB-INF/struts-tiles.tld" > > xmlns:bean="/WEB-INF/struts-bean.tld" > > xmlns:html="/WEB-INF/struts-html.tld" > > xmlns:logic="/WEB-INF/struts-logic.tld" > > > > <jsp:scriptlet> > > java.util.List l = > > com.imko.schemnet.anomalie.db.AnomaliePeer.doSelectAllOrdered(); > > //java.util.List l = new java.util.Vector(); > > pageContext.setAttribute("lstAnomalie",l); > > boolean grey = true; > > String classUsed="anomalieGrey"; > > </jsp:scriptlet> > > > > <div class="anomalieGen"> > > <jsp:expression> > > classUsed > > </jsp:expression> > > > > <logic:iterate id="ano" name="lstAnomalie"> > > <div class="%=classUsed%"><!-- the probleme lay here --> > > <bean:define id="cat" name="ano" property="idCategorie"/> > > <jsp:scriptlet> > > if(grey){ > > classUsed="\"anomalieGrey\""; > > grey = false; > > }else{ > > grey = true; > > classUsed="\"anomalieWhite\""; > > } > > </jsp:scriptlet> > > ... > > </div> > > </logic:iterate> > > </div> > > </jsp:root> > > Reference (http://java.sun.com/products/jsp/syntax/1.2/syntaxref12.html) > > says > > > > to remplace <%=%> par %=% . > > but it only work with taglig > > > > <html:img class="%=classUsed%"> works but > > Hereabove you are in a taglib attribute while hereafter you deal with > "plain text" html markup. > > > <div class="%=classUsed%">-- does not. > > So you might simply do something like > <div class='<bean:write name="%=classUsed%" />' > This does not works because The value of attribute "class" must not contain the '<' character.'
> By the way I guess by class attribute in <html:img > tag you meant > styleClass ? yes, that was only a test base on setting a variable attribut from a bean) > My two cents, Patrick > this Works but this is cheessy <![CDATA[<div class="]]><jsp:expression>classUsed</jsp:expression><![CDATA[">]]> div tag body <![CDATA[</div>]]> -- Charles-Alexandre SABOURDIN ----------------- 01.46.90.64.90 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
