English 中文(简体)
JSF problem with FireFox 3.5 caching, wyciwyg:// prefix
原标题:

I am new to JSF and have a problem with my simple JSF application. I use Facelets and Richfaces on WebLogic 10.3.2 (11g). The application is essentially 3 pages:

A <--> B <--> C

where the intermediate arrows denote navigation rules. The navigation is performed through a4j:commandButtons The problem is in Firefox 3.5, when I click from B to C, I get a url starting from wyciwig://. In more detail, the starting url is:

http://localhost:7001/myapp/index.faces

and the url I get when I navigate from B to C is this:

wyciwyg://20/http://localhost:7001/myapp/index.faces

From a Google search I saw that wyciwig is WhatYouCacheIsWhatYouGet, so the issue is probably related to caching. In that direction, I did two things:

A. I added the following meta tags:

<meta http-equiv="Pragma" content="No-cache"/>
<meta http-equiv="Cache-Control" content="no-store,No-cache,must-revalidate,post-check=0,pre-check=0,max-age=0"/>
<meta http-equiv="Expires" content="-1"/>

B. I added a PhaseListener to add HTML header tags, as suggested here.

Unfortunately, the problem persists.

Another thing that could be related is that for some reason my navigation does not change the url that appears in the address bar of the browser. The links that appear in the status bar when I hover the mouse over the a4j:commandButtons is always

http://localhost:7001/myapp/index.faces#

So the questions are the following:

  1. Why does this wyciwyg://20/ prefix appear, and how can I overcome this?
  2. What can I do to change the url when navigating from page to page? Will this make the "Back button work"?

Cheers!

UPDATE 1: These guys here (text in Portuguese) say that replacing all a4j:commandLink with a4j:htmlCommandLink fixes the problem. I did, and they are right. I don t understand the reason, through.

最佳回答

Actually the answer is fairly simple and explained in the RichFaces FAQ which I suggest you read thoroughly!

The ajax components are not designed for page navigation and will not work when used this way.

See http://community.jboss.org/wiki/CommonAjaxRequestsProblems#navigation

The reason a4j:htmlCommandLink works is that it is not really an ajax component but a plain old HTML link tag.

Hope that helps explain things.

问题回答

This is more a Firefox problem than a JSF problem. You should in fact never see those links in the address bar. Likely your Firefox environment or one of its plugins is messed up. Try this troubleshooting guide. If in vain, uninstall everything and reinstall Firefox clean. You can eventually also test on a phyisically another machine with Firefox to see if it is actually caused by Firefox or your webapp.

This is a partial answer, meaning it shows how to work around the problem, but does not explain why it occurred in the first place.

In order to clarify which components cause this problem, I replaced each button with 5 components:

  • a4j:commandButton
  • a4j:commandLink
  • h:commandButton
  • h:commandLink
  • a4j:htmlCommandLink

Each component has the same action. The ones that do not work are the first two (a4j:commandButton, a4j:commandLink). The others do not present any problem. So, in order to avoid it, use any of h:commandButton, h:commandLink, a4j:htmlCommandLink.

About the URL not showing correctly, it seems to be a known issue of JSF 1.2 (possibly solved in 2.0), as explained here and here. This problem is solved using frameworks / libraries such as Seam, PrettyFaces or others.

You can try this way:

  1. Open Mozilla
  2. Type in AddressBar: about:config
  3. Set browser.cache.memory.enable = FALSE
  4. Restart browser
  5. Load your page and try!

Good Luck! :)

Had the same problem, the url didn t update on navigation.

Added a redirect tag inside each of the navigation rules inside faces-config.xml solved my problem.

Solution found in the following url:

http://www.java-samples.com/showtutorial.php?tutorialid=603





相关问题
Write-though caching of large data sets in WCF?

We ve got a smart client that talks to a SQL Server database via WCF, displaying the entities in the database, and allowing the user to edit those entities. Some of the WCF calls return a large data ...

Clearing RSL in Cache

I have built a flex application which has a "main" project and it is assosciated with a few RSL s which are loaded and cached once i run my "main" application. The problem i am facing is that the ...

how to tell clicking "back" to load cache?

I would like for my site when someone clicks "Back" or "Forward" for the server to tell the browser to load the cache instead of reloading the entire page. I ve tested some headers and done research, ...

java plugin cache and dynamic IP host

I m trying to use Amazon S3 and Amazon Cloudfront CDN to deliver the jar files of my applet application. I m seeing several cache misses of my jars by the java plugin. This is a show-stopper for me, ...

Frequently Used metadata Hashmap

Are there any implementations of a static size hashtable that limits the entries to either the most recently or most frequently used metadata? I would prefer not to keep track of this information ...

PHP - Memcache - HTML Caching

I would like to create a caching system that will bypass some mechanisms in order to improve the performance. I have some examples: 1-) I have a dynamic PHP page that is updated every hour. The page ...

Performance of Sql subqueriesfunctions

I am currently working on a particularly complex use-case. Simplifying below :) First, a client record has a many-to-one relationship with a collection of services, that is, a single client may have ...

热门标签