You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael Cheung <vi...@justware.co.jp> on 2006/08/13 14:34:37 UTC

some question, please help me.

Hi, everyone;

I am new to struts. Need someone help me.

Version:Struts 1.2.9, jsp 2.4, tomcat,5.0.28
Question about: struts-el, c.tld

in c.tld, not c-rt.tld

1.Document said, difference between el and standard is rtexpression.
${xxx} is supportted in EL tags, but in standard tags, ${xxx} give me the 
correct answer, and <%=xx%> give me error. Why?

2.Document said logic:equal is not implete as c:if can do the same thing,
but <logic:equal name="a" value="1">
can be rewritten in <c:if>, as test attribute can't be rtexpression.

3.c:forEach not support array?
in Action
request.setAttribute("a",a); //String[] a; with two item

in jsp
<c:forEach items="a" varStatus="i">
${a[i.index]}
</c:forEach>
only loop once, and give me the first value

the following code ,give me two line, but I can't get the end tag dynamically.
<c:forEach begin="0" end="1" varStatus="i">
${a[i.index]}
</c:forEach>

4.c:if test is not do the job. the following code
<c:forEach items="a" varStatus="i">
${i.first?"Y":"N"}
<c:if test="i.first">"Y"</c:if>
</c:forEach>
${i.first?"Y":"N"} give me the correct result, but
<c:if test="i.first">"Y"</c:if> not.
where is the mistake?

5.It seems, via pageContext findAttribute and setAttribute, we can pass value
from/to EL, I am not tested, is this the right way to resolve problem? I mean
as rtexpression can't be used in these tags, we first do some calcute, then set
the result to el, and use it in tags.

6.c-rt is not work for me!
change c.tld to c-rt.tld, access the page, tomcat didn't give me the answer,
just wait, and without error.

Thanks a lot.

Regards;
Michael


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


Re[2]: some question, please help me.

Posted by Michael Cheung <vi...@justware.co.jp>.
Hi,

Thanks for your help.
I am using the c.tld from struts-el.
and it give me the following error message:
[According to TLD or attribute directive in tag file, attribute items does not accept any expressions]

when I change to c-rt.tld, same as c.tld from struts-el, it works as you said.

Then what is the c.tld for? Should I always use c-rt.tld?
Is there any detail document for c.tld and c-rt.tld?

Thanks a lot.

Regards;
Michael


On Sun, 13 Aug 2006 10:57:20 -0400
"Martin Gainty" <mg...@hotmail.com> wrote:

> Good Morning Michael--
> 
> If I understand your question correctly the expression needs to be enclosed in ${} as in this example from Ted Husted
> -      <c:choose>
> -       <c:when test="${not empty jcookie}">
> -        <%-- The functionality of "logic:match" will eventually be available
> -				 through a string function in the EL expression. --%>
> -        <logic-el:match expr="${jcookie}" value="0">
> -         match
> -        </logic-el:match>
> -        <logic-el:notMatch expr="${jcookie}" value="0">
> -         notMatch
> -        </logic-el:notMatch>
> -       </c:when>
> -       <c:otherwise>
> -        missing
> -       </c:otherwise>
> -      </c:choose>
> (link available @)
> http://mail-archives.apache.org/mod_mbox/struts-dev/200602.mbox/%3C20060210182748.63861.qmail@minotaur.apache.org%3E
> 
> Anyone else?
> Martin --
> 
> 
> 
> > Hi, everyone;
> > 
> > I am new to struts. Need someone help me.
> > 
> > Version:Struts 1.2.9, jsp 2.4, tomcat,5.0.28
> > Question about: struts-el, c.tld
> > 
> > in c.tld, not c-rt.tld
> > 
> > 1.Document said, difference between el and standard is rtexpression.
> > ${xxx} is supportted in EL tags, but in standard tags, ${xxx} give me the 
> > correct answer, and <%=xx%> give me error. Why?
> > 
> > 2.Document said logic:equal is not implete as c:if can do the same thing,
> > but <logic:equal name="a" value="1">
> > can be rewritten in <c:if>, as test attribute can't be rtexpression.
> > 
> > 3.c:forEach not support array?
> > in Action
> > request.setAttribute("a",a); //String[] a; with two item
> > 
> > in jsp
> > <c:forEach items="a" varStatus="i">
> > ${a[i.index]}
> > </c:forEach>
> > only loop once, and give me the first value
> > 
> > the following code ,give me two line, but I can't get the end tag dynamically.
> > <c:forEach begin="0" end="1" varStatus="i">
> > ${a[i.index]}
> > </c:forEach>
> > 
> > 4.c:if test is not do the job. the following code
> > <c:forEach items="a" varStatus="i">
> > ${i.first?"Y":"N"}
> > <c:if test="i.first">"Y"</c:if>
> > </c:forEach>
> > ${i.first?"Y":"N"} give me the correct result, but
> > <c:if test="i.first">"Y"</c:if> not.
> > where is the mistake?
> > 
> > 5.It seems, via pageContext findAttribute and setAttribute, we can pass value
> > from/to EL, I am not tested, is this the right way to resolve problem? I mean
> > as rtexpression can't be used in these tags, we first do some calcute, then set
> > the result to el, and use it in tags.
> > 
> > 6.c-rt is not work for me!
> > change c.tld to c-rt.tld, access the page, tomcat didn't give me the answer,
> > just wait, and without error.
> > 
> > Thanks a lot.
> > 
> > Regards;
> > Michael
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> > 
> >


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


