struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Albrecht Leiprecht" <aleipre...@t-online.de>
Subject RE: Conditionally show values in Tile (c:when?)
Date Thu, 11 Aug 2005 14:16:06 GMT

>>  <%=errmsg.toString().length()%>
>>  <%--correctly prints the expected value--%>

>I believe the scriptlet is evaluated at runtime(server-side). Is it 
>possible you have a bean property holding this: errmsg 'expected value'
>?

Naa... I intentionally used a name I could be sure is not used anywhere else

>> <tiles:useAttribute id="errmsg" name="FieldError" scope="page"/>

>However the JSTL is explicitly directed to Page-scope for this. See a 
>problem?

Well, requestscope would be a problem, as soon as I get more than one
instances of the same tile for that request...

>To address your previos question, I believe Tiles does not impose any 
>limitation on your JSTL.

There must be something... I have replaced the c:when/otherwise construct
with a java if/else substitute like that:

<%
	if (errmsg.toString().length() > 1) {
%>
	<font color="#FF0000">
		<tiles:getAsString name="FieldError"/>
	</font>
<%		
	} else {
%>
	<img src="/img/blank.gif" border=1 height="1" width="111">

<%		
	}
%>	

Voila...works as expected ...

BTW: c:when test="${true}"> doesn't work either (just checked)

Rgds
albi



-----Original Message-----
From: Albrecht Leiprecht [mailto:aleiprecht@t-online.de]
Sent: Thursday, August 11, 2005 8:34 AM
To: 'Struts Users Mailing List'; albi@leiprecht.de
Subject: RE: Conditionally show values in Tile (c:when?)

Let me rephrase the question ....

Is there any limitation on using JSTL in Tiles ???

Rgs
albi

-----Original Message-----
From: Albrecht Leiprecht [mailto:aleiprecht@t-online.de]
Sent: Thursday, August 11, 2005 3:28 PM
To: 'Struts Users Mailing List'
Subject: Conditionally show values in Tile (c:when?)

Hi all,

I have a tile that shows my default input row in a form. In case that I put
a value in FieldError, I want it to show it the errorMessage in red color.
So far so good. The values get to the tile (formRow)... and there it's
getting somewhat tricky. After reading a number of explanations, I
understands that struts.apache.org recommends to use JSTL whenever
possible... thus I use the c:when/c:otherwise construct like follows

<tiles:useAttribute id="errmsg" name="FieldError" scope="page"/>

<td>
  <%=errmsg.toString().length()%>
  <%--correctly prints the expected value--%>
        
  <c:choose>
    <c:when test="${errmsg.toString().length() > 0}">
	<font color="#FF0000">
	  <tiles:getAsString name="FieldError"/>
	</font>
    </c:when>
    <c:otherwise>
	<img src="/img/blank.gif" height="1" width="111">
  	<%--unexpectedly always shows this--%>
    </c:otherwise>
  </c:choose>
</td>

Substitutes using logic:greaterThat are showing the same strange behavior...
Any Idea why this happens ? Any Tutorials, I could look up ?

TIA,
albi



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message