So as the title says, I made a declarative component but when I add it to a web page it just displays the tag, and not the content
My tag
> <?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<af:componentDef var="attrs" componentVar="component">
<af:goImageLink id="cm" icon="/img/contextmenu.gif" destination=""
rendered="#{attrs.showPopup}">
<af:showPopupBehavior popupId="contextMenu" triggerType="click"
alignId="cm" align="endAfter"/>
</af:goImageLink>
<af:popup id="contextMenu" contentDelivery="immediate" launcherVar="source"
eventContext="self" rendered="#{attrs.showPopup}">
<af:menu binding="#{backingBeanScope.popupProcedimentos.menu}" id="m1"></af:menu>
</af:popup>
<af:popup rendered="#{attrs.showPopup}" id="p1" contentDelivery="immediate"
binding="#{backingBeanScope.popupProcedimentos.popupProcedimento}"
launcherVar="source" eventContext="self">
<af:dialog binding="#{backingBeanScope.popupProcedimentos.dialog}"
stretchChildren="first" id="d1" title="Nova janela"
contentWidth="500" contentHeight="500">
<af:inlineFrame sizing="preferred"
binding="#{backingBeanScope.popupProcedimentos.inlineFrame}"
shortDesc="Nova página" id="iframe"
source="#{backingBeanScope.listaProcessoAdministrativo.procedimentoUrl}#{attrs.DDocName}"></af:inlineFrame>
</af:dialog>
</af:popup>
<af:xmlContent>
<component xmlns="http://xmlns.oracle.com/adf/faces/rich/component">
<display-name>popupProcedimentos</display-name>
<component-extension>
<component-tag-namespace>component</component-tag-namespace>
<component-taglib-uri>/popupproceds</component-taglib-uri>
<attribute>
<attribute-name>showPopup</attribute-name>
<attribute-class>java.lang.Boolean</attribute-class>
<default-value>false</default-value>
</attribute>
<attribute>
<attribute-name>DDocName</attribute-name>
<required>true</required>
<attribute-class>java.lang.String</attribute-class>
</attribute>
</component-extension>
</component>
</af:xmlContent>
</af:componentDef>
</jsp:root>
And i just call it in the other page like this
> <popupproced:popupProcedimentos DDocName="sss" id="popup" showPopup="true" > </popupproced:popupProcedimentos>
But the rendered html page just display the tag like that, any help?
The first line of the declarative component is invalid
"> <?xml version='1.0' encoding='UTF-8'?>"
Frank
I forgot to declare the tag lib in the project of the page I was using to test it. Now everything is working fine.
Related
This is my tag file:
<ui:composition
xmlns ="http://www.w3.org/1999/xhtml"
xmlns:jsf ="http://xmlns.jcp.org/jsf "
xmlns:ui ="http://xmlns.jcp.org/jsf/facelets">
<div class="iconicFieldBox"><!--
--><span class="icon roundedCornersTLBL4">#{icon}</span><!--
--><label class="hiddenD" for="userName">#{label}</label><!--
--><input jsf:id="#{id}" class="inputBox roundedCornersTRBR4" name="#{id}" jsf:type="*" placeholder="#{placeholder}" jsf:value="#{value}" /><!--
--></div>
</ui:composition>
And use it here:
<h:form id="signInForm">
<h:commandButton id="submit" class="button circle icon" value="ᄍ" action="#{loginBacking.login}" />
<yjk:iconicFieldBox id="userName" icon="" label="#{mainTemplateText['userName']}" placeholder="#{mainTemplateText['userName']}" value="#{loginBacking.username}" />
</h:form>
And define it here:
<namespace>http://yejayekhoob.com/ui</namespace>
<short-name>yjk</short-name>
<tag>
<description>Renders iconic field (A text field with its icon box to the left )</description>
<tag-name>iconicFieldBox</tag-name>
<source>tags/iconicFieldBox.xhtml</source>
<attribute>
<description>The ID of the input component.</description>
<name>id</name>
<required>true</required>
<type>java.lang.String</type>
</attribute>
<attribute>
<description>The text symbol for the input component.</description>
<name>icon</name>
<required>true</required>
<type>java.lang.String</type>
</attribute>
<attribute>
<description>The value of the input component.</description>
<name>value</name>
<required>false</required>
<type>java.lang.Object</type>
</attribute>
<attribute>
<description>The label of the input component.</description>
<name>label</name>
<required>true</required>
<type>java.lang.String</type>
</attribute>
<attribute>
<description>The placeholder for the input component.</description>
<name>placeholder</name>
<required>true</required>
<type>java.lang.String</type>
</attribute>
</tag>
And the backing bean:
#Named #ViewScoped
public class LoginBacking extends AuthenticationBacking implements Serializable{...}
public abstract class AuthenticationBacking extends ManagementBaseBackingBean{
protected String username;
.
.
.
}
When i look at the source code, i see this jsf:id="userName" not this id="signInForm:userName". I don't know this is the reason but the value of the username field is not bound to the backing bean field username because after the command button is clicked, this variable is null(i used FacesMessage to see username field).
• But if i don't use the tag file, i see id="signInForm:userName" but the username variable is still null.
• But if i change the Pass-Through element input to <h:inputText> inside the tag file, i see id="signInForm:userName" and the username variable is no longer null.
What is(are) my mistake(s)?
Apache Tomee Plus 8.0.12 JSF 2.3
Thanks in advance.
I have a Ribbon Button with the following XML:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="Ribbon.Library.Actions.AddAButton"
Location="CommandUI.Ribbon"
RegistrationId="171"
RegistrationType="List"
Title="Change Email Ribbon Button">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition
Location="Ribbon.ListForm.Edit.Commit.Controls._children">
<Button Id="Ribbon.ListForm.Edit.Commit.NewRibbonButton"
Command="ChangeEmailButtonCommand"
Image16by16="/_layouts/15/$Resources:core,Language;/images/formatmap16x16.png?rev=23" Image16by16Top="-127" Image16by16Left="-91"
Image32by32="/_layouts/15/$Resources:core,Language;/images/formatmap32x32.png?rev=23" Image32by32Top="-477" Image32by32Left="-307"
LabelText="$Resources:Toolkit,ChangeEmailButtonLabel"
TemplateAlias="o2" />
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler
Command="ChangeEmailButtonCommand"
CommandAction="javascript:
ChangeEmailAction();
" />
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
<CustomAction Id="Ribbon.ListForm.Edit.Commit.Scripts" Location="ScriptLink" ScriptSrc="/_layouts/15/GOToolkit/JS/loadJsOrCssFile.js?version=1.7.3" />
</Elements>
Now, the LabelText on my button, shows the exact same text, as it does in the XML: "$Resources:Toolkit,ChangeemailButtonLabel", where I'd expect it to show the text that I have defined in the 'ChangeEmailButtonLabel', which looks like this:
<data name="ChangeEmailButtonLabel" xml:space="preserve">
<value>Change email</value>
</data>
Am I missing something here?
Check that your resources file is stored in the SharePoint Resources folder.
Also, don't know if it's a game changer but you can add ";" at the end of your syntax.
I am using list view to show the list items in share point 2013. When user clicks the title the custom page should be shown instead of default display page(dispForm.aspx) of share-point.
Define XmlDocuments in contentType:
https://msdn.microsoft.com/en-us/library/office/aa543825.aspx
Example:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<!-- Parent ContentType: Workflow Task (0x010801) -->
<ContentType ID="0x010100AF4E4BE6CF8048959C4172F4298CE42A"
Name="MyName"
Group="MyGroup"
Description="MyDescription"
Version="0">
<FieldRefs>
</FieldRefs>
<XmlDocuments>
<XmlDocument NamespaceURI ="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
<FormUrls xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
<New>_layouts/MyFolder/New.aspx</New>
<Display>_layouts/MyFolder/New.aspx</Display>
<Edit>_layouts/MyFolder/Edit.aspx</Edit>
</FormUrls>
</XmlDocument>
</XmlDocuments>
</ContentType>
</Elements>
In code behind you get current item
SPListItem item = SPContext.Current.ListItem;
I'm working on a custom contenttype of the type Documentset.
I want to set the alllowed contenttypes, but this is not working, it's only showing the defeult document. I read several blogs but i can't find my solution.
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<!-- Parent ContentType: Document Set (0x0120D520) -->
<ContentType ID="0x0120D520008d2ff418027e4c31b54d155b98596748"
Overwrite="True"
Name="Custom Dossier"
Group="Custom group"
Description="Custom dossier"
Inherits="True"
Version="0">
<FieldRefs>
<FieldRef ID="{8D6C094C-3E1F-41f4-BEE3-25B27EE09702}" Name="Dossier_Nummer" DisplayName="Dossiernummer" Required="True" />
</FieldRefs>
<XmlDocuments>
<XmlDocument NamespaceURI="http://schemas.microsoft.com/office/documentsets/allowedcontenttypes">
<act:AllowedContentTypes xmlns:act="http://schemas.microsoft.com/office/documentsets/allowedcontenttypes" LastModified="05/31/2012 08:46:56">
<AllowedContentType id="0x0101" />
<AllowedContentType id="0x0101000490d50c50624b6ca21c637ef39cd89b" />
</act:AllowedContentTypes>
</XmlDocument>
</XmlDocuments>
</ContentType>
</Elements>
You can use ContentType binding element for assigning CTs to document library.
Have you tried adding all the nodes necessary for the document set template? A great example is located here: http://code.msdn.microsoft.com/office/Create-Custom-Document-Set-318393ce/sourcecode?fileId=57420&pathId=1173424883
<h:inputText rendered="#{bean.myStringVariable [is numeric]}"
id="myID"
value="#{bean.myStringVariable}"/>
Is it possible to have an expression in the rendered element that says render only if the contents myStringVariable is a numeric? I've had a look through http://developers.sun.com/docs/jscreator/help/jsp-jsfel/jsf_expression_language_intro.html but nothing jumps out.
Rgds, Kevin.
Create a custom EL function so that you can use it as follows:
<h:inputText rendered="#{util:matches(bean.myStringVariable, '\\d+')}">
First create some utility class.
package com.example.
public final class Util {
private Util() {
//
}
public static boolean matches(String value, String regex) {
return value.matches(regex);
}
}
If you're using JSP, define it as follows in /WEB-INF/util.tld:
<?xml version="1.0" encoding="UTF-8" ?>
<taglib
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
version="2.1">
<display-name>Utility Functions</display-name>
<tlib-version>1.0</tlib-version>
<uri>http://example.com/util</uri>
<function>
<name>matches</name>
<function-class>com.example.Util</function-class>
<function-signature>boolean matches(java.lang.String, java.lang.String)</function-signature>
</function>
</taglib>
And declare it as follows:
<%#taglib uri="http://example.com/util" prefix="util" %>
Or if you're using Facelets, define it as follows in /META-INF/util.taglib.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE facelet-taglib PUBLIC
"-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
"http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
<facelet-taglib>
<namespace>http://example.com/util</namespace>
<function>
<function-name>matches</function-name>
<function-class>com.example.Util</function-class>
<function-signature>boolean matches(java.lang.String, java.lang.String)</function-signature>
</function>
</facelet-taglib>
Add it to the web.xml as follows:
<context-param>
<param-name>facelets.LIBRARIES</param-name>
<param-value>/META-INF/util.taglib.xml</param-value>
</context-param>
(when you're on JSF 2.0, use javax.faces.FACELETS_LIBRARIES as name instead)
And declare it as follows:
<html xmlns:util="http://example.com/util">