huisoonsg
06-16-2005, 04:51 AM
how to link from 1 jsp file to another???
bubba.daniel
07-03-2005, 01:14 AM
Simple linking through a controller to another JSP page. The <netui:anchor> tag replaces the normal <a> HTML anchor tag. A plain <a> links directly from one URL to another, without providing the controller an opportunity to perform any conditional logic. But the <netui:anchor> tag is rendered as HTML and Javascript code, code which causes the link to venture through the controller class.
While it may seem silly to use JPF/netui functionality for simple constant forward methods, the advantage is that if a page gets renamed or you wish to change the flow through an application, the destination only needs to be changed once, within the controller. Otherwise, you may have to edit a handful of JSP pages manually changing the URLs inside normal <a> tags.
For example, if your application changes and you desire to show a terms-of-service before allowing login, you can simply alter the login() controller method to send a user to terms_of_service.jsp before further sending him to the actual login screen.
The <netui:anchor> tag parallels the <a> tag but is able to use an action attribute instead of an href. Instead of specifying the URL to another page, the name of the method on the controller class is used, without parenthesis.
Instead of using <a>
<a href="login.jsp">Login!</a>
Use <netui:anchor>
<netui:anchor action="login">Login!</netui:anchor>
When the link is displayed on-screen, clicking it will cause control to go through the Controller's login() method, which will return the correct forward to select the actual next page to display.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.