Aniketh Narayanan

Greenhorn
+ Follow
since Jan 05, 2013
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Aniketh Narayanan

Bear Bibeault wrote:You're going about it all wrong. You can't use normal Java file I/O to read a file on the client from code running on the server.

Please see the ServletsFaq and JspFaq for information on file uploading. You need to use HTTP, not file I/O.




Can you please help me with the code ?
11 years ago
I am currently working on a project where I have to open an excel file for reading the contents on it.
I am using the POI package for reading Excel file and the File type for input. My servlet code goes as follows:




If I have the excel file (test1.xls) in my D: drive, once selected, the servlet takes the path of tomcat folder instead of taking D:/test1.xls.

It takes the path:

C:\Program Files (x86)\Apache Software Foundation\Apache Tomcat 7.0.27\bin\testing2.xls

INSTEAD OF TAKING

D:\test1.xls


Please help with a solution
11 years ago

Ulf Dittmer wrote:Be aware that that code only works for XLS files, not XLSX files. If you want something that works for both files, you should use the org.apache.poi.ss.... packages instead of the org.apachepoi.hssf... packages; the code shouldn't be hard to refactor.




Oh okk. I didnt test it with a XLSX file. I shall refactor the code .

Thanks.

T Mishra wrote:This should help you




Thanks, it works like a charm...


thanks a lot

Ulf Dittmer wrote:

Niraj Jha wrote:Check documentation:


Why do you recommend the low level API? POI has perfectly fine high level APIs.

But let's take a step back: You said you need to import data from Excel, and then print it. So what do you mean by "I am using the POI library for exporting data." - what is the "export" step that you already have?

But regardless, the POI web site has many, many code examples for doing just about anything related to XLS and XLSX files.





There was a part in the project which required acquiring data from the database and exporting it in excel sheets.
That is where i used the POI library for exporting.

But now i want to import data from excel and print it.

Can you help me with the code ???
Hi,

I am currently working on a project where i have to import data stored in excel sheet and print it as an output using Servlets.

I am using the POI library for exporting data. But I also need to import.

I have no idea how to write the code.

Please help.

Thanks.
Hi,

I am currently building a website using JSP/Servlets, n that I wanted to add a page where user's can add new videos as well as view the videos.
I have no idea as to how to go about with the code as well as how to store the video files and format, etc.
Kindly help me.

Thanks
11 years ago

Akhilesh Trivedi wrote:This looks too complicated, because your database, your view and your control-logic all are in one place. Why not have JSP separately and send/receive data via session/request objects.



Even if a JSP is separately created, how will i write the code to display the database in a tabular column.
And how will i retrieve the CLICKED value in parameter ?

11 years ago
I want to pass the selected data by the user via parameter, but i am not able to get the coding right.

For example,
If the user selects ID 101, then 101 should be sent via parameter to a designated page.

The servlet code written by me is as follows:



The parameter being passed by writing the above code is: EID=rs.getString(1).
I dont want that. I want the String passed by ResultSet to be passed.

Please help.
11 years ago


Here is the code.
For me to check the passing of the parameter, the link itself is not appearing.
And when i directly write



It retrieves the values properly.
11 years ago
Thank you so much for your help.

But whenever i write the code...

<tr>
<td>
<a href="prjinsert.jsp?EID=<%=rs.getString("EmployeeID")%>"><%=rs.getString("EmployeeID")%></a>
</td>
</tr>

It does not retrieve any value from the database.
It gives me blank rows

11 years ago
Hi,
I am working on a project where i am using jsp and servlets.
I am retrieving data from the database and displaying it in a table.
When i click on the respective ID, it should take me to a page where I can edit the fields.
This, is the code i have written..

<%

Connection conn = null;
Statement stmt = null;
ResultSet rs = null;

try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn= DriverManager.getConnection("jdbc:odbc:resourcedetails1");
stmt=conn.createStatement();
rs=stmt.executeQuery("select * from resourcedetails");
while(rs.next()){
%>
<tr><td><a href="prjinsert.jsp"><%=rs.getString("EmployeeID")%></a></td><td><a href="prjinsert.jsp"><%=rs.getString("EmplyeeName")%></a></td><td><%=rs.getDate("DOJSyntel")%></td>
<td><%=rs.getDate("DOJRCIX")%></td><td><%=rs.getString("EmailID")%></td>
<td><%=rs.getString("DateofBirth")%></td></tr>

<%
}

rs.close();
stmt.close();
conn.close();
}
catch(Exception e){e.printStackTrace();}
%>

The place where i am stuck is, how do i send the ID clicked by the user to the servlet so that, that particular details can be retrieved in the appropriate fields in the next page ?

Please help.

Thankyou
11 years ago