File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Html contents displayed by servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Html contents displayed by servlet" Watch "Html contents displayed by servlet" New topic
Author

Html contents displayed by servlet

James Tharakan
Ranch Hand

Joined: Aug 29, 2008
Posts: 580

I have three file html, servlet and jsp. When i print html contents using servlet after user clicking on submit button then the html file(first file) content are replaced by the html_content of servlet.But if the servlet also forwords the request to JSP then what happens to the htnl_content in the servlet??

SCJP 6
Why to worry about things in which we dont have control, Why to worry about things in which we have control ! !
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

What happened when you tried it?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
James Tharakan
Ranch Hand

Joined: Aug 29, 2008
Posts: 580

When i tried it .. it overwrites it... Is it possible to retain the page displayed by servlet
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

What are you actually trying to accomplish? What you are doing doesn't follow any established pattern of web application structure.
James Tharakan
Ranch Hand

Joined: Aug 29, 2008
Posts: 580

Bear Bibeault wrote:What are you actually trying to accomplish? What you are doing doesn't follow any established pattern of web application structure.

I understand what you are trying to say but i was just trying to do different things & it happened that i had html in the servlet and that servlet also forwards the call to JSP. So this question came to me ... what happens to the html of the servlet.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

"the html of the servlet" has no meaning. You'll need to specific about what you mean by this.
Saifuddin Merchant
Ranch Hand

Joined: Feb 08, 2009
Posts: 597

What your looking for would be RequestDispatcher forward vs include.
You'll get a good understanding by googling for the difference or you could try it out yourself - http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/RequestDispatcher.html

As Bear has already pointed out - its against any established pattern of web application structure - so I would not end up using some code like that in a real application. (Basically under usual circumstances I would not have RequestDispatcher.include() in my Servlet!!)


Cheers - Sam.
Twisters - The new age Java Quiz || My Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Html contents displayed by servlet
 
Similar Threads
Sending the file contents from the PC to a remote web server
div tag as html container
Save JSP output as.html
Servlet reading a JSP file
html form that contains a list of options drawn from db