LRP-614 practice question 22 of 25
A Struts action hook cannot define new Struts actions.
Full set: 144 questionsA Struts action hook is a customization mechanism in Liferay designed specifically to override the behavior of existing Struts actions that are defined in the core portal. The hook works by intercepting a request to a pre-defined (e.g., /login/login) and redirecting it to a custom implementation class. The hook framework does not provide a mechanism for defining or registering entirely new Struts action paths that do not already exist in the portal's core struts-config.xml files. The creation of new application logic and corresponding action paths is the function of a portlet, not a hook.
The statement is a "True or False" question. The alternative, "False," would be incorrect because it would imply that a Struts action hook can be used to define new Struts actions. This contradicts the fundamental design and documented purpose of hooks, which is to modify existing portal functionality, not to create new, standalone functionality.
1. Liferay 6.2 Developer's Guide: In the chapter on "Customizing Liferay with Hooks," the section "Overriding a Portal Action" exclusively describes the process of replacing an existing action. It states, "You can use a hook to customize a Liferay Struts action by creating a class that extends com.liferay.portal.struts.BaseStrutsAction and then referencing your class in your hook’s liferay-hook.xml file." The entire example and explanation are framed around overriding a known, existing path like /login/login. There is no mention of creating new paths. (Reference: Liferay 6.2 Developer's Guide, Chapter 10: Customizing Liferay with Hooks, Section: Overriding a Portal Action).
2. Liferay Hook DTD (liferay-hook620.dtd): The Document Type Definition for the liferay-hook.xml file specifies the required structure. The element requires a child element. This path is used by Liferay's HookHotDeployListener to find and replace an existing action mapping in the portal's Struts configuration. If the specified path does not correspond to an existing action, the hook will not be applied, as there is no original action to override. The DTD does not contain elements for defining new action mappings, forwards, or other components of a new Struts action definition.
Keep practicing
Take the free LRP-614 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other LRP-614 practice questions
- Question 1The best way to add a new language key to the portal is through:
- Question 2In a JSP that includes the tag, the method to check permissions is:
- Question 3A hook plugin can be used to: (Please select all correct answers.)
- Question 4An administrator would like to add a new travel preferences section in the Miscellaneous …
- Question 5The following statements about plugins are true: (Please select all correct answers.)
- Question 6All Service Builder entities contain a local reference to: (Please select all correct ans…
