Create personList.jsp to show search results
Create a src/main/webapp/WEB-INF/pages/personList.jsp page to display the list of people:
<%@ include file="/common/taglibs.jsp"%> < head > < title >< fmt:message key = "personList.title" /></ title > < meta name = "menu" content = "PersonMenu" /> </ head > < div class = "col-sm-10" > < h2 >< fmt:message key = "personList.heading" /></ h2 > < div id = "actions" class = "btn-group" > < a class = "btn btn-primary" href = "<c:url value=" /editPerson"/>" > < i class = "icon-plus icon-white" ></ i > < fmt:message key = "button.add" /> </ a > < a class = "btn btn-default" href = "<c:url value=" /mainMenu"/>"> < i class = "icon-ok" ></ i > < fmt:message key = "button.done" /> </ a > </ div > < display:table name = "persons" class = "table table-condensed table-striped table-hover" requestURI = "" id = "personList" export = "true" pagesize = "25" > < display:column property = "id" sortable = "true" href = "editPerson" media = "html" paramId = "id" paramProperty = "id" titleKey = "person.id" /> < display:column property = "id" media = "csv excel xml pdf" titleKey = "person.id" /> < display:column property = "firstName" sortable = "true" titleKey = "person.firstName" /> < display:column property = "lastName" sortable = "true" titleKey = "person.lastName" /> < display:setProperty name = "paging.banner.item_name" >< fmt:message key = "personList.person" /></ display:setProperty > < display:setProperty name = "paging.banner.items_name" >< fmt:message key = "personList.persons" /></ display:setProperty > < display:setProperty name = "export.excel.filename" >< fmt:message key = "personList.title" />.xls</ display:setProperty > < display:setProperty name = "export.csv.filename" >< fmt:message key = "personList.title" />.csv</ display:setProperty > < display:setProperty name = "export.pdf.filename" >< fmt:message key = "personList.title" />.pdf</ display:setProperty > </ display:table > </ div >
|
< action name = "persons" class = "org.appfuse.tutorial.webapp.action.PersonAction" method = "list" > < result >/WEB-INF/pages/personList.jsp</ result > </ action > |
The default result type is "dispatcher" and its name is "success". This configured result type simply forwards you to the
personList.jsp
file when "success" is returned from PersonAction.list()
. Other result types include redirect and chain. Redirect performs a client-side redirect and chain forwards you to another action. For a full list of result types, see Struts 2's Result Types documentation.
The "method" attribute of this action has a
list
attribute, which calls the list()
method when the "persons" URL is invoked. If you exclude the method attribute, it calls the execute()
method.
Open src/main/resources/ApplicationResources.properties and add i18n keys/values for the various "person" properties:
# -- person form -- person.id=Id person.firstName=First Name person.lastName=Last Name person.added=Person has been added successfully. person.updated=Person has been updated successfully. person.deleted=Person has been deleted successfully. # -- person list page -- personList.title=Person List personList.heading=Persons personList.person=Person personList.persons=Persons # -- person detail page -- personDetail.title=Person Detail personDetail.heading=Person Information |
Run mvn jetty:run and open http://localhost:8080/persons in your browser. Login with admin/admin and you should see a screen similar to the figure below.
Security settings for AppFuse specify that most url-patterns should be protected (except for /signup and /passwordHint). This guarantees that clients must go through an Action to get to a JSP (or at least the ones in WEB-INF/pages).
CSS Customization
Icon
If you want to customize the CSS for a particular page, you can add <body id="pageName"/> to the top of the file. This will be slurped up by SiteMesh and put into the final page. You can then customize your CSS on a page-by-page basis using something like the following:
body#pageName element.class { background-color: blue }
we need to work with these links:
========================================
http://displaytag.sourceforge.net/1.2/export_filter.html
http://appfuse.org/display/APF/AppFuse+QuickStart
http://appfuse.org/display/APF/Using+Spring+MVC
http://appfuse.org/display/APF/AppFuse+QuickStart
http://jnb.ociweb.com/jnb/jnbMay2008.html
http://appfuse.org/display/APF/FAQ
Thanks for sharing this informative content , Great work
ReplyDeleteLeanpitch provides online training in Product prototyping during this lockdown period everyone can use it wisely.
icp-cat training