Hello Kazuaki, 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}"/>
Three things: * Looking at the source for the version of sql:param might be instructive in telling you what it's doing, how it's thinking about taking what is passed. * fmt:parseNumber isn't something I've ever used, since I prepare my data elsewhere before ever getting to a JSP, but it might answer your question as stated (though I think not what you were looking for). * The change between Java versions, if exactly so, is a bit bothersome. I'm unsure why it changed or the motivation for such a change. It felt like Java (and in particular JSP and many standard taglibs) were heading towards sensible intuition of intent, but they've clearly veered back towards the explicit expression of intent, which can seem bulky (I've noted it elsewhere as well). Maybe there are ways to make it nicer, but I've been having to change my coding style so it would bug me less (arguably following better practices). On Mon, Aug 19, 2019 at 1:17 AM Kazuaki Miyauchi <miyau...@gmail.com> wrote: > > To simple following table. > create table test (member_id int, member_name text); > > In JSP, I accessed as following. > <sql:update var="stmt" dataSource="${kome}"> > insert into test values(?,?) > <sql:param value="1"/> > <sql:param value="Miyauchi"/> > </sql:update> > > I've gotten following error.(using Tomcat-9.0.22 and Postgres-11.5) > javax.servlet.jsp.JspException: insert into test values(?,?) : ERROR: > column "member_id" is of type integer but expression is of type > character varying Hint: You will need to rewrite or cast the > expression. Position: 27 > > This JSP works under Tomcat-5.5.3 and Postgres-9.0.8. > > And, I've gotten the same result using following JSP. > > <sql:update var="stmt" dataSource="${kome}"> > insert into test values(?,?) > <sql:param>1</sql:param> > <sql:param value="Miyauchi"/> > </sql:update> > > How to cast String to int? > > Of course, following JSP works correctly. > > <sql:update var="stmt" dataSource="${kome}"> > insert into test values(1,?) > <sql:param value="Miyauchi"/> > </sql:update> > > Regards, Kazuaki Miyauchi, Japan > > --------------------------------------------------------------------- > To unsubscribe, e-mail: taglibs-user-unsubscr...@tomcat.apache.org > For additional commands, e-mail: taglibs-user-h...@tomcat.apache.org > -- Stuart Thiel, P. Eng. --------------------------------------------------------------------- To unsubscribe, e-mail: taglibs-user-unsubscr...@tomcat.apache.org For additional commands, e-mail: taglibs-user-h...@tomcat.apache.org