TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Venkatesh K H
NA
116
33.1k
Error in file fetch from table in jsp
Sep 5 2017 9:14 AM
I am currently doing folder structure using jsp. Files are uploaded to the folder and saved file path and filename into the database. Fetching the file from database to the front end using jsp code. Files are displayed with a href link. But when i click on file it is not open or downloadable. When i click on file it should open. Please check what is the problem in code.
Note: File is in href format but not opening or downloadable in my project.
File path saved as: D:\\UploadedFiles\\index.html'
<%
try {
//String s3=null;
// String s2=null;
statement = connection.createStatement();
String query ="select name,file from file where category=1";
resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String fname=resultSet.getString("name");
String fpath=resultSet.getString("file");%>
<li> <a target="_balnk" href="<%=fpath%>"><%=fname%></a></il>
<%
}
}
catch (Exception e) {
e.printStackTrace();
}
%>
<%
try {
//String s3=null;
// String s2=null;
statement = connection.createStatement();
String query ="select name,file from file where category=1";
resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String fname=resultSet.getString("name");
String fpath=resultSet.getString("file");%>
<li> <a target="_balnk" href="<%=fpath%>"><%=fname%></a></il>
<%
}
}
catch (Exception e) {
e.printStackTrace();
}
%>
Reply
Answers (
0
)
How to make photo gallery using jsp mysql
Count Checked checkboxes and add to hidden field in HTML