Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 4th, 2005, 01:32 PM
Registered User
 
Join Date: Apr 2005
Location: kolkata, west bengal, India.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default bean problem

hi friends
i am very young to JSP and to the p2p community. itried a basic bean but got the error "org.apache.jasper.JasperException: /sandipan1/add.jsp(2,0) The value for the useBean class attribute student.javaprogram.RegistrationBean is invalid."

i compile the RegistrationBean.java sucessfully.JAVA_HOME is properly set in my computer.
[u]my JSP page is</u>
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<jsp:useBean id="admition" class="student.javaprogram.RegistrationBean" scope="session" />"
<html>
<head>
<title>add student</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<jsp:setProperty name="admition" property ="studentid" value="<%=request.getParameter("studentid") %>" />
<jsp:setProperty name="admition" property="rollnumber" value="<%=request.getParameter("rollnumber") %>" />
<jsp:setProperty name="admition" property="stream" value="<%=request.getParameter("stream") %>" />

<body>

<% admition.insert_data(); %>

<h3>a new student is registered</h3>
</body>
</html>

[u]and my java program is</u>

package student.javaprogram;

import java.sql.*;
import java.io.*;
import javax.sql.*;
import java.util.*;


public class RegistrationBean {
    private String studentid;
    private String rollnumber;
    private String stream;

    public void setStudentid( String studentid) {
        this.studentid=studentid;
    }
    public void setRollnumber(String rollnumber) {
        this.rollnumber=rollnumber;
    }
    public void setStream(String stream) {
        this.stream=stream;
    }
    public String getStudentid() {
        return studentid;
    }
    public String getRollnumber() {
        return rollnumber;
    }
    public String getStream() {
        return stream;
    }
    public void insert_data()
    {
        try{
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            Connection con=DriverManager.getConnection("jdbc:odbc:testdsn ","scott","tiger");
            PreparedStatement ps=con.prepareStatement("insert into SANDIPAN VALUES(?,?,?)");
            ps.setString(1,studentid);
            ps.setString(2,rollnumber);
            ps.setString(3,stream);
            ps.executeUpdate();

            }
            catch(Exception e){System.out.println(e.toString());
            }
    }

}

so friend please help me out. DSN is ok and working fine.

thanks in advans.

regards
sandi


Reply With Quote
  #2 (permalink)  
Old April 4th, 2005, 05:07 PM
Authorized User
 
Join Date: Apr 2005
Location: Arequipa, Arequipa, Peru.
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi sandy

 property ="studentid"
 property="rollnumber"
 property="stream"

is the way to call the set methods (setstudentid), well each property start with not uppercase, but your java code start withuppercase

i saw this common error, the obvious answer is change your property with uppercase, but some times dont work, strange for me!

so,the answer is to change your set methods in your java file to no uppercase

 setStudentid by setstudentid
 setRollnumber by setrollnumber
 setStream by setstream

if i dont remember try to not use the same names to the variables and methods

i hope that my help can resolve your problem

Reply With Quote
  #3 (permalink)  
Old April 5th, 2005, 01:02 PM
Registered User
 
Join Date: Apr 2005
Location: kolkata, west bengal, India.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi Dr.
thanks buddy for your suggestion. i do what u suggested but it won't work. i am in a big mess here.


sandi

Reply With Quote
  #4 (permalink)  
Old April 5th, 2005, 01:22 PM
Authorized User
 
Join Date: Apr 2005
Location: Arequipa, Arequipa, Peru.
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If u want put a hotmail email to add to my messenger list and help u



DR POMPEII, THE PLACE OF THE OBLIVION OF GOD
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
stateless bean iralala EJB 0 September 24th, 2008 10:55 PM
Jsp,bean iishu JSP Basics 0 November 17th, 2007 11:21 AM
bean developer kit sushant2002 Java Basics 1 July 26th, 2007 04:55 AM
Problem in bean lookup, no exception avaniamin J2EE 0 November 11th, 2005 05:40 AM
Problem with EJB(Session+Entity bean) hiparry_m J2EE 1 October 15th, 2004 01:54 PM



All times are GMT -4. The time now is 09:00 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.