简体   繁体   中英

IE9 sending HTML in button value from JSF to the server

My Environment:

  • Primefaces 4.0 or Primefaces 5.0
  • JDK 1.7
  • Jboss7.1.1
  • JSF 2.2
  • Internet Explorer 9
  • J2EE1.6

When a form is submitted from IE9, IE sends back HTML text of tag as part of button value from JSF page to the JSF servlet. This is causing servlet container to behave strangely, and not call methods on managed beans to process further. This works just fine in Firefox or Chrome browsers. Here's the button value looks like from the server log:

contentForm:saveButtonId=<SPAN class="ui-button-icon-left ui-icon ui-c ui-icon-disk"></SPAN><SPAN class="ui-button-text ui-c">Save</SPAN>

On the form the button value is just "Save". All the buttons are coming in with above html text in value.

What have I tried so far?

  1. If I remove button value from button using javascript onSubmit, it works.
  2. I tried to add a servlet filter to add a servlet request class wrapper which would change the button value if it had in it, but it does not work. My assumption is JSF framework uses default servletRequest class as opposed to my wrapper class so the cleaned up parameters values are not used.
  3. I was hoping to subclass FacesServlet but I cannot as it is final class.

Please let me know what my options are as it is really affecting our application in production environment and I am running out of time and options.

In order to reproduce it, first IE security settings must be set properly. Our settings are: IE9->Tools-->Internet Options-->Securty-->Local Intranet is selected Click on sites button and Automatically Detect intranet is selected. Click on Advanced button and add currently selected web app url to the websites list. For eg mine was added as http :// IpAddress_Or_DomainName_Of_WebApp

If the url is not added to above list of intranet sites, then IE behaves properly. Our production url is a intranet site and has been added to the list for additional security features. I cannot change that as it is a company wide policy, but i am hoping there is something I can do from JSF or Javascript or from servlet end to fix this.

Appreciate any help in this regards.

If I remember correctly, IE9 and above defaults to simulating IE8 behavior on intranet sites. If you go to Settings -> Compatibility View Settings and uncheck "Display intranet sites in Compatibility View" that should stop happening.

OK, I got it working. I got the answer i needed in primefaces forum. One kind respondent saved me just in time. He suggested me to add metadata header tag to force IE8 behavior. And also suggested here IE8 standards mode meta tag Thank you all.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM