Click here to Skip to main content
15,913,758 members
Home / Discussions / Java
   

Java

 
AnswerRe: Set Represntation, please help !!!!!!!!!!!!!!!!!!!!!!!!!!!!! Pin
daniel_at_work2-Nov-08 22:21
daniel_at_work2-Nov-08 22:21 
QuestionHow to find the coordinates of a JList item Pin
nkadivar29-Oct-08 11:50
nkadivar29-Oct-08 11:50 
QuestionCompiling Java Code Pin
Kevin Marois29-Oct-08 6:29
professionalKevin Marois29-Oct-08 6:29 
AnswerRe: Compiling Java Code Pin
nkadivar29-Oct-08 11:52
nkadivar29-Oct-08 11:52 
AnswerRe: Compiling Java Code Pin
toxcct29-Oct-08 22:31
toxcct29-Oct-08 22:31 
GeneralRe: Compiling Java Code Pin
leesoief4-Nov-08 20:28
leesoief4-Nov-08 20:28 
QuestionJava Servlets with AJAX Pin
ro88o29-Oct-08 5:22
ro88o29-Oct-08 5:22 
QuestionData access objects used in jsp and beans? [modified] Pin
pdoy070827-Oct-08 15:16
pdoy070827-Oct-08 15:16 
Hi, I'm currently working on concerning a student record with guardians/parents... im using the java ee framework.. I'm having problems on retrieving the data on our database(MySQL).. Here is what i did.. i have created a class to retrieve those data from the database..
my problem is that whenever i retrieve that data in my jsp page, it only shows this Ljava.lang.String@123EGa something similar to this..

<small><br />
CLASS PLARENTS .. <br />
<br />
package com;<br />
//this class is the one that i used to retrieve the data.. <br />
import java.io.*;<br />
import java.sql.*;<br />
import javax.servlet.jsp.*;<br />
import javax.servlet.jsp.tagext.*;<br />
<br />
public class Parents {<br />
    <br />
    public String[] lastname;<br />
    public String[] firstname;<br />
    public String[] middlename;<br />
    public String[] relation;<br />
    <br />
    private Connection connection = null;<br />
    private Statement statement = null;<br />
    private ResultSet rs = null;<br />
    Connect con = new Connect();<br />
    int count = 0;<br />
    <br />
    public Parents(){}<br />
    <br />
    public Parents(int idno) {<br />
        int i = 0;<br />
        try {<br />
            Class.forName("com.mysql.jdbc.Driver").newInstance();<br />
            connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/sis",con.user,con.password);<br />
            statement = connection.createStatement();<br />
            rs = statement.executeQuery("SELECT * FROM guardians WHERE studidno='" + idno + "'");<br />
            <br />
            if (rs.last()) {<br />
                count = rs.getRow();<br />
            }<br />
            <br />
            lastname = new String[count];<br />
            firstname = new String[count];<br />
            middlename = new String[count];<br />
            relation = new String[count];<br />
<br />
            while (rs.next()){<br />
               lastname[i] = rs.getString("lastname");<br />
               firstname[i] = rs.getString("firstname");<br />
               middlename[i] = rs.getString("middlename");<br />
               relation[i] = rs.getString("relation");<br />
               i++;<br />
            }<br />
<br />
        } catch (Exception e) {<br />
            e.printStackTrace();<br />
        }<br />
    }<br />
<br />
    //setters in here.. <br />
    <br />
    public String[] getLastname(){return lastname;}<br />
    <br />
    public String[] getFirstname () {return firstname;}<br />
    <br />
    public String[] getMiddlename () {return middlename;}<br />
    <br />
    public String[] getRelation () {return relation;}<br />
    <br />
}</small>


and this is what i placed in my jsp page..
<small> <% <br />
Parents p = new Parents(info.getIdno());<br />
for (int i = 0; i < p.getFirstname().length; i++ ) {<br />
                        %><br />
                        <tr bgcolor="#fefce3"><br />
                           <td><br />
                                   <p id="info"><br />
                                    <%= p.getLastname() %><br />
                                   </p><br />
                                   <p id="record">Relationship:<br />
                                    <span id="relationship"><br />
                                      <%= p.getFirstname() %><br />
                                    </span><br />
                                   </p><br />
                            </td><br />
                            <br />
                        </tr><br />
                        <tr><br />
                            <td> </td><br />
                        </tr><br />
                        >% } %></small>

Hi, I'm currently working on concerning a student record with guardians/parents... im using the java ee framework.. I'm having problems on retrieving the data on our database(MySQL).. Here is what i did.. i have created a class to retrieve those data from the database..
my problem is that whenever i retrieve that data in my jsp page, it only shows this Ljava.lang.String@123EGa something similar to this..


"according to what i have read on some searches, the best way to do it is by using data access objects..".. can anybody just an idea on how to do this using data access objects or give some sample codes for me to do this.. Im asking for an idea.. or any sample codes will do.. i have been working on this for about 2 days now, I've done so many researches and i haven't quite find any answer to my problem..


modified on Monday, October 27, 2008 9:23 PM

QuestionSingle Sign On Pin
vedabj27-Oct-08 1:18
vedabj27-Oct-08 1:18 
Question"Help" JTable problem Pin
slslooo26-Oct-08 20:54
slslooo26-Oct-08 20:54 
QuestionHelp on Search and Replace in a file using java Pin
go4rib24-Oct-08 20:21
go4rib24-Oct-08 20:21 
QuestionHow to specify character encoding in JavaMail? Pin
davilism24-Oct-08 7:26
davilism24-Oct-08 7:26 
QuestionDifferent between JRE 1.6 and JRE 1.5 Pin
utnqbao22-Oct-08 18:53
professionalutnqbao22-Oct-08 18:53 
AnswerRe: Different between JRE 1.6 and JRE 1.5 Pin
toxcct22-Oct-08 21:27
toxcct22-Oct-08 21:27 
GeneralRe: Different between JRE 1.6 and JRE 1.5 Pin
utnqbao22-Oct-08 22:23
professionalutnqbao22-Oct-08 22:23 
GeneralRe: Different between JRE 1.6 and JRE 1.5 Pin
toxcct22-Oct-08 22:33
toxcct22-Oct-08 22:33 
GeneralRe: Different between JRE 1.6 and JRE 1.5 Pin
utnqbao23-Oct-08 0:06
professionalutnqbao23-Oct-08 0:06 
GeneralRe: Different between JRE 1.6 and JRE 1.5 Pin
toxcct23-Oct-08 2:22
toxcct23-Oct-08 2:22 
GeneralRe: Different between JRE 1.6 and JRE 1.5 [modified] Pin
utnqbao23-Oct-08 16:29
professionalutnqbao23-Oct-08 16:29 
QuestionAfter update of fix Windows Update: KB956390, in HTML buttons are developed in VML are not working Pin
ezhil2421-Oct-08 0:03
ezhil2421-Oct-08 0:03 
QuestionDownload JDK 1.6_04 Pin
Kevin Marois20-Oct-08 8:39
professionalKevin Marois20-Oct-08 8:39 
AnswerRe: Download JDK 1.6_04 Pin
toxcct20-Oct-08 21:24
toxcct20-Oct-08 21:24 
Questioncolumns side by side Pin
ic3e18-Oct-08 14:01
ic3e18-Oct-08 14:01 
AnswerRe: columns side by side Pin
sunil_jvfrm1-Nov-08 1:30
sunil_jvfrm1-Nov-08 1:30 
Questionwondering why it doesnt create another text field Pin
srinath158317-Oct-08 23:11
srinath158317-Oct-08 23:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.