Re: some question, please help me.

Posted by Martin Gainty <mg...@hotmail.com>.
Good Morning Michael--

If I understand your question correctly the expression needs to be enclosed in ${} as in this example from Ted Husted
-      <c:choose>
-       <c:when test="${not empty jcookie}">
-        <%-- The functionality of "logic:match" will eventually be available
-				 through a string function in the EL expression. --%>
-        <logic-el:match expr="${jcookie}" value="0">
-         match
-        </logic-el:match>
-        <logic-el:notMatch expr="${jcookie}" value="0">
-         notMatch
-        </logic-el:notMatch>
-       </c:when>
-       <c:otherwise>
-        missing
-       </c:otherwise>
-      </c:choose>
(link available @)
http://mail-archives.apache.org/mod_mbox/struts-dev/200602.mbox/%3C20060210182748.63861.qmail@minotaur.apache.org%3E

Anyone else?
Martin --



> Hi, everyone;
> 
> I am new to struts. Need someone help me.
> 
> Version:Struts 1.2.9, jsp 2.4, tomcat,5.0.28
> Question about: struts-el, c.tld
> 
> in c.tld, not c-rt.tld
> 
> 1.Document said, difference between el and standard is rtexpression.
> ${xxx} is supportted in EL tags, but in standard tags, ${xxx} give me the 
> correct answer, and <%=xx%> give me error. Why?
> 
> 2.Document said logic:equal is not implete as c:if can do the same thing,
> but <logic:equal name="a" value="1">
> can be rewritten in <c:if>, as test attribute can't be rtexpression.
> 
> 3.c:forEach not support array?
> in Action
> request.setAttribute("a",a); //String[] a; with two item
> 
> in jsp
> <c:forEach items="a" varStatus="i">
> ${a[i.index]}
> </c:forEach>
> only loop once, and give me the first value
> 
> the following code ,give me two line, but I can't get the end tag dynamically.
> <c:forEach begin="0" end="1" varStatus="i">
> ${a[i.index]}
> </c:forEach>
> 
> 4.c:if test is not do the job. the following code
> <c:forEach items="a" varStatus="i">
> ${i.first?"Y":"N"}
> <c:if test="i.first">"Y"</c:if>
> </c:forEach>
> ${i.first?"Y":"N"} give me the correct result, but
> <c:if test="i.first">"Y"</c:if> not.
> where is the mistake?
> 
> 5.It seems, via pageContext findAttribute and setAttribute, we can pass value
> from/to EL, I am not tested, is this the right way to resolve problem? I mean
> as rtexpression can't be used in these tags, we first do some calcute, then set
> the result to el, and use it in tags.
> 
> 6.c-rt is not work for me!
> change c.tld to c-rt.tld, access the page, tomcat didn't give me the answer,
> just wait, and without error.
> 
> Thanks a lot.
> 
> Regards;
> Michael
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>