LRP-614 practice question 4 of 25

An administrator would like to add a new travel preferences section in the Miscellaneous section of the user form. The travel preferences are stored as custom fields. The recommended way to implement the solution using a hook plugin is to: (Please select all correct answers.)

Full set: 144 questions
Answer options
A: Modify html/portlet/users_admin/edit_user.jsp to add the travel preferences section to theMiscellaneous section
B: Set the portal property "users.form. my.account, miscellaneous"to "travel-preferences" and add the corresponding JSP Correct answer
C: Create a Struts action hook to persist the Expando value to the database
D: Add the custom fields to the relevant JSP using Correct answer
Correct Answer:
B. Set the portal property "users.form. my.account, miscellaneous"to "travel-preferences" and add the corresponding JSP; D. Add the custom fields to the relevant JSP using
Explanation

The recommended, non-invasive method to add a new section to the user form is to use a hook plugin. This involves two main steps. First, you must define a portal property, such as users.form.my.account.miscellaneous, in a portal.properties file within your hook. This property tells Liferay to include your custom JSP in the specified section of the form. Second, within that custom JSP, you must use the Liferay UI taglib, specifically the tag, to render the custom fields. This tag handles the display and ensures that the values are automatically saved by Liferay's core Struts action upon submission, making a custom action hook unnecessary.

Why Incorrect

A. Modifying a core JSP like edituser.jsp directly is not recommended as it is an invasive customization that can easily break during portal upgrades.
C. A Struts action hook is not necessary because Liferay's existing user management actions automatically process and persist custom field (Expando) values submitted from the form.

References

1. Liferay Portal 6.2 Developer Guide, Chapter 11: Hooks, Section: "Adding a New User Field with a Hook". This section provides a step-by-step tutorial that directly implements the solution described in options B and D. It details creating a hook to add a portal.properties file that injects a custom JSP into the user form, and then using the tag within that JSP. (Note: This principle is identical for Liferay 6.1, which the LRP 614 exam covers).

2. Liferay Portal Source Code (portal-impl/src/portal.properties), Liferay Portal 6.1 CE GA3. The portal.properties file defines the default sections for user forms. For example, the property users.form.my.account.miscellaneous=details,organizations,user-groups,roles,communities shows the default JSPs included. A hook overrides this property to add a new JSP, directly supporting the method in option B.

3. Liferay Taglib Documentation. The official documentation for the tag specifies its use for displaying and enabling the persistence of Expando attributes for a given model, which is the correct implementation for the JSP as described in option D.

Scroll to Top