I am using the CQ5 out-of-the-box search component. My problem is that the error pages are getting displayed in the search results.
May I know how I can restrict error pages from getting displayed in the search.
Do we need to add a new property for the page so that it can be restricted by QueryBuilder?
If you are unable to separate content that you do not wish to be index from that which you do, the search indexer can be configured to ignore certain content or attributes within specified content. This is described in some detail on the "How to modify the search engine configurations in CQ5 page on the Adobe CQ Help site.
Essentially, attributes can be ignored by the indexer by adding them to the indexing_config.xml file like so:
<index-rule nodeType="nt:base">
<!-- ... existing ignored properties -->
<property nodeScopeIndex="false">mySecretProperty</property>
</index-rule>
The following should exclude pages of a nodes with a specific resourceType and their descendents.
<index-rule nodeType="nt:base" condition="#sling:resourceType='app/components/errorPage'" />
<index-rule nodeType="nt:base" condition="ancestor::*/#excludefromindex='app/components/errorPage'" />
The Jackrabbit Indexing Configuration page has some more details on the syntax of this file.
Content will not automatically be re-indexed, details of how to trigger a reindex can be found here.
In the dialog box where you configure your search results component instance (which would be on your search results page), look for a field called "Path to search in." This maps to a property in the CRX called searchIn. Set this property to a subtree of your content that excludes your error page(s). For instance, if you set up your content tree to be
/content
/searchable-content
home-page
...
/error-pages
404
401
...
In this case, you would set your searchIn to be /content/searchable-content.
Related
In my grails application I need to set html tags to the session. For example
session.setAttribute("message","<font color=\"green\">Successfully Processed</font>")
but when I am fetching the value from the GSP (like ${session.message}) the opening and closing tags get changed to <
So the whole text gets printed as such. Why?
This is due to encoding. The documentation explains the details and why. In your case you want to use raw like this:
${raw(session.message)}
I'm using Hippo CMS.
After unsuccessfully using HST SEO support plugin, I realised that HstResponse::addHeadElement did not have any effect on my HTML pages.
For instance, when adding the following lines in a component's code:
Element title = response.createElement("title");
title.setTextContent("Foo");
response.addHeadElement(title, "hst.seo.document.title");
I would expect the corresponding <title>Foo</title> markup to be included in the response, but it is not.
What did I miss?
The problem is that I didn't have an appropriate hst:headContributions node in the layout file.
I had two of them for two different categories:
<hst:headContributions xhtml="true" categoryIncludes="headerNav" />
and
<hst:headContributions xhtml="true" categoryIncludes="styles" />
But the plugin doesn't use any category for its head contributions.
Adding the following line in my JSP template fixed the issue:
<hst:headContributions xhtml="true" categoryExcludes="headerNav,styles" />
Hi im working with jboss on a webapp. I got one page that is similar to forum page where you can post messages and reply to already posted ones. In my jsf i have three div tags one for adding new message one for listing all messages and one for viewing selected message. All the tags are embedded in and there is render attribute on every tag something like this:
<h:pannelGroup rendered="#{myController.shouldRender('add')}">
<!-- Here is my html for adding new message -->
</h:pannelGroup>
<h:pannelGroup rendered="#{myController.shouldRender('list')}">
<!-- Here is my html for listing messages -->
</h:pannelGroup>
<h:pannelGroup rendered="#{myController.shouldRender('view')}">
<!-- Here is my html for viewing message and its replys..
also there is hidden div with html for popup to post reply -->
<div id="reply">
<!-- This is hidden html that is shown when clicked reply
link in the message div below.
When shown users can add reply to the message -->
</div>
<div id="message">
<!-- Here is show the message itself -->
</div>
<div id="replyList">
<!-- Here is list replys for the message currently beeing viewed
For listing the replys i used ui:repeate and c:forEach from the jstl core
both resulting with same outcome.
In my message object i have list of replys which i load lazily...
-->
</div>
</h:pannelGroup>
My backing bean, stripped of all the annotations and rest of the code...
MyController{
String page;
public boolean shouldRender(String view){
return page.equals(view);
}
}
The page property i set with actionListener from list of menu items, before i redirect the user to the message.xhtml page i set myController's property page to the div name i want to view, so for e.g. if i click the add link i set the page = "add" and redirect to the message.xhtml. There the controller picks up the page set from outside and renders the add div.
Because i couldn't manage to get extended persistence context working, i set filter on /* to open user transaction and then merge the entity manager with that one, after the chain.DoFilter i commit my transaction. This i needed to enable lazy loading by hand..
The problem is that when i add reply message, the list with replies does not get refreshed immediately, i need to go back to the message list and then again open the same message in the view div to get the list of replies refreshed.. or... in the method for adding reply i tried to manually load my reply inside the list of replies owned by the message object (which are lazy loaded and mapped #OneToMany) and this way it works but i don't like that solution.
Can someone tell me weather hibernate is reloading the lazy loaded list because i manage the transaction and i assume that once it loaded my list, it doesn't refresh it on it's own.
When the list is modified in the same session, it is updated.
When the list is modified in a different session, it does not get updated.
As the session object is not multi-thread safe, in your environment probably every user has his own session instance, so you'll be in the second case. To force a refresh, you can evict() the parent instance and load() it again, or you clear() the session or you create and use a new one.
Pay attention with lazy loading. As the child elements are loaded on first usage (and not together with the parent instance), they can already reflect to a modification which was not yet made when the parent object was loaded.
I would like to basically do what Jason asked for here
In one sentence, I would like the url bar to represent the state of the AJAX application so that I can allow to bookmark it as well as allow the user to return to the previous state by using the back/forward buttons in the browser.
The difference for me (From what Jason asked) is that I am using JSF 2.0.
I've read that JSF 2.0 added the ability to use get, but I am not sure what the correct way to use this.
Thanks for the help.
Further Clarification
If I understand correctly, to be able to bookmark specific states in the AJAX webapp I will have to use the location.hash. Am I correct? I'm trying to achieve a gmail-like behaviour in the sense that, while the app is complete AJAXified and no redirects occur, I can still use Back/Forward and bookmark (And that's why I would like the URL bar to be updated from the AJAX app itself and not through redirection)
Update
Just found this similar question
The difference for me (From what Jason asked) is that I am using JSF 2.0. I've read that JSF 2.0 added the ability to use get, but I am not sure what the correct way to use this.
Please note that this is not the same as maintaining the Ajax state. It usually happens by fragment identifiers (the part starting with # in URL, also known as hashbang). JSF doesn't offer builtin components/functionality for this. As far I have also not seen a component library which does that. You may however find this answer useful to get started with a homegrown hash fragment processor in JSF.
As to using GET requests, just use <h:link>, <h:outputLink> or even <a> to create GET links. You can supply request parameters in the h: components by <f:param>. E.g.
<h:link value="Edit product" outcome="product/edit">
<f:param name="id" value="#{product.id}" />
</h:link>
In the product/edit.xhtml page you can define parameters to set and actions to execute upon a GET request
<f:metadata>
<f:viewParam name="id" value="#{productEditor.id}" />
<f:event type="preRenderView" listener="#{productEditor.init}" />
</f:metadata>
In the request or view scoped bean associated with product/edit.xhtml page -in this example #{productEditor}-, you just define the properties and the listener method. The listener method will be executed after all properties are been gathered, converted, validated and updated in the model.
private Long id;
private Product product;
public void init() {
product = productService.find(id);
}
Normally you'd use AJAX to prevent complete page refreshes. AFAIK all current browsers would issue a page refresh if you change the base uri. Thus you would have to use the hash part as suggested in the question you provided.
We had a similar problem and did something like this:
We settled for the fact that users cannot bookmark the url.
For URLs that should be unique/bookmarkable we used different links that issue a redirect. Those URLs are provided in a sitemap.
For browser back, we added an intermediate page after login. This page does navigation and a redirect to the application. The navigation is stored in the session and when the server gets a navigation request (which can be a history back) the corresponding state is restored. A browser back opens that intermediate page which issues a redirect along with a navigation request on the server side.
Have simple composite component(compositeComponent.jsf),that is embedded to global.jsf page.
The problem is that ajax can't update this component.
Neither :componentId, not formId:componentId declaration doesn't work.
Should i write own method generator in my bean for id generation?
see pic. for more info!
Open page in browser, rightclick and choose View Source. Locate the generated HTML of <h:outputText> and determine its generated client ID. You should in fact be using exactly this ID with the : prefix. Let's bet that the first part of the ID turns out to be autogenerated. This can happen if you didn't give your composite component a fixed ID. You need to do this as well:
<my:compositeComponent id="ccId" />
then you can locate it as follows:
<p:ajax update=":ccId:cCart:cId" />