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

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.

Related

Prettyfaces url style search gmail

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.

How to customize search container emptyResultsMessage in lifray?

I want to display the message with a jsp page in search container emptyResultsMessage.
Presently my code is:
<liferay-ui:search-container delta="10" emptyResultsMessage="There are no results." iteratorURL="<%=iteratorURL %>" deltaConfigurable="true" var="searchContainer" >
Now when I want to display
There are no results.+ button.jsp
in emptyResultsMessage.
In button.jsp I have a button. It has to display when emptyResultsMessage is empty.
Can any one tell me how to display it?
<liferay-ui:search-container delta="10" emptyResultsMessage="there were no courses found please <jsp:include page='subscribeSearch.jsp' /> with us" iteratorURL="<%=iteratorURL %>" deltaConfigurable="true" var="searchContainer" >
<liferay-util:buffer .../> is your friend. You don't seem to care for internationalization, so the easy approach is this: Construct the message before, then just use it:
(untested pseudocode, don't expect it to work out of the box)
<liferay-util:buffer var="emptyMessage">
there were no courses found please
<liferay-util:include
page="subscribeSearch.jsp"
/>
with us
</liferay-util:buffer>
<liferay-ui:search-container delta="10"
emptyResultsMessage="<%=emptyMessage%>"
iteratorURL="<%=iteratorURL %>"
deltaConfigurable="true"
var="searchContainer"
>
....
IMHO I'd construct the whole message on that jsp page rather than just fragments. But I'd also use proper i18n, but you get the basic idea from this.
Also, check if you need to escape the string (e.g. use <%=HtmlUtil.escape(emptyMessage)%>). I'm not sure which order the processing is done out of the top of my head (can't test currently)

Umbraco 4.7.0 Macro not rendering when inserted via Richtext editor

I am using umbraco v4.7.0. I have created a Macro for a Usercontrol.ascx and adding it the usual way, and ticking the option "Use in editor".
It renders fine in the RTE, but then when viewing the page it does not load the macro.
I have googled for a while now and cannot find a solution to this problem, also I have been on the umbraco forum/bug lists to see that there are various posts but I havent found a solution to this yet.
Am I missing something simple here? This worked fine in previous versions.
Got an answer finally........in the template masterpage use:
<umbraco:Item field="bodyContent" runat="server"></umbraco:Item>
instead of something like
#Model.bodyContent
So that the macro (the one added via the RTE) itself isn't added by another macro (in this case the one displaying "bodyContent" field).
If, as explained in the initial question, what you see in your HTML is something like
<?UMBRACO_MACRO macroAlias="macroNameHere" />
...and you don't see anything rendered. Then this is a solution for you:
Inside the XSLT (macro) that processes your document type, you may have something like this:
<xsl:value-of select="$currentPage/bodyText" />
Change it to:
<xsl:value-of select="umbraco.library:Item($currentPage/#id,'bodyText')" />
This will render the macro contained in your bodyText.
Please note that umbraco will create a DIV around the macro output. To get rid of that DIV you have either to modify the umbraco source code, or do for example a jQuery search and replace to get rid of it.
You're usercontrol probably requires
<form runat="server">
Try inserting it in the template instead - that created a server error for me, and I found the problem!
Something like this:
<form runat="server">
<asp:ContentPlaceHolder ID="mainContent" runat="server" />
</form>
Where You put Your usercontrol in the placeholder.
To Use Macro in Richtext box
you must check the “Use in editor” checkbox under “macro properties” tab.
And In XSLT when you are printing macro value used following
<xsl:value-of select="umbraco.library:Item(#id,'bodyContent')" />
to render macro value.
Instead of
<xsl:value-of select="bodyContent" />

Capybara not finding submit button by name

I have some weirdness occurring while trying to switch from webrat to capybara. The error is this:
And I press "Create floob"
# features/step_definitions/web_steps.rb:27
no button with value or id or text 'Create floob' found (Capybara::ElementNotFound)
The html in my app looks like this:
<fieldset class="buttons">
<ol>
<input id="floob_submit" name="commit" type="submit" value="Create floob" />
</ol>
</fieldset>
I would have thought that capybara would look at the value of the buttons on the page, and reading the documentation this does seem to be the case, but it's not working! If I change the line in my cuke file to And I press "floob_submit" everything works, but I'd rather not change all my features...
Does anyone have any thoughts on why this might be happening and if there's a fix? Thanks friends!
The only thing I can see is that you aren't wrapping your input in an <li></li>. This might be confusing enough for the DOM to cause your problem.

Hidden Input Field causes potentially dangerous Request.Form value error

In my ASP.NET 1.1 application, I am compressing and replacing the hidden Viewstate variable with an alternate compressed value, stored in a hidden field called __VSTATE. This works well but on a few occasions, submitting a page causes the common "potentially dangerous Request.Form value ..." error.
I examined the __VSTATE value and nothing seems to be potentially dangerous. I was able to reproduce the error with a completely stripped down version of the page and __VSTATE value as shown below. Pressing the submit button causes the error. The page works fine if I change the value to "".
<%# Page Language="vb" AutoEventWireup="false" Codebehind="Dangerous.aspx.vb" Inherits="Dynalabs.Dangerous" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body MS_POSITIONING="FlowLayout">
<form id="Form1" method="post" runat="server">
<input type="hidden" id="__VSTATE" runat="server" value="Onw=" />
<asp:Button ID="btnSubmit" Runat="server" Text="Submit" />
</form>
</body>
</html>
Changing the field name to "MyHiddenWT" made no difference. Removing the runat="server" did stop the error but that just means that .NET only examines server side controls. I also tried some additional values and found that of the following:
"Anw=", "Bnw=", "Cnw=", ... "Nnw=", "Onw=", "Pnw=", ... "Znw=",
"Onw=" is the only one that causes the problem. Is the captial O being seen as an octal value somehow?
Can someone explain why this value is triggering the error message? I'm also looking for a solution but, please, do not tell me to remove page validation. That's the same as saying a car with bad brakes can be fixed by not driving the car.
Thank you in advance.
My first guess is that it looks like a "OnSomething=" javascript event declaration.
It's a little weird that only the capital O triggers the error, did you test on the lowercase o as well?
Can you try these: "OnClick=", "abc OnClick=", "onclick=", "abc onclick=", "anw=", "bnw=", ...
If "OnSomething=x" javascript is a problem, then simply adding another character to your values should do the trick. Maybe a simple 'v' should do.
<input type="hidden" id="__VSTATE" runat="server" value="vOnw=" />
And then on submit, you remove the extra character before decoding.
Or better yet, upgrade to 2.0.
You've got the essence of the reason. Here's the best link in a response I got from another site:
http://groups.google.com/group/microsoft.public.dotnet.framework.aspnet.security/browse_thread/thread/d91d89511401e979

Resources