Results 1 to 2 of 2

Thread: Linking pro

  1. #1
    Join Date
    Jun 2005
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Linking pro

    how to link from 1 jsp file to another???

  2. #2
    Join Date
    Jul 2005
    Location
    cali
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Wink

    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •