23.9 Embedded Beans - Login
A bean of type login is an EntityBackingBean showing a login form: LoginBean.
For example, embed a login into a page:
<bean id="login1" type="login">
<viewConfig>
<propertiesToShow>username,password</propertiesToShow>
</viewConfig>
</bean>
To enable redirect after login to a URL, use entity type. For example,
<bean id="login2" type="entity">
<entityType>System.LOGIN</entityType>
<mode>INPUT_DATA</mode>
<criteriaElements>
<function name="EQ" property="redirectURL">#{param.redirectURL}</function>
</criteriaElements>
<viewConfig>
<viewType>ENTITY</viewType>
<propertiesToShow>username,password</propertiesToShow>
</viewConfig>
</bean>
The redirectURL of the Login Form is set to the value of request parameter redirectURL if any.
For example,
https://www.znize.com/login.xpg?redirectURL=%2Finstance.xpg
Choice After Login
If both redirectURL and actionMenuNodeSource of LoginForm are null, choiceAfterLogin
will be enabled if its select items are not empty.
<bean id="login3" type="entity">
<entityType>System.LOGIN</entityType>
<mode>INPUT_DATA</mode>
<criteriaElements>
<function name="EQ" property="redirectURL">#{param.redirectURL}</function>
</criteriaElements>
<viewConfig>
<viewType>ENTITY</viewType>
<propertiesToShow>username,password,actionAfterLogin</propertiesToShow>
<property name="choiceAfterLogin">
<renderStyle>
<!-- value: redirect URL without contextPath -->
<selectItems>
<selectItem value="/manage.xhtml">Go To Manage Center</selectItem>
<selectItem value="/products.xpg">Go To Products Page</selectItem>
<selectItem value="/pos.xpg">Go To POS Page</selectItem>
</selectItems>
</renderStyle>
</property>
</viewConfig>
</bean>