I am very new to this field. I am sorry if this is stupid.
I have a HttpServlet code as follow:
@WebServlet("file")
public class FileResource extends HttpServlet {
    private static final long serialVersionUID = -7698183933607633414L;
    @Override
    public void doGet(HttpServletRequest req, HttpServletResponse resp) {
        resp.setContentType("application/pdf");
        resp.setHeader("Content-Disposition", "inline");
        File file = new File("/home/nabin/12403.pdf");
        long fileSize = file.length();
        resp.setContentLengthLong(fileSize);
        try {
            InputStream in = new BufferedInputStream(new FileInputStream("/home/nabin/12403.pdf"));
            OutputStream out = new BufferedOutputStream(resp.getOutputStream());
            for (;;) {
                byte[] buffer = new byte[4096];
                int n = in.read(buffer);
                if (n == -1)
                    break;
                out.write(buffer, 0, n);
            }
            out.close();
            in.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
And I have a xhtml file where I want to display that pdf file. I want to display it as embedded.
<embed src="../questions/#{FileResource.get}.pdf" width="105%"
                            height="825px" />
Right now I can access the pdf file using localhost:8080/myapp/file
How should I proceed?