file share to particular user

file share to particular user

hi i am doing my project in jsp-servlet.i am able to upload successfully any file to oracle database. i want to share a file to specific user , how to write code plzzz help. thank you in advance

here is my code ShowFiles

<html>
<head></head>
<body>
<form name=myname method=get action="ShowUser.jsp">
<table border="1">
<tr><td></td>
<td><b><u>File ID</u></b></td>
<td><b><u>File Description</u></b></td>
<td><b><u>Up Date</u></b></td>
<%--<td><b><u>User Description</u></b></td>--%>
</tr>

<%try
{

    int i=0;
HttpSession hs=request.getSession(true);
 if(null!=hs.getAttribute("i1"))
        {

            i=(Integer) hs.getAttribute("i1");
        }
Connection con = null;

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:naveen","naveen","naveen");
ResultSet rs = null;
Statement st=null;
st=con.createStatement();
rs = st.executeQuery("select file_id,file_desc,up_date from files where user_id='"+i+"' ");
while(rs.next()){String id=rs.getString("file_id"); %>
<tr><td><input type="checkbox" name="Check1<%=i%>" value=<%= id %>></td>
<td><%= id %></td>
<td><%= rs.getString("file_desc") %></td>
<td><%= rs.getString("up_date") %></td>
</tr><%
i++;
}
}catch(SQLException e){ out.println(e.getMessage()); } %>
</table>
<input type="submit" value="Select User">



 ShowUser


<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <%@page import="java.sql.*"%>
        <title>JSP Page</title>
    </head>
    <body>
       <form name=myname method=get action="ShareFile">
<table border="1">
<tr><td></td>
<td><b><u>User ID</u></b></td>
<td><b><u>User Name</u></b></td>
<td><b><u>Password</u></b></td>
<td><b><u>User Description</u></b></td>
</tr>
<%try{

Connection con = null;

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:naveen","naveen","naveen");
ResultSet rs = null;
Statement st=null;
st=con.createStatement();
rs = st.executeQuery("select * from user_det");
int i=0; while(rs.next()){ String id=rs.getString("user_id");%>
<tr><td><input type="checkbox" name="Check2<%=i%>" value=<%= id %>></td>
<td><%= id %></td>

<td><%= rs.getString("user_nm") %></td>
<td><%= rs.getString("password") %></td>
<td><%= rs.getString("user_desc") %></td>
</tr><%
i++;
}
}catch(SQLException e){ out.println(e.getMessage()); } %>
</table>
<input type="submit">


sharefile.java


package BuisnessLogic;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Enumeration;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


@WebServlet(name = "ShareFile", urlPatterns = {"/ShareFile"})
public class ShareFile extends HttpServlet {


    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
        Connection con = null;
        ResultSet rs = null;
        Statement st=null;
        try {

                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                con=DriverManager.getConnection("jdbc:odbc:naveen","naveen","naveen");

                st=con.createStatement();
                Enumeration<String> paramnames = request.getParameterNames();


                while(paramnames.hasMoreElements())
                {
                        String check1 = paramnames.nextElement();
                        String check2 = paramnames.nextElement();
                        if((check1.startsWith("Check1"))&&(check2.startsWith("Check2")))
                        {   
                         st.executeUpdate("insert into share_det(file_id,user_id) values('"+request.getParameter(check1)+"','"+request.getParameter(check2)+"')");
                        }
                }
                out.println("File has sent to particular user");

            }catch(Exception e){ 
                out.println(e);
                out.println(e.getMessage()); 

        } finally {            
            out.close();
        }
    }
View Answers









