Uploaded image for project: 'Forge'
  1. Forge
  2. FORGE-1787

When scaffolding with --webRoot parameter, pageTemplate.xhtml and search.xhtml are not right

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Blocker Blocker
    • 2.7.0.Final
    • 2.5.0.Final
    • Scaffold
    • None

      When scaffolding a JSF application, without using a --webRoot parameter, the navigation in the pageTemplate.xhtml works as expected :

      scaffold-setup ;
      scaffold-generate --targets org.agoncal.training.javaee6adv.model.Author ;
      scaffold-generate --targets org.agoncal.training.javaee6adv.model.CD ;
      

      The template navigation looks like :

      			<ul>
      				<li>
      					<h:link outcome="/CD/search" value="CD"/>
      				</li>
      				<li>
      					<h:link outcome="/author/search" value="Author"/>
      				</li>
      			</ul>
      

      But if I specify the --webRoot parameter, then the navigation does not work as there is a / missing :

      scaffold-setup ;
      scaffold-generate --webRoot admin --targets org.agoncal.training.javaee6adv.model.Author ;
      scaffold-generate --webRoot admin --targets org.agoncal.training.javaee6adv.model.CD ;
      

      The template :

      			<ul>
      				<li>
      					<h:link outcome="admin/CD/search" value="CD"/>
      				</li>
      				<li>
      					<h:link outcome="admin/author/search" value="Author"/>
      				</li>
      			</ul>
      

      The correct navigation would be :

      			<ul>
      				<li>
      					<h:link outcome="/admin/CD/search" value="CD"/>
      				</li>
      				<li>
      					<h:link outcome="/admin/author/search" value="Author"/>
      				</li>
      			</ul>
      

      The only way to make it work is to add a / to the webroot, which is not very intuitive :

      scaffold-setup ;
      scaffold-generate --webRoot /admin --targets org.agoncal.training.javaee6adv.model.Author ;
      scaffold-generate --webRoot /admin --targets org.agoncal.training.javaee6adv.model.CD ;
      

      But this trick doesn't work for the search.xhtml page. The generated code is :

      					<h:link outcome="/genre/view">
      						<f:param name="id" value="#{_item.id}"/>
      						<h:outputText id="itemName" value="#{_item.name}"/>
      					</h:link>
      

      The outcome is not right, and should contain a /admin

      					<h:link outcome="/admin/genre/view">
      						<f:param name="id" value="#{_item.id}"/>
      						<h:outputText id="itemName" value="#{_item.name}"/>
      					</h:link>
      

              ivan_stefanov Ivan St. Ivanov (Inactive)
              agoncal Antonio Goncalves (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: