0

I made a small java ee app, and a login in html, with a form post method to a java class verification.

UTF-8 is respected at the beginning, as we can see on this:

Login Html page

When the login or password is not good, we have this message at the top

Failed login message

And as you can see, there is a problem with accent. here is the source code after ctrl+u :

enter image description here

And this is the class that checks the login, and send a out.print.ln : enter image description here

I don't understand why there is a problem with utf-8 after the out.print.ln ? How can I solve this ? I could have used a jsp page, but I used this tag lib in my web.xml file :

    <jsp-config>
        <jsp-property-group>
            <url-pattern>*.jsp</url-pattern>
            <include-prelude>include/taglibs.jsp</include-prelude>
        </jsp-property-group>
    </jsp-config>

, that doesn't give me the possibility to use my index page as a jsp , which is in a different folder from others jsp, (because it tries to include taglibs.jsp, but it is in a different folder from the include prelude, I think you understood).

Thanks for your help

saga
  • 25
  • 7
  • Is your title displayed on the top when the password is wrong? – Ad5001 Jan 20 '18 at 14:38
  • Hi Ad5001, yes it is :) – saga Jan 20 '18 at 14:39
  • If you comment out the line where it prints "identifiant ou mot de passe incorrect", do you still have the issue? – Ad5001 Jan 20 '18 at 14:41
  • I just tried, and yes, still the same issue... – saga Jan 20 '18 at 14:43
  • Have you tried forwarding the request instead of including it when the password is incorrect? – Ad5001 Jan 20 '18 at 14:44
  • OOOOO my god it's ok, i just commented the line "response.setContentType("text/html"); in the else java method, and it works !!! Thx Ad5001, you showed me the way to this !! Should I delete this post ? or leave it ??? – saga Jan 20 '18 at 14:48
  • You can leave it here, but this is a weird bug to be honest... – Ad5001 Jan 20 '18 at 14:52
  • Huummm, in fact it doesn't work... I mean, when I comment the line out where it prints "identifiant ou mot de passe incorrect" AND the line "response.setContentType("text/html")", I have no issue with utf8, but no warning message, and if I uncomment the out.println, I have the source code wich appears, instead of the "normal page"... So i tried to forward instead of include, but nope, it doesn't work... – saga Jan 20 '18 at 14:56
  • Possible duplicate of [jsp utf encoding](https://stackoverflow.com/questions/488448/jsp-utf-encoding). – Sergey Vyacheslavovich Brunov Jan 20 '18 at 19:12

0 Answers0