Results 1 to 1 of 1
  1. #1
    renuka_anil is offline Member
    Join Date
    Dec 2008
    Posts
    12
    Rep Power
    0

    Question Adding result from jsp page to html using servlet

    Hello All,
    Im developing an application that uses servlet. In that I want to add the result of jsp page into the html page that im showing through outputstreeam.
    the html is shown in following way
    path = getServletContext().getRealPath(folder)
    + "/LoginPage.html";
    BufferedReader br = new BufferedReader(new FileReader(path));
    StringBuffer buffer = new StringBuffer();
    String line = br.readLine();
    boolean skip = false;
    while (line != null) {
    if (line.indexOf("name=\"UID\" value=") != -1) {
    //uiRead = true;

    String tempLine = line.substring(0, line
    .indexOf("name=\"UID\" value=") + 18);
    line = tempLine
    + UniquId
    + line.substring(line.indexOf("name=\"UID\" value=") + 18, line.length());

    buffer.append(line);
    }else if(!skip){
    skip = true;
    int index = -1;
    index = line.indexOf("your")+5;
    if (id != null) {
    line = line.concat(id);
    }
    buffer.append(line);
    }else{
    buffer.append(line);
    }
    line = br.readLine();
    }
    br.close();
    response.setContentType("Text/HTML");
    OutputStream os = response.getOutputStream();
    os.write(buffer.toString().getBytes());
    //JSP response
    os.flush();
    os.close();

    after adding all lines then I want to add the result that I get from JSP.
    To get response Im using RequestDispatcher and use include(). But I am not getting how to retrieve the response from include and add into above code.
    Please if any body knows let me know too.
    Any code snippet will be greatfull.

    Thanks
    Last edited by renuka_anil; 03-23-2009 at 10:21 AM.

Similar Threads

  1. How to open html page?
    By smartsubroto in forum New To Java
    Replies: 8
    Last Post: 08-16-2012, 01:13 PM
  2. redirect to html page
    By simo_mon in forum Java Servlet
    Replies: 3
    Last Post: 02-12-2009, 06:18 PM
  3. adding <br> html tag to string
    By newbieal in forum New To Java
    Replies: 7
    Last Post: 10-14-2008, 03:51 PM
  4. convert html page to pdf
    By MarkWilson in forum Advanced Java
    Replies: 2
    Last Post: 09-03-2008, 12:14 AM
  5. HTML page
    By bbq in forum New To Java
    Replies: 1
    Last Post: 07-05-2007, 04:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •