Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old October 3rd, 2008, 02:56 PM
Newbie
 
Join Date: Sep 2008
Posts: 14
Default HttpServletResponse in a div of a webpage

Hello everyone!
I have a webpage with a form with two text boxes and the action of the form
it's a servlet. I know how to get the HttpServletResponse response from a servlet like this:

Expand|Select|Wrap|Line Numbers
  1. ....
  2. PrintWriter out = response.getWriter();
  3.                 try 
  4.                 {            
  5.                     out.println("<html>");
  6.                     out.println("<head>");
  7.                     ...
  8.                     out.println("</head>");
  9.                     out.println("<body>");
  10.                     ...
  11.                     out.println("</body>");
  12.                     out.println("</html>"); 
  13.                 }
  14.  
My question is if I want this take the results not in a web page but in the current one i have the form, let's say in a <div id="here"></div>, how can i do that? I am looking for this for 4 hours and more and can't find anything..
I tried the XMLHttpRequest but in the open("GET",url,true), it needs a url (the servlet) but I want to use the form post way i write above.
Any ideas?
Thanks in advance!
Reply
  #2  
Old October 3rd, 2008, 06:03 PM
Expert
 
Join Date: Nov 2006
Posts: 363
Default

Quote:
Originally Posted by xinariscy
I want this take the results not in a web page but in the current one i have the form, let's say in a <div id="here"></div>, how can i do that?
Can you re-word your question? I have no idea what is being asked. Information from DIV tags can not be passed back to the server in an HTTPRequest. On information if forms can be.
Reply
  #3  
Old October 3rd, 2008, 11:59 PM
Newbie
 
Join Date: Sep 2008
Posts: 14
Default

pronerd thanks a lot for the reply! You are right about my question.

I don't want to print "<html>" and "<head>" and the others.. because that will lead to create a new webpage as the response, right?
I just want to print for example a table "<table>" ..... "</table" into a certain <div> section in my webpage. (The same webpage that I use to request the servlet). I hope you understand what I mean..

Thanks again!
Reply
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles