Liferay link to another portlet with a specific action - java

I have a custom navigation portlet which includes links to several pages in my portal. Some of these links, though, are "submenu" options that are actually actions of a specific portlet. For instance, take a look at this image:
I have a portlet that displays a list of movies, and can also apply a filter by genre. Those links I've circled in my image should be links to the page with the Movie List portlet, but with a different action for each link.
How can I achieve that? I can only make actionURLs within a portlet, not for other portlets.

You can create actionURLs to another portlet using the following tag provided by liferay and not by the portlet standard:
<liferay-portlet:actionURL plid="" portletName="" />
where "plid" is the layout id of the page that the portlet is in and "portlet name" is the portlet id of the portlet that defines the actions that you want to call.
However, if the links you mention, apply filters to the movies list, then you could also do the filtering on page render and not necessarily using action processing.

Related

CAS custom theme not taken in logout

I am currently working on providing a customized logout view for CAS. I am following this tutorial:
https://dacurry-tns.github.io/deploying-apereo-cas/ui_how-cas-themes-work.html
I have the custom-theme.properties and everything was set as shown in the tutorial. I also provided customized structural views under templates/[custom-theme]/ and CSS and JS files under static/themes/[custom-theme]/css and static/themes/[custom-theme]/js.
The login screen shows the customized view and renders the custom CSS and JS; however, the logout view is the original default one that is packaged automatically by CAS and not the custom one provided.
It is only when I put the customized structural views under templates/ directly would the custom logout page be shown instead of the default one. The issue here however is that all the static resources (CSS,Scripts,images) can't be accessed and do not work so only the HTML would be changed and not the styles.
How can I make the logout take into consideration all the static resources given to it?

How to add image along with title name for all pages in that project in one code in Struts 2

I wrote the mentioned code
<link rel="Shortcut icon" href="img/favicon.ico"/>
in head section of JSP page and it is able to display the image along with the title name of the page
but what I want is it should be reflected on all my pages of project. So what should be done ?
Note: Made a favicn.ico and environment is Java Struts 2
Create a main page called for example baseLayout.jsp, which has a section for header, body, footer, toolbar, etc.
Each section you should include using Struts include tag or similar. In this page you have a head where you can put your link tag. As well as this page will be returned by every action, with exception to those actions that return redirect like results, you will have a link on every page.
This is the same concept that used in Tiles framework, where you can define a layout in the tiles config file and use tiles result type to return by the actions.
Another approach is to create a JSP file with only the link and include it on every page, but it's less productive as above solution.
If you are not familiar with Tiles framework you can read
this answer to get started.
I'm thinking of using simple features such as a side bar for navigation and banner across the top with the website name etc, and would like this to be carries across every page.
you are definitely needed tiles and tiles integration with Struts 2 via the tiles-2 plugin or tiles-3 plugin
there's plenty tutorials with examples on the web on these theme, for example
Struts 2 Tiles Integration Tutorial
Struts 2 Tutorial Series – How to insert Tiles to your project
Struts 2 Tiles Plugin Tutorial with Example in Eclipse
Struts 2 Tiles Framework Integration Tutorial Example
Struts2 Tiles Example
Working With Struts 2 Tiles, Struts 2 Tiles Example
I have read that to do this in JSP I have to use tag files (stored in the WEB-INF folder) then link to these on each JSP page?
Tags is a bit outdated, however in the JSP you should use struts tags
Also I have seen people creating these banners and sidebars etc in Photoshop, is this what normally goes on in web site development?
Yes, that banners, images, designed with it.
To sum it up: Creating a decent looking web page whilst using JSPs and the Struts 2 framework.

Get tags of content on same page

I am developing portlet for liferay portal. I need in my portlet to get tags of content in other portlet. All i have at this moment is portlet IDs of oll portlets on the page. For example, if I have portlet with ID 33 (blog) I need to get tags of blog entry? opened in blog portlet. Any ideas? Thatnks fore future answers!
I have found good solution:
I have writed hook-plugin for blog portlet.In this plugin I modify init-ext.jsp, where I add AssetEntry object to shared session parametres. In my custom portlet I just take this parameter and can use it in any way. The problem Im thinking about at this moment is the order of portlet execution. The order is not specified, so I can't be shure, that blog executes first and in my custom portlet I would be abl to access AssetEntry in public session parametres. Anyway it is working solution.

Add html content to a page in Liferay

Im new to Liferay . I have downloaded the Liferay Tomcat bundle v5.2.3 Community Edition from the Liferay website. I am able to run it successfully.
I am now trying to create an intranet portal for our company using Liferay . I created an Organization in Liferay and added some pages and child pages to it.
How to add content to a page ?. I mean, i would like to add some text and images etc to the home page and other pages on the portal. I tried the Web Content Display portlet, but it always appears minimized and i have to maximise it by clicking on the maximize button. And also the option to minimize/maximize the portlet is available only when im logged in.
Is there any other way to add HTML content to a page, to make it look like a normal html page which anybody can view when they visit the portal ?
Thank You.
Web Content Display is indeed the easiest choice. You probably just made a mistake when using it.
Add the web content display portet
Click on "add web content" icon at the bottom-left of the portlet
You get a rich text editor, but you can also toggle to HTML view
When you're done click on "Save and approve".
Liferay CMS is built on the concept of template, structure and article.
structure: the element to be rendered, e.g. one text area + one image
template: the rendering of the structure, e.g. image in top-left + text around the image
article: the actual data that corresponds to a structure
But you should be able to edit your first Web Content Display without having an structure nor template. But I suggest you to have a look at them once your are used to the portal.
Once you have added the web content portlet and then added content, you need to configure the layout template you want. Choose the one column layout to let the portlet take up the whole screen.
I think you are asking how to create a new page of type web content.
note the content_id of your web content
make sure your web content is approved, published, and viewable (permissions)
create your page, entering your content_id into the Web Content ID field
I think when you do it this way, you forsake some of the portlet functionality that Liferay brings you.

GWT multi modules for separate HTML pages?

I am quite new to GWT and going to develop the UI for user-management application using GWT.
I am planning to use existing module which created using Spring/Hibernate. I figured out how to integrate GWT with Spring but I am not sure how to design the layout.
I want two pages:
User registration page (want to embedd GWT widget in HTML)
Administration page (seperate HTML as above with GWT widget embedded)
I am planing to use Spring Security,shall I use simple JSP login page or can I use RIA GWT login widget?
What can I use for above requirements? multiple GWT modules?
You could make 2 modules, one for the login widget, and another for the admin widget. Each widget will insert itself into a div in whichever html (or jsp) page you want.
For example, create a *.gwt.xml for each module, for example: login.gwt.xml and admin.gwt.xml. These files should both be created at the root of your gwt package, for example: com.gwt.example.
Next, create an "Entry Point" class for each (each class will implement EntryPoint). For example, Login.java might look like:
package com.gwt.example.myproject.client;
public class Login implements EntryPoint {
public void onModuleLoad() {
... create loginWidget ..
RootPanel.get("my-login-div").add(loginWidget);
}
}
So, now, when you do a gwt compile, it should create a bunch of files under war/com.gwt.example. The two you're interested in are com.gwt.example.login.nocache.js and com.gwt.example.admin.nocache.js.
Now, you can add these two js scripts into any html and/or jsp page as needed.
To complete the example, you could add the following html to add the login widget:
<html>
....other stuff...
<script type="text/javascript" language="javascript" src="com.gwt.example.login.nocache.js"></script>
....other stuff....
<div id="my-login-widget"></div>
....the rest of your html markup....
</html>
So, when you browse to this html page, it loads compiled gwt javascript, which knows to load onModuleLoad, which looks for div with id="my-login-widget" and inserts the login widget.
I've never used Spring Security, so can't be much help, other than this article looks like it might describe how to make Spring Security work over ajax.
You can create two modules or use only one.
I recently created an application where there was only one page, and the login panel was shown first, like an inner dialog box. When the session expired, the user was prompted to enter his credentials again. But I was going for a 100% no-page-refresh approach. It is nice, but the disadvantage is that the browser will have to download everything upfront. Well… at least until GWT 2.0.

Categories

Resources