tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Cooper <mfncoo...@gmail.com>
Subject Re: whats up with sql:param
Date Fri, 17 Jun 2005 03:17:49 GMT
The first thing I would try is taking everything out of the
<sql:update> except the query string itself and the <sql:param>
element, so that you're left with:

<sql:update dataSource="jdbc/zobarenk">
    insert into test_table (testnumber_id) values (?)
    <sql:param value="${param.testnumber}"/>
</sql:update>

--
Martin Cooper


On 6/16/05, Gokhan <gokhan@mira-soft.com> wrote:
>   Hello,
> 
> I just need to approve just something in site without disturbing general
> MVC logic.
> And decided JSTL sql:query facility.
> 
> I am in test.jsp and i can send user to another page with
> <a href="another_page.jsp?testnumber=2">Another Page</a>
> And on another_page.jsp i just need to insert this testnumber to table
> as a parameter.
> 
> I can see the value with <c:out value="${param.testnumber}"/>. yes
> exactly i can see the number 2 on there.
> it means i can get this value from param.testnumber right?
> 
> When i want to assign this value to sql query
> 
> <sql:update dataSource="jdbc/zobarenk">
> insert into test_table (testnumber_id) values (?)
> 
> <fmt:parseNumber var="roll" value="${param.testnumber}"/> //Since it is
> integer
> <sql:param value="${roll}"/>
> 
> or with <sql:param><%request.getParameter("testnumber");%></sql:param>
> or with <sql:param><c:out value="${param.testnumber}"/></sql:param>
> or assign variable directly to the page scope and get it from there with
> <c:set var="testnumber_sucks" value="${param.testnumber}" scope="page" />
> <sql:param value="${pageScope.testnumber_sucks}"/></sql:update>
> 
> At the end of the all bloody ways i tried, i have this lovely error;
> ERROR: null value in column "testnumber_id" violates not-null constraint
> Because nothing inside of this lovely testnumber variable.
> If i could have type conversion error i would be really happy, but i
> have null.
> 
> My question is, if this variable param.testnumber is empty or null how
> can i see the value of this parameter with c:out ?
> If i can see this bloody value how i can't insert it to the table with
> sql:param with the methods above.
> 
> Would it be related to _rt stuff or something?
> I am using latest jstl 1.1.2 taglibs
> 
> Take care all,
> Gokhan
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
> 
>

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


Mime
View raw message