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%" />' >

By the way I guess by class attribute in <html:img > tag you meant styleClass ?

My two cents, Patrick

> Those are my tries :
> <div class="<%=classUsed%>">-- The value of attribute "class" must not
> contain
> the '<' character.'
> <div class=%=classUsed%> -- Open quote is expected for attribute "class|".'
> --> here might be a solution
> My only solution so far woulf be to create my own taglib.
> 
> But it don't seams right.
> -- 
> Charles-Alexandre
> SABOURDIN
> -----------------
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to