You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Srini Pillai <SP...@MAIL.NYSED.GOV> on 2005/12/19 16:13:53 UTC
using c:out with EL replacing bean:write
Hi all,
I know this is more of a JSTL question but it would be really helpful
if anyone could help me understand the usage of c:out with Expression
Language (EL) which replaces the <bean:write />.
I believe Struts did not implement EL for <bean:write /> tag and few
others and suggests using <c:out /> instead.
I have a situation where I require to use dymanic textboxes based on
the certain criteria. To make this work I used LazyValidatorActionForm.
It works like a charm but when I want to write out certain form property
using EL, it doesn't work well. I am not sure how to use it with <c:out
/>. For example:
This is the code I tried to display a link with a value in the dynamic
form:
<c:forEach var="counter" begin="0" end="${numTextFields}" >
.....
<a href="<html-el:rewrite
page="/FAEditor.do"/>?methodToCall=removeElement&id=<c:out
value="${request['FAEditorForm'].id_${counter}}" />">Remove</a>
.....
</c:forEach>
Here, I am trying to get the Form from the request attribute and invoke
the method for property 'id_?' where '?' can be some number depending on
the counter in the loop. When executing this page, I am getting an
exception:
javax.servlet.jsp.JspException: Can't insert page
'/pages/findingaids/FACustomContainerEditor.jsp' :
javax.servlet.jsp.JspException: The taglib validator rejected the page:
"tag = 'out' / attribute = 'value': An error occurred while parsing
custom action attribute "value" with value
"${request['FAEditorForm'].id_${counter}}": Encountered "{", expected
one of ["}", ".", ">", "gt", "<", "lt", "==", "eq", "<=", "le", ">=",
"ge", "!=", "ne", "[", "+", "-", "*", "/", "div", "%", "mod", "and",
"&&", "or", "||"], "
I also tried using <c:set /> but looks like the JSTL tags does not
allow more than one '{' inside an attribute. Not sure how to solve this
issue. Any help is appreciated.
Thanks,
Srini
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: using c:out with EL replacing bean:write
Posted by Rick Reumann <ri...@gmail.com>.
On 12/19/05, Srini Pillai <SP...@mail.nysed.gov> wrote:
>
>
> This is the code I tried to display a link with a value in the dynamic
> form:
>
> <c:forEach var="counter" begin="0" end="${numTextFields}" >
> .....
> <a href="<html-el:rewrite
> page="/FAEditor.do"/>?methodToCall=removeElement&id=<c:out
> value="${request['FAEditorForm'].id_${counter}}" />">Remove</a>
> .....
> </c:forEach>
struts tags (from what I remember) I don't believe mix that well when used
within standard html tags.
I think it'll look cleaner anyway using the c:url tag:
<c:url var="url" value="FAEditor.do">
<c:param name="methodToCall" value="removeElement"/>
<c:param name="id" value="${counter}"/>
</c:url>
<a href="${url}">Remove</a>
I'm not sure what you are attempting to do with:
value="${request['FAEditorForm
>
> '].id_${counter}}"
but I doubt you need that . You just probably need the id from the
counter, if not you'll have to explain why not and I could try to help.
--
Rick