Is there any way to make a portlet for organizations i have made in control panel ?
it must be like this >> users logged in and see a portlet for their organizations and can edit update delete upon there request .
i have created organization hierarchy and made every things roles users ... etc
it can be done through hook or what please help me ?!
i have tried this
You can add portlet in control panel by adding below lines in your
<control-panel-entry-category>content</control-panel-entry-category>
<control-panel-entry-weight> 9.5</control-panel-entry-weight>
So your liferay-portlet.xml will look like
<liferay-portlet-app>
<portlet>
<portlet-name>Test Portlet</portlet-name>
<icon>/icon.png</icon>
<control-panel-entry-category>content</control-panel-entry-category>
<control-panel-entry-weight> 9.5</control-panel-entry-weight>
<instanceable>false</instanceable>
<header-portlet-css>/css/main.css</header-portlet-css>
<footer-portlet-javascript> /js/main.js
</footer-portlet-javascript>
<css-class-wrapper>
test-portlet
</css-class-wrapper>
<add-default-resource>true</add-default-resource>
</portlet>
<role-mapper>
<role-name>administrator</role-name>
<role-link>Administrator</role-link>
</role-mapper>
<role-mapper>
<role-name>guest</role-name>
<role-link>Guest</role-link>
</role-mapper>
<role-mapper>
<role-name>power-user</role-name>
<role-link>Power User</role-link>
</role-mapper>
<role-mapper>
<role-name>user</role-name>
<role-link>User</role-link>
</role-mapper>
</liferay-portlet-app>
Let me know if it worked for you.
Related
I've created a Liferay control panel portlet that works nicely.
Now I want to add a configuration page. I've done as follows:
Add config-template init-parameter to portlet.xml
Add configuration-action-class to the liferay-portlet.xml
But, the configuration menu does not appear:
Here are the two descriptors.
portlet.xml
<portlet>
<portlet-name>manage-apples-portlet</portlet-name>
<display-name>Apple Management Admin</display-name>
<portlet-class>de.apples.portlet.ManageApplesPortlet</portlet-class>
<init-param>
<name>config-template</name>
<value>/html/manage-apples-portlet/config.jsp</value>
</init-param>
<init-param>
<name>view-jsp</name>
<value>/html/manage-apples-portlet/view.jsp</value>
</init-param>
<init-param>
<name>jsp-path</name>
<value>/html/manage-apples-portlet/</value>
</init-param>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
</supports>
<resource-bundle>content.Language</resource-bundle>
<security-role-ref>
<role-name>administrator</role-name>
</security-role-ref>
<security-role-ref>
<role-name>power-user</role-name>
</security-role-ref>
<security-role-ref>
<role-name>user</role-name>
</security-role-ref>
</portlet>
liferay-portlet.xml
<portlet>
<portlet-name>manage-apples-portlet</portlet-name>
<icon>/icon.png</icon>
<configuration-action-class>com.liferay.portal.kernel.portlet.DefaultConfigurationAction</configuration-action-class>
<control-panel-entry-category>content</control-panel-entry-category>
<control-panel-entry-weight>10.0</control-panel-entry-weight>
<instanceable>false</instanceable>
<css-class-wrapper>manage-apples-portlet</css-class-wrapper>
</portlet>
Am I missing something?
At first view, I don't see portlet modes in the support element, I think you should add
<portlet-mode>view</portlet-mode>
<portlet-mode>edit</portlet-mode>
inside supports element of portlet.xml.
there is a way to change the locale for especific view in jsf?
i can try the locale via faces-config.xml, but i just wanna a specific view.
faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xi="http://www.w3.org/2001/XInclude"
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-facesconfig_1_2.xsd">
<application>
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
<locale-config>
<default-locale>es</default-locale>
<supported-locale>ca</supported-locale>
<supported-locale>en</supported-locale>
</locale-config>
You can set the locale on a per-view basis by nesting your content in a <f:view> tag that has one of its attributes, locale, for exactly this purpose:
<f:view locale="#{localeBean.selectedlocale}">
For more information consult Localization in JSF, how to remember selected locale per session instead of per request/view.
I've been trying to create an own component to "replace" the Richfaces spacer, which is no longer available in Richfaces 4.
I have found this link for the actual implementation: https://community.jboss.org/wiki/SpacerImplementationForJSF2OrRichFaces4
I tried to register the new taglib:
richext.taglib.xml
<?xml version="1.0" encoding="UTF-8"?>
<facelet-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-facelettaglibrary_2_0.xsd"
version="2.0">
<namespace>http://java.sun.com/jsf/composite/richext</namespace>
<tag>
<tag-name>spacer</tag-name>
<source>../richext/spacer.xhtml</source>
</tag>
web.xml
<context-param>
<param-name>javax.faces.FACELETS_LIBRARIES</param-name>
<param-value>WEB-INF/richext.taglib.xml</param-value>
</context-param>
changed the spacer.xhtml a little bit to:
<composite:implementation>
<h:panelGroup rendered="#{cc.attrs.height > 0}">
<br/>
</h:panelGroup>
<h:graphicImage value="../img/spacer.gif"
width="#{cc.attrs.width}px"
height="#{cc.attrs.height}px"/>
</composite:implementation>
I added
xmlns:richext="http://java.sun.com/jsf/composite/richext"
to the pages where I want to use the spacer.
My Files:
WebContent/WEB-INF/richext.taglib.xml
WebContent/richext/spacer.xhtml
WebContent/img/spacer.gif
Now, when accessing a page where I use the spacer (other pages work fine) I get a NullpointerException in the browser, not in the server log.
java.lang.NullPointerException
at org.apache.myfaces.view.facelets.tag.composite.CompositeComponentDefinitionTagHandler.apply(CompositeComponentDefinitionTagHandler.java:113)
at org.apache.myfaces.view.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:57)
at org.apache.myfaces.view.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:48)
at org.apache.myfaces.view.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:394)
at org.apache.myfaces.view.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:448)
at org.apache.myfaces.view.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:390)
at org.apache.myfaces.view.facelets.tag.UserTagHandler.apply(UserTagHandler.java:138)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:51)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:59)
at org.richfaces.view.facelets.html.BehaviorsAddingComponentHandlerWrapper.applyNextHandler(BehaviorsAddingComponentHandlerWrapper.java:53)
at org.apache.myfaces.view.facelets.tag.jsf.ComponentTagHandlerDelegate.apply(ComponentTagHandlerDelegate.java:294)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:54)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:51)
at org.apache.myfaces.view.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:57)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:51)
at org.apache.myfaces.view.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:48)
at org.apache.myfaces.view.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:179)
at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.buildView(FaceletViewDeclarationLanguage.java:417)
at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:78)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:239)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:191)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1188)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:763)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:454)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:125)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:77)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:919)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1016)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:895)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1659)
Where did I go wrong? Am I missing something?
My Server is a Websphere 8.0.0.2 if that's important.
Thanks in advance
You don't need that richext.taglib.xml file and that web.xml entry at all. Just put the composite component in /resources/richext folder, exactly as explained in the answer you found. Your concrete problem is caused because you attempted to register a composite component as a tag file (which are two entirely separate concepts). The incorrect taglib file might have caused MyFaces to choke like that.
See also:
Composite component info
When to use <ui:include>, tag files, composite components and/or custom components?
We have a custom JSF component that renders some buttons and a select box in a specific way. This is done by a class that extends UIInput. This custom component used in the xhtml templates like so:
<xx:fooComponent
value="#{fooBean.someProperty}"
valueChangeListener="#{fooBean.someMethodInBean}"
someOtherProperties="true" />
Now since we changed from JBoss 4.2.2 running JSF 2.0 to JBoss 7.1.1 running with the built-in JSF libs, it complains about someMethodInBean not being a property. Of course it's not a property, it's a method. Who in the world would bind a property to a valueChangeListener?
At first I thought, this had something to do with the method being in a superclass of the referenced bean, but that wasn't the case. Adding this particular method to FooBean did not make any difference.
So my question is, what did they change so that this breaks now and how can I fix it in a migrating-friendly way?
edit
The component is declared as such in our *.taglib.xml:
<!DOCTYPE facelet-taglib PUBLIC
"-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
"http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
<!-- ... -->
<tag>
<tag-name>fooComponent</tag-name>
<component>
<component-type>myProject.FooComponent</component-type>
</component>
</tag>
... which leads to this declaration in faces-config.xml:
<component>
<component-type>myProject.FooComponent</component-type>
<component-class>com.myproject.somemore.UIFooComponent</component-class>
</component>
... which leads to the class UIFooComponent extends UIInput.
edit 2
Now the taglib xml looks like this:
<facelet-taglib version="2.0"
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-facelettaglibrary_2_0.xsd">
<tag>
<tag-name>fooComponent</tag-name>
<component>
<component-type>myProject.FooComponent</component-type>
</component>
<attribute>
<name>valueChangeListener</name>
<method-signature>void valueChanged(javax.faces.event.ValueChangeEvent)</method-signature>
</attribute>
</tag>
</facelet-taglib>
Still, he complains about fooBean not having the property someMethodInBean.
edit 3
The stack trace is:
Caused by: javax.el.ELException: /abc/abc.xhtml: The class 'com.myproject.managedbeans.foo.FooBean' does not have the property 'someMethodInBean'.
at com.sun.faces.facelets.compiler.AttributeInstruction.write(AttributeInstruction.java:94)
at com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:302)
at com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:185)
at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:129)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:402)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
at org.apache.myfaces.tomahawk.application.ResourceViewHandlerWrapper.renderView(ResourceViewHandlerWrapper.java:93)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
... 21 more
This indicates that the tag attribute isn't been declared as a <method-signature> in the component's <tag> declaration in the .taglib.xml file as follows:
<attribute>
<name>valueChangeListener</name>
<method-signature>void valueChange(javax.faces.event.ValueChangeEvent)</method-signature>
</attribute>
Make sure that this is properly been declared as above.
Update: you need to make sure that you've declared the .taglib.xml file conform JSF 2.x Facelets XSD (and thus not a DTD as it was in legacy Facelets 1.x).
<facelet-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-facelettaglibrary_2_0.xsd"
version="2.0"
>
<!-- Tags here -->
</facelet-taglib>
How can I make my portlet non instanceable accross the liferay instance. I have read about it in the forum but there was no mention of how to do it.
You can specify a portlet as non instanceable by putting
<liferay-portlet-app>
...
<portlet>
...
<instanceable>false</instanceable>
...
</portlet>
...
</liferay-portlet-app>
in the file
liferay-portlet.xml
Beware of the right order of tags, according to the dtd (linked the dtd version 5.2, shouldn't have changed much though)
Also have a look here
Liferay docu