[Actionframework-users] suggested design for a search page?
Status: Inactive
Brought to you by:
ptoman
From: Mark D. A. <md...@di...> - 2002-10-17 06:11:32
|
Suppose I have for example a page which allows the user to enter search criteria on the top of the page, and then displays matching rows to the (previous) criteria on the rest of the page. The AS allows several ways to do this, including: - putting calls inside the template - using output-variable on template - using action on component I'm wondering what some suggestions would be? For example, consider this velocity template: <html><body> <form action="$SERVLET> <input type="hidden" name="action" value="findBooksAction"/> Title: <input type="text" name="title" value="$title"/> Author: <input type="text" name="author" value="$author"/> </form> #set ($matching_books = $Library.findBooks($title, $author)) Matching books with title "$title" and author "$author": <table border="1"> <tr><th>Title</th><th>Author</th><th>Date</th></tr> #foreach ($book in $matching_books) <tr><td>$book.Title</td><td>$book.Author</td><td>$book.Date</td></tr> #end </table> </body></html> The above template isn't really a good idea nor is it complete: - it has both the form action "findBooksAction" and the inline call to the java method "findBooks" (but note that we do want this template to work without having to invoke an action first). - it doesn't deal with defaulting empty string values for title and author - it doesn't deal with arranging for the action parameters to be bound to velocity variables on the next refresh. There aren't any cases matching this in the current AS examples directory. Any suggestions? -mda |