• Post Reply Bookmark Topic Watch Topic
  • New Topic

servlet calling xhtml file  RSS feed

 
amal shah
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I am very new to learning servlet/jsp's. i have a very basic question which i am not able to get through. My aim is that i want to get the list of items. For this my servlet calls the xhtml to do this. But when i get the output from the servlet...it is actually the code of the xhtml file(it is not the output that xhtml file that it is suppose to give). i get the output as code of the xhtml file if i directly hit the xthml file from the browser.

i believe there's some setting to be done in the browser.....

help appreciated
cheers
amal shah
 
ravi smart
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
set contentType as "application/xhtml+xml" to enable xhtml
 
amal shah
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
setContentType did not made any difference......

even if i directly call the xhtml file from browser it shows the code written in the xhtml file and not the actual output thatit is suppose to show......

help appreciated
cheers
amal shah
 
Tarun Yadav
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you 'calling' the XHTML page?
 
amal shah
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://localhost:8080/Airtel/product.xhtml?cat=illustrations....

is there some setting to be done in the browser....


help appreciated
cheers
amal shah
 
Tarun Yadav
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I meant how are you trying to invoke the page from your servlet? I would expect you're using RequestDispatcher.include()?
 
amal shah
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



this is the code which i apply for calling xhtml from servlet

help appreciated
cheers
amal shah

[BPSouther: Narrowed the code to make the thread more legible]
[ October 24, 2007: Message edited by: Ben Souther ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are you actually trying to accomplish?

The code you have written will do exactly what you describe: obtain the source code for the xhtml resource.

If you want to do something else, you'll need to let us know what that is so we can point you in the right direction.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
even if i directly call the xhtml file from browser it shows the code written in the xhtml file
What URL are you using to hit the file? Are you sure that your xhtml file is properly formatted?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!