I am using modal box plugin with grails. The problem is that the link that it creates does not always call the server side code.
here is the link on the page
<modalbox:createLink
controller="company"
action="setChangeCompanyAdmin"
absolute="true"
mapping="changeAdmin"
id="${companyInstance.id}"
title="Change Primary Admin"
width="600"
linkname="Change Primary Admin" />
The action in the controller is preparing a list in the certain way to be displayed in the popup that the modal box opens. But the problem is that the server side is not being called every time, only in IE.
I have tried absolute and specifying a mapping as well but to no avail.
Also i have set the page attributes in the gsp page to not cache the data at all.
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
But even this does not seem to work.
Any help is much appreciated.
Adhir
The browser is still caching your request. You can add a parameter of the current time stamp to the request.
<modalbox:createLink
controller="company"
action="setChangeCompanyAdmin"
absolute="true"
params="${cacheKiller: new Date().time}"
mapping="changeAdmin"
id="${companyInstance.id}"
title="Change Primary Admin"
width="600"
linkname="Change Primary Admin" />
It is probably IE caching the response. If you want to disable caching via the controller's response object, the following code should work:
response.setHeader("Pragma", "no-cache")
response.setHeader("Cache-Control", "no-cache, no-store")
Related
I have wix website. I do want to create a page with a custom url.
So briefly I want all the url with
www.somedomain.com/books/*
to be redirect to my created wix page.
Any way possible.
Url Example:
When ever user types url such as:
www.somedomain.com/books/1
www.somedomain.com/books/2
www.somedomain.com/books/3
www.somedomain.com/books/4
www.somedomain.com/books/5
www.somedomain.com/books/6
then the redirection should be to my created page on Wix whose url is: "www.somedomain.com/books"
Assuming you meant you have full control over www.somedomain.com/books/, you could redirect using HTML.
Go to the head tag --> add the code:
<meta http-equiv="refresh" content="0; url=YourWixSiteHere.com" />
if you want to make this shorter, I'm not sure how
I've set up a new OSS to handle search on a forum. The basic setup was rather straight forward but upon tweaking it I've gotten stuck. The issue is that the pages have a custom meta tag like this:
<meta name="searchtype" content="construction_collection" />
I have set up a field in my Schema with the same name and then added it to the returned fields in the query. However that tag in the result xml is always empty:
<result name="response" numFound="173" collapsedDocCount="0" start="0" rows="10" maxScore="2357,006" time="6">
<doc score="2357,006" pos="0" docId="4008">
<field name="searchtype"/>
and I fail to comprehend how to setup the Parser and Crawler in order to connect these. Some threads here insinuate that it should work automatically, but it doesn't. Surely I need to set up something more. What have I missed?
/Simon
By default, the HTML parser of OpenSearchServer try to extract only the visible information of the Web page.
It is possible to retrieve information stored in meta only if they use a specific syntax. Your meta should be in the form:
<meta name="opensearchserver.field.searchtype" content="contruction_collection" />
You can also populate several fields:
<meta name="opensearchserver.field.searchtype.anotherfield" content="contruction_collection" />
According to this: http://java.net/jira/browse/JAVASERVERFACES-2136 flash-"scoped" messages should survive a redirect to a page on a different path.. I wanted to use something like this in my application so i downloaded javax.faces-2.1.14-20121003.074348-10 snapshot from here
https://maven.java.net/content/repositories/snapshots/org/glassfish/javax.faces/2.1.14-SNAPSHOT/ to test.
My situation is this: I have a page (call it test.xhtml) in the root directory that in the view-scoped backing bean during the call of the constructor does a check and conditionally sets a message using Omnifaces Message.addFlashGlobalInfo and redirects to index.xthml also in the root directory using Omnifaces Faces.Redirect() (thanks BalusC!). In index.xhtml i have a Primefaces
<p:messages id="msg" showDetail="false" autoUpdate="true" />
I use the same "configuration" described above in other pages as well and it works fine when the redirect is done to the same page called the bean method.
So shouldn't the message survive the different path redirect or did i misunderstood something about this issue?? maybe there is something else wrong here??
Thanks in advance! (i'm looking forward hearing BalusC opinion on this btw :) )
i just used to call an init method that does sets message and redirects but again no message appears!! so i don't think PostConstruct will work either..
Indeed, the <f:event type="preRenderView"> is too late to set a flash message. The flash scope can't be created when JSF is currently sitting in render response phase. You basically need to set the flash message before render response phase. In spite of the name preRenderView, this event is actually fired during (the very beginning of) the render response phase.
The #PostConstruct may be on time, provided that it's not been called during render response. This however won't work very well together with <f:viewParam>.
To fix this, as you're using OmniFaces already, just use <f:event type="postInvokeAction">.
<f:metadata>
<f:viewParam name="some" value="#{bean.some}" />
<f:event type="postInvokeAction" listener="#{bean.init}" />
</f:metadata>
See also:
JSF - Keep Faces Messages after redirect from #PostConstruct
Adding faces message to redirected page using ExternalContext.redirect()
So I have a ViewExpiredException Handler and works fine.
Now, when I launch the web-app my URL looks like www.myApp.com/TestFaces/ and this presents the first page which is the login page.
If for any reason I leave the page at login, and the View expires the app catches the ViewExpiredException and sends me to a page "ViewExpired" BUT the URL keeps the same www.myApp.com/TestFaces/. On that "ViewExpired" page I have a commandLink to return to the login page which in the value attrib I put "index.xhtml" BUT it does not send me to login page because on there's no page on www.myApp.com/TestFaces/index.xhtml but in www.myApp.com/TestFaces/faces/index.xhtml
So the questions are:
Why if I'm at login page am I getting the ViewExpiredException? is it because of ajax?
How or Where can I make the commandLink really sends me to index.xhtml?
This is only happening when the View expires in login page, in other pages from my app it works really great.
Thanks in advance !
Why if I'm at login page am I getting the ViewExpiredException? is it because of ajax?
You will get this exception when you invoke a POST request on a view which does not exist in session anymore. This can for example happen when you keep the page open for too long that the session has expired in the server side, or when you're getting the login page from the browser cache instead of straight from the server. For more detail, see also our ViewExpiredException tag info page. All JSF ajax requests also accounts in this as they also use POST.
How or Where can I make the commandLink really sends me to index.xhtml?
Make use of implicit navigation. This way JSF will append the proper FacesServlet mapping.
public String goToIndexPage() {
return "index";
}
or
<h:commandLink value="Go to index page" action="index" />
or, better, when you don't need to invoke any business logic at all:
<h:link value="Go to index page" outcome="index" />
See also:
Check if session exists JSF
When should I use h:outputLink instead of h:commandLink?
I'm writing a survey designer asp.net mvc. It has buttons to move questions up and down. The buttons post the whole form back and the affected questions are swapped on the server. When the form returns the only thing that is changed are the values for each survey question. Both firefox and IE seem to ignore this change.
Nothing is persisted to the database (until save) and url doesn't change so the post just returns the same view but I've stepped through my code to ensure the sequence of values being rendered in the view reflects the swap which is ok. However "view - source" doesn't show the change suggesting caching issue (maybe auto complete).
I've tried autocomplete="off" in my form.
Response.Cache.SetNoStore(); in my global.asax
[System.Web.Mvc.OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")] before my controller
and the following in my page header
<meta http-equiv=="CACHE-CONTROL" content="NO-CACHE" />
<meta http-equiv=="PRAGMA" content="NO-CACHE" />
<META HTTP-EQUIV="EXPIRES" CONTENT="0" />
I also tried putting a random query value in my url.
NOTHING!!! This must be real common.
Anyone got a clue?
Redirect to GET seems to fix it using TEMPDATA to pass the model that was posted from the client to the [HttpGet] view.
I don't know why browsers favor their cached input field values over what is returned from the POST yet give an honest representation of what is retrieved from a GET.
I just hope my users never hit refresh on a survey they are working as they will loose it as the TEMPDATA is blown away. This might actually be what they'd expect though and I generally like "POST then redirect to GET" as it prevents potentially damaging re-posting.