Related Tutorials/Questions & Answers:
file share to particular user
file share to particular user  hi i am doing my project in jsp-servlet.i am able to upload successfully any file to oracle database. i want to share..."))) { st.executeUpdate("insert into share_det(file_id,user_id
ModuleNotFoundError: No module named 'share-file-qr'
ModuleNotFoundError: No module named 'share-file-qr'  Hi, My... 'share-file-qr' How to remove the ModuleNotFoundError: No module named 'share-file-qr' error? Thanks   Hi, In your python
Advertisements
ModuleNotFoundError: No module named 'azure-storage-file-share'
ModuleNotFoundError: No module named 'azure-storage-file-share'  Hi...: No module named 'azure-storage-file-share' How to remove the ModuleNotFoundError: No module named 'azure-storage-file-share' error? Thanks  
reading a csv file from a particular row
reading a csv file from a particular row  how to read a csv file from a particular row and storing data to sql server by using jsp servlet
Count lines of a particular file
In this program you will learn how to read a file and count number of lines in it. This is the simple program that opens a file and read one line at a time and count no of lines in a file. Program first asks the user to enter
writing a text into text file at particular line number
writing a text into text file at particular line number   Hi, thanks for quick response, I want to insert text at some particular line number.. after line number four my text will display in text file using java program
how to retreive data from database of a particular user after login
how to retreive data from database of a particular user after login  ......please help in display details of particular student after he login ...i want to display the details of only current user who logged
writing a text into text file at particular line number
writing a text into text file at particular line number   Hi, thanks for quick response, I want to insert text at some particular line number.. after line number four my text will display in text file using java program  
writing a text into text file at particular line number
writing a text into text file at particular line number   Hi, thanks for quick response, I want to insert text at some particular line number.. after line number four my text will display in text file using java program  
how can i send a mail to a particular user from a many user dropdown list in jsp
how can i send a mail to a particular user from a many user dropdown list in jsp  how can i a sent a user question to a particular person from a drop down list in jsp
how to retreive data from database of a particular user after login
how to retreive data from database of a particular user after login  ... the user information.. now their is a login and registration page for newuser. after the user has filled the form he should go to the welcome page where he
how to send sms from my website to mobile of particular user.
how to send sms from my website to mobile of particular user.  i had created a website and aim of pjt is whoever the client register for site with their mobile number daily one health tip is to sent to their respective mobiles
how to add two object in a particular file - Java Beginners
these two objects in a particular file using file handling in java....and also wants to retrieve the data of that file.............please help me out...how to add two object in a particular file  Hi frend.. I have two
how to find which user has modified the file
how to find which user has modified the file  how to find which user has modified the file
can u plz help out how to attach file directly & send to a particular mail id
can u plz help out how to attach file directly & send to a particular mail id  i am building a project online LEAVE MANAGEMENT SYSTEM to our coll mini project so if a faculty write all details abt leave & shd send to HOD
How to store data entered by User in JSP page in XML file
? Example: a user will enter empid,emp name ,email id on a particular page.How...   JSP store data entered by user into XML file 1)form.jsp: <html>...How to store data entered by User in JSP page in XML file  How
How to compile PHP file and provide it to user without code?
How to compile PHP file and provide it to user without code?  I have... in asp.net instead of providing code file. How can I compile the PHP file and provide it to my user in the form dll or may be with other type or extension? Please
How to create file and save it into user defined path using jsp/servlet?
How to create file and save it into user defined path using jsp/servlet?  Hi.. Onclick event I have created one file.When file will create it should asked where to save file(like browse option
Version of com.metaversant>share-login-ann-share dependency
List of Version of com.metaversant>share-login-ann-share dependency
Version of com.metaversant>share-site-creators-share dependency
List of Version of com.metaversant>share-site-creators-share dependency
ModuleNotFoundError: No module named 'share'
ModuleNotFoundError: No module named 'share'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'share' How to remove the ModuleNotFoundError: No module named 'share'
ModuleNotFoundError: No module named 'share'
ModuleNotFoundError: No module named 'share'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'share' How to remove the ModuleNotFoundError: No module named 'share'
ModuleNotFoundError: No module named 'A-share'
ModuleNotFoundError: No module named 'A-share'  Hi, My Python... 'A-share' How to remove the ModuleNotFoundError: No module named 'A-share... to install padas library. You can install A-share python with following command
Java file line reader
Java file line reader In this section, you will learn how to read a particular line from file. Sometimes you want to read a particular line from the file but you have to read the whole file for this process. So in order to remove
User Guide, User Manuals Guides
a particular product. Our dedicated efforts make user guides and manuals...Tips for Writing User's Manual Guide We are living in an edge of technological... the need of user guides and manuals. To let people know the various features
share data iphone sdk
share data iphone sdk  How to share data in iPhone application? Actually i want the sharing feature in my iPhone application. Thanks!   You can use the emailing feature in your iPhone application to the share data
Java file exist
Java file exist  In this section, you will learn how to check the existence of the particular file. Description of code: This is a very simple task. Here we have to check whether the specified file or directory exists
How to store data entered in JSP page by a user in XML file & later retrieval of data using id at other page
How to store data entered in JSP page by a user in XML file & later retrieval... file.How can i store data entered by user in XML file and later retrieve data... by user to be stored in xml file.here you have entered data in JSP file
ModuleNotFoundError: No module named 'django-share-me-share-me'
ModuleNotFoundError: No module named 'django-share-me-share-me'  Hi...: No module named 'django-share-me-share-me' How to remove the ModuleNotFoundError: No module named 'django-share-me-share-me' error? Thanks  
Monitoring user activity
Monitoring user activity  how to monitor opening of particular file such as Microsoft office or web browser on your java application? Thank you
Maven Dependency share-login-ann-share >> 0.0.2
You should include the dependency code given in this page to add Maven Dependency of com.metaversant >> share-login-ann-share version0.0.2 in your project
Maven Dependency share-site-creators-share >> 0.0.5
You should include the dependency code given in this page to add Maven Dependency of com.metaversant >> share-site-creators-share version0.0.5 in your project
Maven Dependency share-site-creators-share >> 0.0.6
You should include the dependency code given in this page to add Maven Dependency of com.metaversant >> share-site-creators-share version0.0.6 in your project
share your answer to this question
share your answer to this question  i need to know what is the TELERIK CONTROL? what is the map suite? what is dunda chart? Also i have to know what are the websites available which give infor regarding this. Let me know how
Maven, Gradle, SBT, Ivy, Grape, Leiningen and Buildr Dependency for share-login-ann-share version 0.0.2
Maven, Gradle, SBT, Ivy, Grape, Leiningen and Buildr Dependency for share-login-ann-share version 0.0.2. You can add these depency in your project to get com.metaversant:share-login-ann-share:0.0.2 Java library in your project.. Maven
ModuleNotFoundError: No module named 'openerp-share'
ModuleNotFoundError: No module named 'openerp-share'  Hi, My... 'openerp-share' How to remove the ModuleNotFoundError: No module named 'openerp-share' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'pymks_share'
ModuleNotFoundError: No module named 'pymks_share'  Hi, My Python... 'pymks_share' How to remove the ModuleNotFoundError: No module named 'pymks_share' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'pymks_share'
ModuleNotFoundError: No module named 'pymks_share'  Hi, My Python... 'pymks_share' How to remove the ModuleNotFoundError: No module named 'pymks_share' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'share-nb'
ModuleNotFoundError: No module named 'share-nb'  Hi, My Python... 'share-nb' How to remove the ModuleNotFoundError: No module named 'share-nb... to install padas library. You can install share-nb python with following
ModuleNotFoundError: No module named 'Flask-Share'
ModuleNotFoundError: No module named 'Flask-Share'  Hi, My Python... 'Flask-Share' How to remove the ModuleNotFoundError: No module named 'Flask-Share' error? Thanks   Hi, In your python environment
Maven Repository/Dependency: com.metaversant | share-site-creators-share
Maven Repository/Dependency of Group ID com.metaversant and Artifact ID share-site-creators-share. Latest version of com.metaversant:share-site-creators-share dependencies. # Version Release Date
Maven Repository/Dependency: com.metaversant | share-login-ann-share
Maven Repository/Dependency of Group ID com.metaversant and Artifact ID share-login-ann-share. Latest version of com.metaversant:share-login-ann-share dependencies. # Version Release Date
Java file browse
Java file browse In this section, you will learn how to browse a file and allows the user to choose a file. Description of code GUI provide File choosers... window and allows the user to choose a file.  Here we have used this class
need solution to get file name from path which should give by user
need solution to get file name from path which should give by user  how do i write a program in java that i should get file path from arguments.currently this code creates the file at d:\ but i need to get this file name
search for particular keyword in the folder documents
search for particular keyword in the folder documents  i am having... to particular folder. it is a stand alone application so i have to search particular keyword in the folder having document like in pdf , word or excel
User Module
User Module The user first need to make registration on the website... of that particular language. For example- if he selects java the he can only see.... User does the following task Login to the application ADS_TO_REPLACE_1
ModuleNotFoundError: No module named 'analysts-tool-share'
ModuleNotFoundError: No module named 'analysts-tool-share'  Hi, My... named 'analysts-tool-share' How to remove the ModuleNotFoundError: No module named 'analysts-tool-share' error? Thanks   Hi
ModuleNotFoundError: No module named 'django-social-share'
ModuleNotFoundError: No module named 'django-social-share'  Hi, My... named 'django-social-share' How to remove the ModuleNotFoundError: No module named 'django-social-share' error? Thanks   Hi
ModuleNotFoundError: No module named 'django-social-share'
ModuleNotFoundError: No module named 'django-social-share'  Hi, My... named 'django-social-share' How to remove the ModuleNotFoundError: No module named 'django-social-share' error? Thanks   Hi
ModuleNotFoundError: No module named 'django-social-share-lijo'
ModuleNotFoundError: No module named 'django-social-share-lijo'  Hi...: No module named 'django-social-share-lijo' How to remove the ModuleNotFoundError: No module named 'django-social-share-lijo' error? Thanks  

Ads