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?
If I remove button value from button using javascript onSubmit, it works.
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.
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.
Related
I have to create a little webshop for a school-project, but entered in to a problem during the process by updating/refreshing the Servlets.
Description:
I created an index.html file which includes two servlets via iframes, the left side for Navigation-Servlet and on the right the Controller-Servlet does something to show a welcome page (or shows off the categories etc.) - works all fine.
But now I have to implement a login with an small administration.
By clicking in the navigation on Administration, it leads to another Servlet called Administration-Servlet, in the right iframe (actually not over the Controller-Servlet).
There comes up a login mask, where the user put in his username and password. If the login was correct, it leads then to the administration content (not finished by now).
The upcoming problem is now that I somehow have to update/refresh the Navigation iframe too, when the login was successful because there must be the Logout-Button and some entries have to be hidden.
By which "technique" or pattern I can solve this problem? Maybe a little code example would be helpful. :)
Best greets.
Instead of using Iframes to put together the different parts of your site, use dynamic include in your servlets. This will allow you to build the response page server side and therefore dynamically change what is included in a page. When you log in you send the authentication request to the servlet which will then dynamically construct the new response from multiple JSP files.
<jsp:include page="..." />
Another solution is to use a scripting language like Apache Velocity Template scripts to build your responses dynamically. Allowing you to include or exclude information depending on parameters or session context.
I am making a Java application for Liferay. A simple bookstore. Uploading and displaying the app in Liferay works, but when i try to access other pages then the index page itself I get an error.
This is how my application looks like at the moment. If i for instance click on "All books" in the navigation to the left. I get an error.
This is the error I get, as explained earlier. It says "The requested resource was not found."
""
Any help on what to do, would be greatly appreciated :)
Your first screenshot shows /web/student-life, while the second one shows a URL that looks like a servlet URL, not a portlet URL: /book?action=allBooks.
Note that - in the portal world - you'll lose control over the URLs and you'll need the portal to generate them to you. This typically means that they'll be a lot more ugly than the one you're seeing. You can gain back control (through "friendly URLs" in Liferay) but I'd consider this a second (or third) thought if you're just beginning developing portlets.
Create your action URL with <portlet:actionURL .../> and - for the time being - stay on the same page. Once everything works you can extend this to multiple pages.
So, the problem is standard: multiple sessions within one browser (on different tabs).
Current solution: sending JSESSIONID within url: <Context cookies="false">
BUT i hate showing JSESSIONID in every possible url on page and in browser bar. So, there is this crazy idea, to set it by JS in custom header for every request (our app is as a whole driven by ajax, so this is no problem).
The question: is there any 'trivial' solution to this? I know I can (and probably should) implement own session Manager, but maybe someone knows any existing implementations?
Or even better, some other good solution for one-window-multi-session-app?
Ps. enviroment: Java 6, Tomcat 6, Spring 3
I would rather wait for Spring 3.1 Window Management:
http://jira.springframework.org/browse/SPR-6417
I hope this will help/solve Your problem...
P.S:
Basic explanation can be found here:
http://jazoon.com/Portals/0/Content/slides/th_a3_1330-1420_kiener.pdf
I have a java web application. When I log in to that application and navigate to a jsp which has flex chart embeded into it, the chart displayes just fine. I am using blaze ds remoting object mechanism. But when I want to navigate to a different page, it logs me out of application since the login session is lost.
The HTTP session is backed by a HTTP cookie which is tied to a specific domain and by default also the context path. So if you lose the session, then it may be caused by navigating to a different domain and/or context path. It's however also possible to invalidate the session programmatically by calling HttpSession#invalidate().
So to fix your problem, you need to ensure that you're navigating to a page in the same domain and context and that your server side code is not unnecessarily calling invalidate() somewhere.
If the problem is actually caused by a switch in the context path and you'd like to get it fixed, then you need to configure it in the servletcontainer. It's unclear which one you're using, but in for example Apache Tomcat you would like to set the emptySessionPath attribute of the <Connector> element in /conf/server.xml to true. Also see this document.
I've got a struts2 application running under a contextpath "/path" on my local tomcat without problems. When I deploy it on a webserver (using a proxy to redirect from "http://www.domain.com" to "myserver:8080/path/") Struts does all kinds of strange things.
First, it includes the context in -tags. That can be turned off by an attribute. But sadly, it also includes the path in the action attributes of my forms, so a login form points to "http://www.domain.com/path/login.action" instead of "http://www.domain.com/login.action" ...
Is there a possibility so somehow change the default context that is added here or turn this off for forms? (I'd like to keep the -tags, only way round seems to be to use default HTML forms.) Thanks in advance!
I found that others also had the problem, but the framework makers don't seem to think that this is an issue. My solutions:
use includeContext="false" in all s:url-tags
instead of the s:form tag, use a usual form, set the action to "actionname.action" and include a simple table with tablerows () for each field. You still can use s:textfield and such.
sadly HTTP sessions won't work anymore as they get set for the path "/path" (the ApplicationPath). This is due to the cookie that saves the JSESSIONID being set to /path. This means that your visitors will only get session variables stored when they're at http://www.domain.com/path/login.action and that those will be lost when they get redirected back to http://www.domain.com/interestingstuff.action ... my solution is a hack that requires setting the JSESSIONID cookie clientside via JavaScript as described here: Struts2: Session Problem (after reverse proxy)
Hope this helps someone ... if you find nicer solutions, please let me know. :-)
Though am answering very late to this question, but I reached this page recently when I was facing the same problem.
The application that I was working upon was appending the context-root viz. 'myContextRoot' to my url on localhost and it was working perfectly there. For eg., as mentioned above the action 'myAction' was becoming
http://localhost:8050/myContextRoot/myAction.action
But the moment I deployed it on a server, it stopped working, then after searching like hell, I found a solution for me. I am deploying an EAR file on glassfish and there we have a file application.xml. In application.xml I had a tag 'context-root' whose value was 'myContextRoot' which I changed to '/' and after that I got my url as on localhost and
Hope it may help :)