]
Antonio Goncalves reassigned FORGE-1594:
----------------------------------------
Assignee: Antonio Goncalves (was: Vineet Reynolds)
Being able to create an empty JSF page
--------------------------------------
Key: FORGE-1594
URL:
https://issues.jboss.org/browse/FORGE-1594
Project: Forge
Issue Type: Sub-task
Components: Scaffold
Affects Versions: 2.0.0.Final
Reporter: Antonio Goncalves
Assignee: Antonio Goncalves
Priority: Minor
Fix For: 2.x Future
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 :
{code}
faces-new-view --named mypage
{code}
This will create a mypage.xhtml on the root of the webapp directory. You could also give
a different directory with :
{code}
faces-new-view --named mypage --targetDirectory admin
{code}
This will create the page under webapp/admin/mypage.xhtml.
{code}
<?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>
{code}
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 :
{code}
faces-new-view --named mypage --targetDirectory admin --title Administration Page
--header Admin Header --subheader Admin Sub Header
{code}
It would just create a minimum JSF page such as :
{code}
<?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>
{code}
If there were several templates, we could do :
{code}
faces-new-view --named mypage --template MyTemplate.xhtml
{code}
PS : I'm on holidays skiing, and the internet connection is really bad. So I could
search for similar JIRAs if they existed