Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Pro JSP
|
Pro JSP Advanced JSP coding questions. Beginning questions will be redirected to the Beginning JSP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro JSP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 10th, 2008, 07:35 AM
Authorized User
 
Join Date: Jan 2008
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default distorted result while calling a html file

Hi All,

I am using <jsp:include /> to include a .htm file which has few hyphens ( - ) and quotes( ' ) . If I run the html directly in the browser I can see those hyphens or quotes properly. But when I call the JSP which is deployed on tomcat 5 server, I am getting question marks ( ? ) in place of the original characters ( - or ' ).

Here is the code snippet:
---------------------------------------------------------------------------------------------
<%
         String finalPath = "service map/cust details.htm";
%>
<jsp:include page="<%=finalPath%>"/>

---------------------------------------------------------------------------------------------
Here the HTM is in a folder 'service map' that lies in same folder of the JSP.
Then I tried to use URLEncoder like below
---------------------------------------------------------------------------------------------
<%
         String finalPath = URLEncoder.encode("service map/cust details.htm");
%>
<jsp:include page="<%=finalPath%>"/>

---------------------------------------------------------------------------------------------
In first case I am getting the htm include in the JSP but hyphens replaced with question marks ? and second case gives blank page in place of the htm.

Please suggest!

Regards
__________________
Regards
 
Old January 11th, 2008, 04:06 AM
jomet
Guest
 
Posts: n/a
Default

Hi,

try using URLEncoder.encode("page.htm", "UTF-8")

http://java.sun.com/j2se/1.4.2/docs/...RLEncoder.html
encode(String s)
          Deprecated. The resulting string may vary depending on the platform's default encoding. Instead, use the encode(String,String) method to specify the encoding.

regds

jomet.
---------------------------------------------
Once you start a working on something,
dont be afraid of failure and dont abandon it.
People who work sincerely are the happiest.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Bind result set to Html Div Controls jazzcatone ASP.NET 1.0 and 1.1 Basics 1 August 10th, 2006 07:35 AM
Calling a HTML page from an ASP script Brutus Buckeye ASP.NET 1.0 and 1.1 Basics 1 November 2nd, 2005 03:56 PM
weird funtion calling effect/result blur_ivy ASP.NET 1.0 and 1.1 Professional 0 March 6th, 2005 11:19 PM
CALLING a EXE from a HTA (or HTML) stalker Javascript 1 November 1st, 2004 02:18 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.