Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

opening chm file from jsp page  RSS feed

 
vikas sharmaa
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to make chm file stored in server to be available on client jsp page?

when i tried below jsp code, its successfully opens the chm file on click of the link:



but, when i used below jsp code to access chm file on server, its showing weired texts:



please tell me the right way of opening chm stored in server. Thank you.
 
Michael Angstadt
Ranch Hand
Posts: 278
Eclipse IDE Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's probably not setting the right content type in the response. Add a mime-mapping to your application's deployment descriptor.

I'm not sure what the correct content type is. A quick web search returned some possibilites:

  • application/mshelp
  • application/x-msdownload
  • application/chm
  •  
    Bear Bibeault
    Author and ninkuma
    Marshal
    Posts: 65826
    134
    IntelliJ IDE Java jQuery Mac Mac OS X
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Are you installing the chm file on every person's computer that will visit your site? Because that's what your code is assuming by using a file path as the URL.

    Am I correct in assuming that this is not really your intention?
     
    vikas sharmaa
    Ranch Hand
    Posts: 191
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thank you Bear and Michael for the quick response.

    Michael, i set application/x-chm mime-type in the tomcat server's web.xml file but it does not have any effect. i also tried application/mshelp, application/x-msdownload, and application/chm .. but none works..

    Bear, no, i dont want chm file to be exists on everyone's machine. In the link, < a hr e f ="help/help.chm">Help< / a> ; help.chm file is located on the server's help folder.

    please help.
     
    Michael Angstadt
    Ranch Hand
    Posts: 278
    Eclipse IDE Java PHP
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    vikas sharmaa wrote:Michael, i set application/x-chm mime-type in the tomcat server's web.xml file but it does not have any effect.

    Did you restart Tomcat after making the change?
     
    vikas sharmaa
    Ranch Hand
    Posts: 191
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    yes i restart the server as well
     
    Michael Angstadt
    Ranch Hand
    Posts: 278
    Eclipse IDE Java PHP
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Try changing the content type to something like "application/pdf" to see if it's picking up the changes you're making to web.xml. If a PDF application opens and tries to open the .chm file, you'll know that Tomcat is picking up the web.xml changes.

    Or maybe you're just not using the right content type.
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!