Open MS Word Document From JSP Page
Hello, I am trying to create an application that is for the candidates to upload their Resumes in word format and the data of that file will automatically insert a form which is created into the jsp page. When the client upload their resume in return he will have a form or the name he has on his resume mid will insert the form name in the box. I am not able to achieve the technique from which I will able to Link the MS Word Document From JSP Page. So, please help me to do this.
Re: Open MS Word Document From JSP Page
Hello, You can use the framework of Apache POI which allows you to manipulate files in Microsoft (Excel, Word, etc..) Java. He'll just have to use the values retrieved for display in the form of your JSP. I am not able to create coding for it, as it will need to consider the all of the details from the document and then it is needed to add the data to the form. So, it is quiet complicated. So, you need to work more on it.
Re: Open MS Word Document From JSP Page
First File code:
Code:
<a style="cursor: hand;"
onClick="window.open('test.jsp','','height=400,width=600,scrollbars=yes,resizable=no')">
test link - open word file
</a>
Second File : It is having the word file coding:
Code:
<%@ page contentType="text/html;charset=windows-1452"%>
<%
res.setContentType("application/msword");
res.setHeader("Content-disposition","attachment;filename=resume.doc");
%>
<%@ page language = "java" %>
<html>
<head></head>
<body>
<img src="test.jpg" width="150" height="150" border="0" alt="test"/>
<br>
</body>
</html>
With the help of the both of the code below you will able to get the solution for your problem.
Re: Open MS Word Document From JSP Page
It seems so complicated. You may be trying to isolate the "administrative" to resume searching for patterns containing the address, phone, etc. Usually the name first placed it. It can then be isolated in this block, a string type "FIRST NAME" or "FIRST NAME". This will create a problem while creating the project. We could go through a table containing a list of names but whatever happens, the filling of the name / first name in your form from any resume will never suddenly run on to 100%.
Re: Open MS Word Document From JSP Page
Hello, I am having the code below which will simply provide you more help for getting the solution.
Code:
import org.apache.poi.poifsfilesystem.filesystem .*;
import org.apache.poi.hwpf .*;
import org.apache.poi.hwpf.extractor .*;
import java.io. *;
Public class viewDoc
{
Public static void hand(String[] args)
{
String fname = "slim.hwpfdoc";
POIFSFileSystem fsfilesystem = null;
try{
fsfilesystem = new POIFSFileSystem(new FileInputStream(fname) );
HWPFDocument hwpfdoc = new HWPFDocument(fsfilesystem);
WordExtractor wordextractor = new WordExtractor(hwpfdoc);
String[] str = wordextractor.getParagraphText();
System.out.System.out.println( "Word hwpfdocument has" + Paragraphs.length + "Paragraphs" );
for( int i =0; I <str.length; I + + ) {
str[i] = Paragraph[i].replaceAll("\\cM?\ r?\ n","");
System.out.System.out.println( "Length"+ str[ i ].length());
}
}
catch(Exception e) {
e.printStackTrace();
}
}
}
Re: Open MS Word Document From JSP Page
Hello, if you want to add the application context to the URL of the servlet then you must need to make use of the code below:
Code:
<a href ="<% = request.getContextPath () +"/ Verification"%>"> RSS </ a>
If you want to avoid the more difficult coding in your program then you can simply get the use of the method of the getContextPath () of HttpServletRequest like the code above.