Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

No Value Specified for Parameter 1

843842Jan 11 2007 — edited Feb 27 2007
Hello All,
I was reading the tutorial " Using Databound Components to Access a Database " on the NetBeans site and made up an example myself to work on.

I have 2 table in PostgreSQL called Student and Courses.
The Student table has 3 fields namely ID, Name, Major
The Courses table has 5 fields namely CousreID, Course1,Course2,Course3, StudentID (Foreign Key from Student table).

The tables just keep record of courses belonging to the students.

I have the following components in Page1.jsp

Dropdown list ( shows the student ID )
Two text boxes to display name and major
Table to display the courses.

The dropdown list is bound to the Student table and the Table is bound to the Courses table with its query modified to

SELECT ALL PUBLIC.courses.cid,
PUBLIC.courses.course1,
PUBLIC.courses.course2,
PUBLIC.courses.course3,
PUBLIC.courses.studentid
FROM PUBLIC.courses
WHERE PUBLIC.courses.studentid = ?

I have the following code in the prerenderer method

public void prerender()
{
if ( cboID.getSelected() == null )
{
try
{
studentDataProvider.cursorFirst();
this.coursesRowSet.setObject (1, studentDataProvider.getValue("ID"));
coursesDataProvider.refresh();
} // end of try block

catch (Exception e)
{
error("Cannot switch to student " +
studentDataProvider.getValue("ID"));
log("Cannot switch to student " +
studentDataProvider.getValue("ID"), e);
} // end of catch block

} // end of if body

} // end of method prerenderer

This block works fine when the page is first accessed. But it throws
" org.postgresql.util.PSQLException: No value specified for parameter 1." in the following method block

public void cboID_processValueChange(ValueChangeEvent event)
{
try
{
this.coursesRowSet.setObject(1, cboID.getSelected());
coursesDataProvider.refresh();
} // end of try block

catch (Exception e)
{
error("Cannot switch to student " + studentDataProvider.getValue("ID"));
log("Cannot switch to person " + studentDataProvider.getValue("ID"), e);
} // end of exception catch block

} // end of processValueChange method

Can any one please help me why the exception is thrown in the above method block.

this.coursesRowSet.setObject(1, cboID.getSelected()); The parameter is specified here.

Waiting for a favorable reply.
Regards.
Hasnain Javed.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 27 2007
Added on Jan 11 2007
4 comments
646 views