The docs say put it in META-INF/skins, but RichFaces doesn't find it there, or anywhere else I tried.
I use Tomcat with MyFaces 2 JSF and RichFaces 4 components
Update: I posted the Exception that Tomcat throws at http://paste.lisp.org/display/128193
Update 2: In response to BalusC's comments below, I established that specifying org.richfaces.SKIN in uppercase also doesn't help.
The community forums notes that the my.skin.properties file (note: pluralizing skin to skins--as in my.skins.properties--is incorrect) must be in WEB-INF/classes/META-INF/skins.
In NetBeans, for example, this can be accomplished as follows:
Switch to the Files tab.
Create a new directory at the same level as src and web called resources.
Create a sub-directory in resources called WEB-INF.
Copy my.skin.properties into resources/WEB-INF.
Update web.xml to contain:
<context-param>
<param-name>org.richfaces.skin</param-name>
<param-value>my</param-value>
</context-param>
Note: Some places, including the formal documentation, refer to the skin param-name as org.richfaces.SKIN, which is incorrect. The param-name must be all lowercase.
Next:
Update build.xml to contain:
<target name="-post-dist">
<war destfile="${dist.war}" update="true">
<zipfileset dir="${basedir}/resources/WEB-INF" prefix="WEB-INF/classes" />
</war>
</target>
Press Shift+F11 to rebuild the application.
Verify that the archive (e.g., Project.war) contains the following file:
\Project.war\WEB-INF.classes\my.skin.properties
When deployed, the application should find the properties file.
Related
How to set one of the folders as root folder of Documents And Media Display portlet by programmatically.PFA image
Liferay Major Version
Your question is tagged as Liferay 6 and Liferay 7. The two releases are drastically different. This answer assumes you are using Liferay 6.x since you are asking about the DDM portlet as opposed to the OSGI module.
Programmatically setting that input resource to default as a folder of your choice requires you to create a JavaServer Page hook for a JSP in the Document Library Display portlet. I am going to briefly explain how to create the JSP hook before getting into particulars.
Create a Hook
From Liferay's Knowledge base
From your command line terminal, navigate to your Plugins SDK’s hooks folder. To create a hook project, you must execute the create script. Here’s the format to follow in executing the script:
create.[sh|bat] [project-name] "[Hook Display Name]"
On Linux and Mac OS X, you’d enter a command similar to the one in this example:
./create.sh doc-lib-disp-hook "Document Library Display Hook"
On Windows, you’d enter a command similar to the one in this example:
create.bat doc-lib-disp-hook "Document Library Display Hook"
Liferay IDE’s New Project wizard and the create scripts generate hook projects in your Plugin SDK’s hooks folder. The Plugins SDK automatically appends “-hook” to your project name.
You will need to have Apache ANT installed for this to work. Please reference the following documentation if you need to install it.
https://www.mkyong.com/ant/how-to-install-apache-ant-on-windows/
Once the hook is created open it in your Liferay IDE or Liferay Developers Studio (or Eclipse).
In your IDE click the down arrow right below File (top left corner)
Choose Liferay Plugin Project from Existing Source
Double click on the doc-lib-disp-hook folder in your Plugin's SDK Hook directory to open.
You should see something similar to this (with different name).
Override JSP
Now that you have successfully created a hook plugin, we need to override the necessary file. There are two files in particular that we need for this hook
html/portlet/document_library_display/configuration.jsp
html/portlet/document_library/init.jsp
We need both files to logically walk through this example although we only need to actually override one of them.
To override the JSP's execute the following steps
Under your META-INF folder create a new directory called custom_jsp
Open up liferay-hook.xml in Overview mode
Click the Green Plus sign (to the right of Custom JSP label)
Search for both files listed above (copy and paste the URL into the window) then click save.
You will now notice you have the following directory structure.
Let's first open the configuration.jsp. This is the code that produces the GUI you took a screen shot of. Find the following code block.
<aui:field-wrapper label="root-folder">
<div class="input-append">
<liferay-ui:input-resource id="rootFolderName" url="<%= rootFolderName %>" />
<aui:button name="openFolderSelectorButton" value="select" />
<%
String taglibRemoveFolder = "Liferay.Util.removeFolderSelection('rootFolderId', 'rootFolderName', '" + renderResponse.getNamespace() + "');";
%>
<aui:button disabled="<%= rootFolderId <= 0 %>" name="removeFolderButton" onClick="<%= taglibRemoveFolder %>" value="remove" />
</div>
</aui:field-wrapper>
Inside that block you will see the Root Folder element you wish to set.
<liferay-ui:input-resource id="rootFolderName" url="<%= rootFolderName %>" />
As you can see the folder's url is already set by default to the variable rootFolderName. We need to find where that variable is first initialized.
We need not modify this file at all. I had you include it and open it so you can follow through logically.
If you notice rootFolderName is not initialized anywhere in the configuration.jsp file. Therefore we need to investigate the init.jsp file because it is an include at the top of the page. If you open that file you will notice the following block.
String portletResource = ParamUtil.getString(request, "portletResource");
if (layout.isTypeControlPanel()) {
portletPreferences = PortletPreferencesLocalServiceUtil.getPreferences(themeDisplay.getCompanyId(), scopeGroupId, PortletKeys.PREFS_OWNER_TYPE_GROUP, 0, PortletKeys.DOCUMENT_LIBRARY, null);
}
long rootFolderId = PrefsParamUtil.getLong(portletPreferences, request, "rootFolderId", DLFolderConstants.DEFAULT_PARENT_FOLDER_ID);
String rootFolderName = StringPool.BLANK;
if (rootFolderId != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
try {
Folder rootFolder = DLAppLocalServiceUtil.getFolder(rootFolderId);
rootFolderName = rootFolder.getName();
}
catch (NoSuchFolderException nsfe) {
}
}
This code is basically saying we are going to initialize rootFolderName blank. However if rootFolderId is set higher than 0 either by
Portlet preferences, or
Request Parameters
then we will set rootFolderName accordingly.
Conclusion
If you want to set rootFolderName to a folder of your choice programmatically by default you can a few things. The easiest thing to do would be to get the folder's id and modify the code like this
long folderIdConstant = 999999L; // place folder id here
long rootFolderId = PrefsParamUtil.getLong(portletPreferences, request, "rootFolderId", folderIdConstant );
That would set the default root folder programmatically. Just build and deploy now.
We want to migrate our project from IBM WebSphere 6.1 to Tomcat 6, but in our JSP-JSF UI pages we have extensively used below IBM JSF tags.
ScriptCollector
PanelRowCaregory
PagerWeb
OutPutSelections
InputRowSelect
InputHelperDatePicker
InputHelperAssist
ConvertMask
And to replace above tags, we are trying to find the equivalent tags from Sun JSF or any other open source libraries, but we didn't find any equivalent tags.
I wanted to know whether any body has already worked on this kind of migration project, if yes can you please share the equivalent tags?
or if you solved it differently even that info also will be useful.
Thanks in Advance.
There's no standard JSF equivalent for the <hx:scriptCollector> (although the JSF 2.0 <h:head> comes close). The <hx:scriptCollector> is only required by those IBM-specific <hx:xxx> components. It's designed to collect all JavaScript files required by those <hx:xxx> components and then render the desired <script> tag(s) without potential duplicates when multiple components require the same JS files. It's not required by any standard JSF component.
In other words, just get rid of it without replacement.
As to other tags, just check the available standard components in tag documentation or Java EE tutorial. If none is available, just pick a component library like PrimeFaces or RichFaces. If you still can't figure out, ask an individual question for the particular tag.
I am following this guide: http://balusc.blogspot.com/2009/12/uploading-files-with-jsf-20-and-servlet.html and everything has gone smoothly except that I noticed it would only work if my web.xml is mapped to .jsf. Any ideas?
I am on tomcat 7.0.12 jsf 2.1.17 from mojarra and that is why I'm not using Tomahawk.
You need to make sure that the URL pattern of the filter mapping of the file upload filter also matches the desired JSF requests. Assuming that your FacesServlet has a <url-pattern>*.html</url-pattern>, then this should do:
#WebFilter(urlPatterns={"*.html"})
Even better, if you're going to use it exclusively for file uploads via JSF, then you can also map it on the servlet name of the faces servlet. Assuming that you've a <servlet-name>facesServlet</servlet-name>, then this should do:
#WebFilter(servletNames={"facesServlet"})
Is it possible to remove all styling from Primefaces components? I mean, the component set is good but having to manually override every tiny bit of each component to make the component style fit the overall design of my application isn't good. I can't use hours on using Firebug to find which classes etc it uses and all that.
So is there no way to remove this and only use the components for their functionality and provide your own design instead of being forced to use the default....or one of the "themes"?
Set primefaces.THEME context parameter to none and you'll get a functional ui with no styles.
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>none</param-value>
</context-param>
You don't need to spend hours editing styles. Styling of PrimeFaces is done via shared styles like ui-widget-header, ui-widget-content which you can customize via the themeroller web form. I don't think JSF and theming can get any easier than PrimeFaces.
PrimeFaces inserts two CSS files by default, theme.css and primefaces.css. You can remove theme.css by putting the following to web.xml:
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>none</param-value>
</context-param>
Then you can overwrite primefaces.css by creating an empty file in:
WebContent/resources/primefaces/primefaces.css
Older PF versions (<6.0)
If you want to use the primefaces with your own css's wouldn't it be easier to create your own theme using the jQuery UI - ThemeRoller ?
Here's a link to how you create your own Theme for PrimeFaces
Newer PF versions (6.0 and up)
More recently PrimeFaces introduced the 'Designer API' Since PF components have more features, the themeroller is not that suitable anymore. The Designer API is SASS based and allows you to create really good themes
Create own theme as #Daniel said. I just want to add :
For partial styling you don't have to firebug everything, primefaces user guide covers style classes for each element. It contains also other very useful info and tips (also part about skinning). So use it as your first source when you find yourself struggling with anything about primefaces.
I am using lots of commandLinks in my app. For them to work, JSF generates some wild Javascript ( function dpf(f) {var adp... ). Sadly, the script-tag destroys my layout. (It really does - I am sure about that).
Is there a way to force JSF to generate the script-tag somewhere else?
Maybe you can try to externalize your Javascript.
Instead of putting the Javascript code within your page, it will only include a script tag that points to a Javascript file.
To do that, modify your web.xml file to have that:
<context-param>
<param-name>com.sun.faces.externalizeJavaScript</param-name>
<param-value>true</param-value>
</context-param>