-
Sub-task
-
Resolution: Unresolved
-
Minor
-
2.0.0.Final
At the moment the only way to generate JSF pages is with scaffolding. When you create an application, you realize that these scaffolded pages are not enough and that you need to create new ones. To save time and help the developer in creating new pages, it would be good to have a command such :
faces-new-view --named mypage
This will create a mypage.xhtml on the root of the webapp directory. You could also give a different directory with :
faces-new-view --named mypage --targetDirectory admin
This will create the page under webapp/admin/mypage.xhtml.
<?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:f="http://xmlns.jcp.org/jsf/core" xmlns:ui="http://xmlns.jcp.org/jsf/facelets" template="/resources/scaffold/pageTemplate.xhtml"> <ui:param name="pageTitle" value="mypage"/> <ui:define name="header"> mypage </ui:define> <ui:define name="subheader"> mypage </ui:define> <ui:define name="footer"/> <ui:define name="main"> </ui:define> </ui:composition>
The name of the page mypage is used for the title, header, subheader. But we could customize this using optional attributes for title, header, subheader :
faces-new-view --named mypage --targetDirectory admin --title Administration Page --header Admin Header --subheader Admin Sub Header
It would just create a minimum JSF page such as :
<?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:f="http://xmlns.jcp.org/jsf/core" xmlns:ui="http://xmlns.jcp.org/jsf/facelets" template="/resources/scaffold/pageTemplate.xhtml"> <ui:param name="pageTitle" value="Administration Page"/> <ui:define name="header"> Admin Header </ui:define> <ui:define name="subheader"> Admin Sub Header </ui:define> <ui:define name="footer"/> <ui:define name="main"> </ui:define> </ui:composition>
If there were several templates, we could do :
faces-new-view --named mypage --template MyTemplate.xhtml
PS : I'm on holidays skiing, and the internet connection is really bad. So I could search for similar JIRAs if they existed
- is duplicated by
-
FORGE-1463 Create Faces Command to create new View
- Closed
- is related to
-
FORGE-2370 Being able to create a new HTML Page
- Open
- relates to
-
FORGE-2368 Being able to create a new JSF Template
- Open
-
FORGE-236 FacesPlugin should be able to create new empty views
- Closed