Hi everybody,
i am new to java and trying to develop a bit of an app i have created the first page, dynamicall filled a dropdown box all is fine i press the submit button and i get the error below:

java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0)

i persume that i am not getting the data from the form correctly and i am having an issue with it can some body please tell me where i am going wrong?
here is the java code for the form on the first page:

<form action="response.jsp">
                        Select a Parish: <select name="id">
                            <c:forEach var="parish" items="${parish.rows}">
                                <option value="${parish.id}">${parish.ParishName}</option>
                            </c:forEach>
                          </select><input type="submit" value="submit" name="submit" /></form>

here is the java code for my response page:

<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
<sql:query var="parish" scope="application" dataSource="jdbc/gav">
SELECT ParishName, OwnerOccupierHousehold, OwnerOccupierPercOfOverall,
OwnerOccupierCo2Emissions, SocialRentedHousehold, SocialRentedPercOfOverall,
SocialRentedCo2Emissions, PrivateRentedHousehold, PrivateRentedPercOfOverall,
PrivateRentedCo2Emission, TotalHouseholds, TotalPerc, Average, Total2001,
TotalEstimatedTotal2006, EmissionsPerPerson, EmissionPerHousehold, EmissionsPerParish,
EnergyChampionsNeeded, NumberOfPeopleAtWork, NumberOfSchoolAgeChildren  FROM base_data
Where id LIKE <sql:param value="${param.id}"/>
</sql:query>
<c:set var="parish" scope="application" value="${parish.rows[0]}"/>

i call the data like this:

${parish.EmissionsPerParish}

the taglibs are on both pages
got a feeling this could be something really simple that i am missing
thanks in advance.

Where id LIKE ?
</sql:query>
<sql:param value="${param.id}"/>

AFAICT, the <sql:param> tag needs to be nested inside the <sql:query> tag.

dude you are a star!! thankyou just a quick question though : do you know where i can get a good tutorial on maths and java?

AFAICT, the <sql:param> tag needs to be nested inside the <sql:query> tag.

Oops. ;-)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.