Prettyfaces url style search gmail - jsf

Good day:
I am conducting a search using prettyFaces, style gmail.
When I do with gmail, space is replaced by a symbol "+". And in the box is not added the "+".
In my case, when I do the same, in other characters url as in my box are added.
Here the mapping code, and box:
<url-mapping id="search">
<pattern value="/buscar/#{ /.*/ searchBean.q}" />
<view-id value="/faces/reqs/search.xhtml" />
<action>#{searchBean.search}</action>
</url-mapping>
<div class="search">
<h:form id="searchForm">
<span class="button-group">
<p:inputText value="#{searchBean.q}" size="50"/>
<p:commandButton action="pretty:search"/>
</span>
</h:form>
</div>
Thanks for the help.
EDIT:
And if facebook would be because it is a parameter? and as it would be a solution to avoid aparesca special characters in the input?

This is expected behavior. In case of GMail the spaces are part of the "fragment" which is the part after the "#" character. In your PrettyFaces setup, the search term is part of the path.
There are different encoding rules for fragments and path parts of the URL. So PrettyFaces is handling this correctly.

Related

<content:link> is showing error text if there is no URL

I got on my website a Image that has to be clickable. Everything works fine, but only in cases on the current website a URL is provided for the Image. If there is URL, there appears a error message that ruins the content of the website.
How can I make the error message not display.
Here is code. Thank you!
<content:link link="#{cc.attrs.teaser.teaserLinkModel}" value="">
<content:graphicImage graphic="#{cc.attrs.teaser.graphic}"
renderDimensions="false" />
</content:link>
Well, I got a solution.. The thing is, I'm working on someone elses code and didn't know what of options (functions) there already exist. After analysing the code, a saw there is the "rendered" attribute that behaves just like a "if" condition checker.
Anyways, here is my solution to this problem, maybe it helps someone.
<!-- Image is link -->
<h:outputLink rendered="#{cc.attrs.teaser.hasTeaserLink}">
<content:link link="#{cc.attrs.teaser.teaserLinkModel}" value="">
<content:graphicImage graphic="#{cc.attrs.teaser.graphic}" renderDimensions="false" />
</content:link>
</h:outputLink>
<!-- Image is no link -->
<ui:fragment rendered="#{not cc.attrs.teaser.hasTeaserLink}" value="#" >
<content:graphicImage graphic="#{cc.attrs.teaser.graphic}" renderDimensions="false" />
</ui:fragment>
For "Image is no link" I didn't use the "h:outputLink" tag, because it puts a ">" char in front the image and ruins the page content.
This maybe not the best solution, but it did work for me.

StripFilter in Liferay 6.1.1 GA2 doesn't strip white space

We're using the StripFilter property in our production systems:
com.liferay.portal.servlet.filters.strip.StripFilter=true
but on the most pages the markup isn't properly stripped (some parts like navigation has massive whitespaces, others like head are fine) or worst case the whole markup is not stripped!
Those non stripped pages have up to 20k lines of source code (mostly blank), which causes poor performance in browsers.
Mostly appears when pages requested as guest user, but this is not reproducible.
Also when we undeploy all webapps, this problem occurs.
How we can investigate this problem?
Is this a common issue?
If some part of the beginning of your page is actually stripped and the rest is not, then the filter tripped over your html. Maybe you have an error in your html code. Or the strip was simply too stupid.
Remember that you must (because of the filter) close input tags with a /> If you do not, the filter looks up the next /> and does not strip anything between!
Example
<input name="bla">
<p> hello world,
<br />
<span> you are </span>
beautiful. </p>
This will lead to the following output, because the closes the
<input name="bla">
<p> hello world,
<br /><span>you are</span> beautiful. </p>

URL rewrite for JSF

I'm using JSF, Jboss. I used urlrewrite filter and i don't know why:
when i type localhost:8080/myweb/user/myname will be forwarded to localhost:8080/myweb/user.xhtml?u=myname. it makes me don't like urlrewritefilter.
After that, i try using prettyfaces. Maybe, it is good for others, not me. i can't find out good tutorials except the documentation. ajax error after adding prettyfaces into my project. And some codes in pretty-config.xml
<url-mapping id="ideas">
<pattern value="/article/#{g}" />
<view-id value="/ideas/article.xhtml" />
</url-mapping> -->
And a form in jsf page will redirect this page with param
public String addUserToGroup() {
...
return "/ideas/article.xhtml?g=" + g + "&faces-redirect=true";
}
can't run.
Can you give me some advices about what library i should use to rewrite URL now. Or how to fix errors of prettyfaces. thanks
Is your configuration commented out? I noticed the '-->' in your code snippit.
<url-mapping id="ideas">
<pattern value="/article/#{g}" />
<view-id value="/ideas/article.xhtml" />
</url-mapping> -->

Primefaces rich editor

I'm using primefaces(3.0.M2) rich editor for receiving input from user. The restriction is 5000 characters. When user tries to copy from external sources or beautify the content additional tags are getting added to preserve the format.
Now to validate the max length of 5000, I need to strip out the tags and only count the characters length. How to get the characters alone from in managed bean for validation?
client side validation snippet:
<p:editor id="customerInfo" value="#{companyBean.body}"
required="false" requiredMessage="Info required" height="250" width="450"
validatorMessage="Only 5000 characters allowed">
<f:validateLength maximum="5000" />
</p:editor>
Just to help others like me, which tried to find some answer too!
You can user wigdteVar to access the editor value, like this:
<p:editor
id="iptTextoClausula"
widgetVar="wvMyEditor"
width="790"
height="200"
validator="clausulaEditorValidator"
value="#{clausulasContratadasBean.selectedClauseFull.dsTexto}" />
<script language="Javascript">
wvMyEditor.editor.doc.body.innerText
</script>

Showing a parameterized string for localization purpose

Is there a way to have a parmeterized string in resource bundle? I need this as the order of nouns can be different in different languages.
For e.g. in my English bundle I will have
love_message={0} loves {1}
And my Latin translator will pick it up and do
love_message={0} {1} amet
And in my page I will have something like
<h:outputText value="#{bundle.love_message,John,Jenny}" />
(If this would have been possible)
So that my English translated page reads
Jonh love Jenny
And Latin page reads
John Jenna amet.
How can I achieve this?
Use <h:outputFormat> instead of <h:outputText>. It can take those parameters as <f:param>:
<h:outputFormat value="#{bundle.love_message}">
<f:param value="John" />
<f:param value="Kenny" />
</h:outputFormat>

Resources