You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Kazuaki Miyauchi <mi...@gmail.com> on 2014/09/24 11:54:35 UTC

How to use index in EL expression?

 Hi, it is also convenient to use the iteration of ELs such as
<c:if test="${!empty param.t${i}vorname}">.
Of course, it doesn't work. But, I'd like to do the following iteration.

<c:forEach var="i" begin="1" end="8">
<sql:update var="insert${i}">
insert into member values (1,?::integer,${i},?,?,?)
  <sql:param value='${param.department}' />
  <sql:param value='${teamid}' />
  <sql:param value="${param.t${i}vorname}" />
  <sql:param value="${param.t${i}name}" />
</sql:update>
</c:forEach>

 Is there some idea for this without whole description expanding i?

Regards,

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


Re: How to use index in EL expression?

Posted by Kazuaki Miyauchi <mi...@gmail.com>.
 Hello Stuart,
> Can you not use i directly as you're already within el? I'm not sure
>why you want to embed the el.
>
>< sql:param value="${paramValues.name[i]}" />

 Because we need to specify i concretely for getting data in above case.


2014-09-25 18:08 GMT+09:00 Stuart Thiel <st...@gmail.com>:
> Hello Kazuaki,
> Can you not use i directly as you're already within el? I'm not sure
> why you want to embed the el.
>
> <sql:param value="${paramValues.name[i]}" />
>
> On Thu, Sep 25, 2014 at 5:03 AM, Kazuaki Miyauchi <mi...@gmail.com> wrote:
>> 2014-09-24 22:53 GMT+09:00 Stuart Thiel <st...@gmail.com>:
>>> I really think something in your domain layer should be parsing your
>>> params and cleanly taking care of this all. You can still provide the
>>> cleaned up POJOS via attributes, and that makes more sense. If you're
>>> entirely skipping regular servlets and allowing direct access to JSP
>>> you can probably use something like
>>>
>>> ${paramValues.key[i]}
>>
>>  Using paramValues, it causes the same problem.
>> EL cannot be nested, so
>>
>> <sql:param value="${paramValues.name[${i}]}" /> cannot be compiled.
>>
>>  I think we need pre-taglibs-taglibs or EL can be nested for resolving this.
>>
>>  Regards.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: taglibs-user-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: taglibs-user-help@tomcat.apache.org
>>
>
>
>
> --
> Stuart Thiel, P. Eng.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: taglibs-user-help@tomcat.apache.org
>

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


Re: How to use index in EL expression?

Posted by Stuart Thiel <st...@gmail.com>.
Hello Kazuaki,
Can you not use i directly as you're already within el? I'm not sure
why you want to embed the el.

<sql:param value="${paramValues.name[i]}" />

On Thu, Sep 25, 2014 at 5:03 AM, Kazuaki Miyauchi <mi...@gmail.com> wrote:
> 2014-09-24 22:53 GMT+09:00 Stuart Thiel <st...@gmail.com>:
>> I really think something in your domain layer should be parsing your
>> params and cleanly taking care of this all. You can still provide the
>> cleaned up POJOS via attributes, and that makes more sense. If you're
>> entirely skipping regular servlets and allowing direct access to JSP
>> you can probably use something like
>>
>> ${paramValues.key[i]}
>
>  Using paramValues, it causes the same problem.
> EL cannot be nested, so
>
> <sql:param value="${paramValues.name[${i}]}" /> cannot be compiled.
>
>  I think we need pre-taglibs-taglibs or EL can be nested for resolving this.
>
>  Regards.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: taglibs-user-help@tomcat.apache.org
>



-- 
Stuart Thiel, P. Eng.

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


Re: How to use index in EL expression?

Posted by Kazuaki Miyauchi <mi...@gmail.com>.
2014-09-24 22:53 GMT+09:00 Stuart Thiel <st...@gmail.com>:
> I really think something in your domain layer should be parsing your
> params and cleanly taking care of this all. You can still provide the
> cleaned up POJOS via attributes, and that makes more sense. If you're
> entirely skipping regular servlets and allowing direct access to JSP
> you can probably use something like
>
> ${paramValues.key[i]}

 Using paramValues, it causes the same problem.
EL cannot be nested, so

<sql:param value="${paramValues.name[${i}]}" /> cannot be compiled.

 I think we need pre-taglibs-taglibs or EL can be nested for resolving this.

 Regards.

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


Re: How to use index in EL expression?

Posted by Stuart Thiel <st...@gmail.com>.
Hello Kazuaki,

Very sorry for the response. I'm teaching this material right now and
assumed this was a student request (I have 70 of them) and only now
noticed that this was on the taglibs mailing list. Again, so sorry.
The "advice" in the prior is still sound, but now very out fo context.
The reasoning is still good.

I really think something in your domain layer should be parsing your
params and cleanly taking care of this all. You can still provide the
cleaned up POJOS via attributes, and that makes more sense. If you're
entirely skipping regular servlets and allowing direct access to JSP
you can probably use something like

${paramValues.key[i]}

On Wed, Sep 24, 2014 at 5:54 AM, Kazuaki Miyauchi <mi...@gmail.com> wrote:
>  Hi, it is also convenient to use the iteration of ELs such as
> <c:if test="${!empty param.t${i}vorname}">.
> Of course, it doesn't work. But, I'd like to do the following iteration.
>
> <c:forEach var="i" begin="1" end="8">
> <sql:update var="insert${i}">
> insert into member values (1,?::integer,${i},?,?,?)
>   <sql:param value='${param.department}' />
>   <sql:param value='${teamid}' />
>   <sql:param value="${param.t${i}vorname}" />
>   <sql:param value="${param.t${i}name}" />
> </sql:update>
> </c:forEach>
>
>  Is there some idea for this without whole description expanding i?
>
> Regards,
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: taglibs-user-help@tomcat.apache.org
>



-- 
Stuart Thiel, P. Eng.

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