Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 134942 - I18N - page directive with pageEncoding attribute is needed in the default index.jsp
I18N - page directive with pageEncoding attribute is needed in the default in...
Status: VERIFIED FIXED
Product: javaee
Classification: Unclassified
Component: Spring
6.x
All All
: P2 (vote)
: 6.x
Assigned To: Rohan Ranade
issues@javaee
JA_COMMUNITY, 61fixes2-fixed
: I18N, RELNOTE
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-05-13 12:04 UTC by Keiichi Oono
Modified: 2008-07-10 15:04 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
:


Attachments
IDE screeshot when opening index.jsp (50.45 KB, image/png)
2008-05-13 12:05 UTC, Keiichi Oono
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Keiichi Oono 2008-05-13 12:04:11 UTC
6.1 ML build

to reproduce:
  - Create web project with the Spring Web MVC framework
  - Open WEB-INF/jsp/index.jsp

The default translated contents can not be displayed correctly. The file encoding is detected as ISO-8859-1 by IDE. I
think the following line needs to be added at the top of index.jsp:

<%@page contentType="text/html" pageEncoding="UTF-8"%>

By adding above line outside of the IDE, index.jsp can be displayed fine by re-opening. You can not add the above line
for the inside of the IDE. Because IDE is detecting encoding as "ISO-8859-1", embedded mutli-byte character will be
corrupted by saving file from the IDE.

As a workaround, the following message needs to be back-translated into English not to display corrupted characters.

spring.webmvc/src/org/netbeans/modules/spring/webmvc/Bundle.properties
MSG_WELCOME_PAGE_TEXT
Comment 1 Keiichi Oono 2008-05-13 12:05:24 UTC
Created attachment 61324 [details]
IDE screeshot when opening index.jsp
Comment 2 Keiichi Oono 2008-05-13 12:06:14 UTC
See also #128595
Comment 3 Ken Frank 2008-05-13 16:18:38 UTC
looks like 128595 did not have complete fix - it got the html
tags but not the page directive one.

also added whiteboard entry for fixing in patch 2
and added RELNOTE keyword so this could be mentioned in
release note.

as to the text for the file being in bundle, its probably
not needed to be since text in project created files (from templates)
like java, jsp, html are not translated.

ken.frank@sun.com

Comment 4 John Baker 2008-05-21 08:07:47 UTC

The decision was not to translate the contents of index.jsp.  The contents are generated by a template.

Also, now, integrated in the trunk, a change was made so the text no longer comes from a bundle file.

Please try a trunk build.

Comment 5 John Baker 2008-05-21 08:09:13 UTC
Changeset was

aaec9e965b2a 
Comment 6 Ken Frank 2008-05-21 15:53:08 UTC
John, just confirming that template file itself does not need to be translated
and thus should not be in l10n kits, since we don't translate template
files.  (probably nothing needs to be done since template file names
don't match global pattern of .html or .properties so it won't be in kit
anyway)

ken.frank@sun.com
Comment 7 John Baker 2008-05-21 17:01:42 UTC
That's right, the template file is not to be translated.  That is what I meant to say in desc5 but I referred to index.jsp

If no other template files are translated then shouldn't make an exception.

Comment 8 John Baker 2008-05-21 17:07:59 UTC
Since this is marked as 61fixes2-candidate then do you need to transplant aaec9e965b2a to patch 2 ?
Comment 9 Ken Frank 2008-05-21 17:34:35 UTC
John,

I have added sustaining to cc list.

I know that it needs to be verified in trunk and then sustaining does other actions,
but I don't know specific answer to the question and think sustaining can tell about it.

ken.frank@sun.com
Comment 10 Keiichi Oono 2008-05-22 05:18:53 UTC
Please let me reopen because I would like to request to add page directive with "pageEncoding" attribute.
I agree with you to implement not to translate index.jsp contents by Bundle.properties. However, even if the default
page is generated with English message, user will modify that initial page with native language, and they need to add
page directive to display non-ascii characters.
Would you add pageEncoding attribute to help users to modify default index.jsp? It's really helpful if the generated
page has pageEncoding attribute.
Comment 11 kaa 2008-05-22 16:19:40 UTC
If some changes will be made in templates
let me know where can I find them. Now I see the following:

1. index.jsp doesn't have the line suggested in the description:
  <%@page contentType="text/html" pageEncoding="UTF-8"%>
  there is only:
  <META http-equiv="Content-Type" content="text/html; charset=UTF-8">

2. In the description I see that the content of index.jsp now comes from a template.
   I don't see any separate template for this under Spring Framework templates. There is
   only JSP template under Web category. It has encoding value as a parameter:
   <%@page contentType="text/html" pageEncoding="${encoding}"%>
   Probably it will be used for index.jsp in Spring project. 
Comment 12 pslechta 2008-05-27 14:35:57 UTC
The fix proposed by changeset http://hg.netbeans.org/main/rev/aaec9e965b2a basically removes localized Spring welcome
message from the l10n bundle and places English welcome message into template. So Spring welcome page will be always in
English language. Is it the proper fix for this issue? Is it OK if welcome page won't be localized?
Comment 13 Ken Frank 2008-05-27 17:45:50 UTC
Petr,

it is ok since comments in template files are not translated.

However, as keiichio and kaa mention, the pageEncoding directive is not in this
index.jsp file and it should be, since other jsp files created for user
by various nb projects, have such a notation.

even if this file might not be meant to be used in same way as other jsp files
it still should have this directive in it in case user wanted to have characters
of other encoding in it.

can that be added as part of this fix ?

ken.frank@sun.com
Comment 14 pslechta 2008-06-02 14:55:34 UTC
Fixing template for Spring index.jsp page...

http://hg.netbeans.org/main/rev/2db26c0e4fcf
Comment 15 pslechta 2008-06-02 14:56:57 UTC
QA, please verify this fix till 09-Jun-2008, so it can be part of NB 6.1 patch 2.
Comment 16 Petr Blaha 2008-06-03 14:40:51 UTC
Reporter, please verify the bug in the trunk. Thanks.
Comment 17 Ken Frank 2008-06-03 16:55:58 UTC
kaa, please verify this now in next trunk build so can be in patch, mark as resolved
in issue when it happens please.

ken.frank@sun.com
Comment 18 kaa 2008-06-03 18:20:45 UTC
Checked with trunk build 0603:
index.jsp now has the line <%@page contentType="text/html" pageEncoding="UTF-8"%>.
The encoding was chooses from the project one. Checked also with win-31j.
Comment 19 Keiichi Oono 2008-06-04 05:46:01 UTC
I confirmed the fixing, too. It works fine.
Thanks!
Comment 20 pslechta 2008-06-04 09:34:58 UTC
The fix has been ported into the release61_fixes repository.

http://hg.netbeans.org/release61_fixes/rev/c42b7900afe1
http://hg.netbeans.org/release61_fixes/rev/d764f4c986c7


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo