Results 1 to 11 of 11
  1. #1
    danpotter is offline Member
    Join Date
    May 2011
    Posts
    43
    Rep Power
    0

    Default Feedback form of specific data,...

    well,i will clearly explain my requirement...

    im doing a project for an organisation,where the employee sends feedback to administrator....

    here in database[oracle],i took 3 fields
    1)employee name [string(1)]
    2)ID number [string(2)]
    3)Feedback[textarea] [string(3)]

    employee gives his name,id and types his feedback and clicks submit..., and data will be stored in database and the same data gets retrieved and viewd by admin in his admin panel


    i successfully made it to get inserted the data in database...

    now in admin panel,i made a hyperlink "Feedback" and i successfully made a page to display data like

    Feedback recieved from:empname ID number Checkfeedback[checkfedback will be in Hyperlink,it will be used to open in window popup to read feedback...,]

    Here comes the problem...i actually used rs.getstring(1),rs.getstring(2),rs.getstring(3) to retrieve the data...

    when admin clicks on Hyperlink "Checkfeedback",he should be able to read only that specific feedback data,...but as i used getstring(3),when admin cliks hyperlink "Checkfeedback",he can able to see all other feedbacks that are obtained...

    so please help me in making admin to view only specific feedback when he clicks checkfeedback hyperlink...

  2. #2
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,091
    Rep Power
    20

    Default Re: Feedback form of specific data,...

    By "all other feedbacks that are obtained" do you mean you are getting all the feedback rows for that employee?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    danpotter is offline Member
    Join Date
    May 2011
    Posts
    43
    Rep Power
    0

    Default Re: Feedback form of specific data,...

    yah yah exactly..,u got what i really mean....please help me to check only specific feedback,when i click hyperlink

    Feedback From:Dan 1234 Checkfeedback =it should display only that sent feedback
    Feedback From:ram 1224 Checkfeedback =it should display only that sent feedback
    Feedback From:sam 1334 Checkfeedback =it should display only that sent feedback

    In this way,...,when i click checkfeedback of sam,it shold display only his feedback..but when i click checkfeedback,it is displaying the feedbacks of dan,ram,sam....

    i know my mistake that i used st.getString(3) to retrieve the feedback..,but how to make to retrieve the data of specific feedback from st.getString(3)..?? please help me...

  4. #4
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,091
    Rep Power
    20

    Default Re: Feedback form of specific data,...

    What does your database table look like?
    What does your SQL query look like?
    What does your JDBC code look like?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    danpotter is offline Member
    Join Date
    May 2011
    Posts
    43
    Rep Power
    0

    Default Re: Feedback form of specific data,...

    yah i will give my code here.....

    my oracle table is "create table feed(emn varchar(20),ID varchar(20),fd varchar(3000));

    Retfedback.jsp

    Java Code:
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    
    <%@ page import="java.sql.*" %>
    <%@ page import="java.io.*" %> 
    
    <html>
    <head>
      -----------
    -----------
    ------
    <%
          try {
              
             Class.forName("oracle.jdbc.driver.OracleDriver");
    
        Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","emp","emp");
     PreparedStatement st=con.prepareStatement( "SELECT * from feed");
            
             ResultSet rs = st.executeQuery();
    %>
    <div class="div">
    <TABLE border="1" id="tbl">
    
        <%
        while (rs.next()) {
        %>
        <TR>
            <TD>Feedback from:<%=rs.getString(1)%></TD>
            <TD><%=rs.getString(2)%></TD>
            <TD><a href="javascript:void(0);" onclick="PopupCenter('check.jsp', 'myPop1',400,400);">Check Feedback</a></TD>
    	<TD><INPUT type="checkbox" name="chk"/></TD>
           
        
        <%   }    %>
    
        <%
        // close all the connections.
        rs.close();
        st.close();
        con.close();
    } catch (Exception ex) {
        %>
        </font>
        <font size="+3" color="red"></b>
            <%
                    out.println("Unable to connect to database.");
                }
            %>
    
        </TABLE>
    -------------
    --------------
    -----------
    </form>
    </font>
    </body>
    </html>
    In above code when we click "checkFeedback" we will move to check.jsp which will have following code...
    Java Code:
    ----
    ----
    ---
    
     try {
              
             Class.forName("oracle.jdbc.driver.OracleDriver");
    
        Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","emp","emp");
     PreparedStatement st=con.prepareStatement( "SELECT * from feed");
            
             ResultSet rs = st.executeQuery();
    %>
    <div class="div">
    <TABLE border="1">
    
        <%
        while (rs.next()) {
        %>
        <TR>
            <TD>Feedback from:<%=rs.getString(1)%></TD></TR>
           <tr> <TD><%=rs.getString(2)%></TD></tr>
           <tr> <TD><%=rs.getString(3)%></TD></tr>
           
        
        <%   }    %>
    --
    ---
    ---
    <TD>Feedback from:<%=rs.getString(1)%></TD></TR>
    <tr> <TD><%=rs.getString(2)%></TD></tr>
    <tr> <TD><%=rs.getString(3)%></TD></tr>
    In this part i need to do something........
    Last edited by danpotter; 12-19-2012 at 03:56 PM.

  6. #6
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,091
    Rep Power
    20

    Default Re: Feedback form of specific data,...

    JSPs should be used for display of data that has (generally) been pulled together by a servlet.

    That aside, you really need to pass the empId (assuming that's how you can identify rows in the table) in the second call and then
    SELECT * FROM feed WHERE empId = ?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  7. #7
    danpotter is offline Member
    Join Date
    May 2011
    Posts
    43
    Rep Power
    0

    Default Re: Feedback form of specific data,...

    well i used ID as primary key and i tried to extract like select * from feed where ID="1234"

    by using above query,..it is just showing the information whose ID is 1234..,but i dont want like that..

    let us take example...i have 3 employees ,...Dan,ram,sam...Dan sent a feedback to admin, and admin recieves it like..
    Feedback From:Dan 1234 Checkfeedback
    if ram sends Feedback,admin recieves like
    Feedback From:ram 1224 Checkfeedback
    if sam sends feedback,admin recieves like
    Feedback From:sam 1334 Checkfeedback

    Now,..the point is,when admin clicks Dan's Checkfeedback (which is a hyperlink),it should give information of only Dan.if admin clicks Ram's Checkfeedback,it should give only his..like wise....

    but you said to use query like select * from feed where ID="1234".Now when i click hyperlink of Dan's,it is showing all dan's feedback..,BUT THE PROBLEM IS...even if i click sams and rams hyperlink,..it is showing Dans information only as i used ID="1234" which is dan's ID.... Now please do help me in this issue...

  8. #8
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,091
    Rep Power
    20

    Default Re: Feedback form of specific data,...

    Um, don't use the same id for everything?
    The '?' in my above query meant to use a PreparedStatement and supply the required id when you run the query.
    That id would come from the request, so you would have to alter the hyperlink so each one supplies the id.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  9. #9
    danpotter is offline Member
    Join Date
    May 2011
    Posts
    43
    Rep Power
    0

    Default Re: Feedback form of specific data,...

    Brother...,as each employee will have his unique ID,i cant use same ID to extract all the employees data...
    and Yah i used st=con.prepareStatement( "select * from feed where ID='1234'"); then it is extracting the data of only Dan's as 1234 is the ID of employee "Dan",..hope now im clear... I want to extract the data of employees when i click the hyperlink that
    Feedback From:Dan 1234 Checkfeedback =it should display Dans feedback
    Feedback From:ram 1224 Checkfeedback =it should display rams feedback
    Feedback From:sam 1334 Checkfeedback =it should display sams feedback

    now how to alter the hyperlink...??? if u say instead of hyperlink,u can use button,then im even ready to use button..but how to extract the specific employee's data when we click the hyperlink or Button??

  10. #10
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,091
    Rep Power
    20

    Default Re: Feedback form of specific data,...

    In order to extract it you need to supply it in the request.
    I have no idea how PopupCenter works, but I'm guessing the first parameter is the URL, so add some info to that ('?id=<your id here>').
    You can then extract the id on the server as you would any other request parameter.

    All this would, of course, be a lot easier if you weren't trying to do it all in the JSP itself.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  11. #11
    danpotter is offline Member
    Join Date
    May 2011
    Posts
    43
    Rep Power
    0

    Default Re: Feedback form of specific data,...

    wow...yes.....finally i made it by keeping an id and retriving basing on the primary key... :) thnx brother..........

Similar Threads

  1. Taking specific values form Array
    By Eleeist in forum New To Java
    Replies: 17
    Last Post: 02-06-2012, 09:10 PM
  2. Replies: 8
    Last Post: 10-03-2010, 09:45 AM
  3. Replies: 10
    Last Post: 08-12-2009, 04:02 PM
  4. enctype=multipart/form-data with form data in struts
    By vk_satheesh in forum New To Java
    Replies: 0
    Last Post: 09-19-2008, 12:48 PM
  5. Open specific folder form JSP
    By roseline43 in forum New To Java
    Replies: 2
    Last Post: 09-02-2008, 07:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •