tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kazuaki Miyauchi <>
Subject Re: How to cast String to int in EL?
Date Tue, 20 Aug 2019 05:07:00 GMT
 Hi, Stuart

2019-08-19 20:32 GMT+09:00, Stuart Thiel <>:
> I can't speak to Tomcat 5, that's been years. However, the code you're
> using is not passing an integer. If you take a look at the generated
> Java source (which is a mess with taglibs) you may see why. Once more,
> a quick google suggests some solutions, in particular, the trivial
> one: <sql:param value="${1}"/>

 Following source works correctly, of course.

<c:set var="member_id" value="1"/>
<% int member_id = (int)session.getAttribute("member_id");
   session.setAttribute("member_id_num", member_id); %>
<sql:setDataSource dataSource="jdbc/kome" var="kome"/>
<sql:update var="stmt" dataSource="${kome}">
 insert into test values(?,?)
 <sql:param value="${member_id_num}"/>
 <sql:param value="Miyauchi"/>

 Ordinary we get HTTP request parameter via EL using ${param.hogehoge}.
So, It's troublesome to write following.
    int member_id = Integer.valueOf(request.getAttribute("member_id");
    session.setAttribute("member_id_num", member_id);

 Instead of <sql:param value="${param.member_id}"/>

 Isn't there more convenient way?

 Regards,                             Kazuaki Miyauchi, Japan

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message