In your ClientRegister.jspx, you have:

<ui:composition template="Template.jspx">

Change this to:

<ui:composition template="/Template.jspx">


Glauco P. Gomes

Marcelo Lotif escreveu:
Thank you for the responses, but I'm getting the same error, and with
'./' I got the second URL. pretty reasonable.

Do I have to configure something somewhere? Maybe the new path or something?

On Wed, Jul 8, 2009 at 5:16 PM, Glauco P.
Gomes<[email protected]> wrote:
Can you post the ClientRegister.jspx code?

Maybe your problem is in the reference from the ClientRegister.jspx to the
Template.jspx


Glauco, this link is located at the javascript menu in Template.jspx,
that is the whole html "shell". Here goes the snippet of what I've
already done from the static html:

<?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";>
<html xmlns="http://www.w3.org/1999/xhtml";
        xmlns:ui="http://java.sun.com/jsf/facelets";
        xmlns:h="http://java.sun.com/jsf/html";
        xmlns:f="http://java.sun.com/jsf/core";
        xmlns:c="http://java.sun.com/jstl/core";
        xmlns:a4j="http://richfaces.org/a4j";
    xmlns:rich="http://richfaces.org/rich";
        xml:lang="pt" lang="pt-br">
<f:view>
<head>

<meta http-equiv="content-type" content="text/html; charset=utf-8"
/><title>SmartAlloc</title>

<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="style.css" rel="stylesheet" type="text/css" media="screen"
/><!--[if IE]> <style type="text/css"> #sidebar #calendar {
background-position: 0px 20px; } </style> <![endif]-->

<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/menu.js" type="text/javascript"></script>
        <link href="js/menu.css" rel="stylesheet" type="text/css" media="screen" 
/>
</head>
<body>
        <div id="logo">
        <h1><a href="#"><h:outputText value="#{msg['app.name']}" /></a></h1>
        <h2><h:outputText value="#{msg['app.description']}" /></h2>
</div>
<div id="menu">
        <ul id="jsddm">
                <li class="first">
                        <a href="#">
                                <table cellpadding="0" cellspacing="0">
                                        <tr>
                                                <td><img src="images/cadastro.gif" width="24" 
height="24" /></td>
                                                <td><h:outputText 
value="#{msg['template.menu.register']}" /></td>
                                        </tr>
                                </table>
                        </a>
                        <ul>
                            <li>
                                <h:outputLink value="register/ClientRegister.jsf" 
>
                                        <h:outputText
value="#{msg['template.menu.register.company']}" />
                                </h:outputLink>
                            </li>

<!-- There's a very long html menu code -->

</li>
</ul>

</div>
<hr />
<br/>
<!-- start page -->
<div id="page">
        <!-- start content -->
        <div id="content">
                <div class="post">
                
                        <!-- INSERT -->
                        <ui:insert name="body" />
                        
                </div>
        </div>
        <!-- end content -->
</div>
<!-- end page -->
<div id="footer">
</div>
</body>
</f:view>
</html>


And this is the ClientRegister.jspx 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";>

<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"; version="2.0"
        xmlns="http://www.w3.org/1999/xhtml";
        xmlns:ui="http://java.sun.com/jsf/facelets";
        xmlns:h="http://java.sun.com/jsf/html";
        xmlns:f="http://java.sun.com/jsf/core";
        xmlns:c="http://java.sun.com/jstl/core";
        xmlns:a4j="http://richfaces.org/a4j";
        xmlns:rich="http://richfaces.org/rich";>
        
<f:view>
        <ui:composition template="Template.jspx">
                <ui:define name="body">
                        <table width="100%"><tr><td width="80%">
                                <h2 class="title"><h:outputText
value="#{msg['page.clientRegister.header']}" /></h2>
                        </td><td width="20%" valign="center" align="right">
                                <a href="EditClientRegister.html"
title="#{msg['commons.general.new']}" class="novo">
                                        <h:outputText 
value="#{msg['commons.general.new']}" />
                                </a>
                        </td><td width="0%">
                                <a href="EditClientRegister.html" 
title="#{msg['commons.general.new']}">
                                        <img src="images/novo.png" />
                                </a>
                        </td></tr></table>
                        <br/>
                        <div class="entry">
                                <div id="searchBar" >
                                        <div class="filters">
                                                <h:form>
                                                        <h:outputLabel for="name" 
value="#{msg['commons.company.name']}:"/>
                                                        <h:inputText id="name" 
value="#{companySearchForm.name}"
size="50" /><h:outputText value="  "/>
                                                        
                                                        <h:outputLabel for="cnpj" 
value="#{msg['commons.company.cnpj']}:"/>
                                                        <h:inputText id="cnpj"
value="#{companySearchForm.cnpj}"/><h:outputText value="  "/>
                                                        <h:commandButton value="  
#{msg['commons.general.search']}  "
action="#{companySearchForm.doSearch}"/>
                                                </h:form>
                                        </div>
                                </div>
                                <br/>
                                
                                Teste:
                                <a4j:form>
                                        <rich:panel header="RichFaces Greeter" 
style="width: 315px">
                                                <h:outputText value="Your name: " 
/>
                              <h:inputText value="#{companySearchForm.name}" >
                                    <f:validateLength minimum="1"
maximum="30" />
                              </h:inputText>

                              <a4j:commandButton value="Get greeting"
reRender="greeting" />

                              <h:panelGroup id="greeting" >
                                    <h:outputText value="Hello, "
rendered="#{companySearchForm.name}" />
                                    <h:outputText
value="#{companySearchForm.name}" />
                                    <h:outputText value="!"
rendered="#{companySearchForm.name}" />
                              </h:panelGroup>
                        </rich:panel>                     
                                </a4j:form>
                                <br/>
                        </div>
                </ui:define>
        </ui:composition>
</f:view>
</jsp:root>


the code is working when I use the root folder for
ClientRegister.jspx, and breaks when I put ClientRegister.jspx in some
subfolder. there is another page called MainPage.jspx that is using
the Template.jspx, it is located under the root folder and it is
working good.

Glauco P. Gomes

Marcelo Lotif escreveu:

I've already tried this, but it gives me a 404 error from tomcat
saying that the resource is not available. The URL says
"http://localhost:8080/register/ClientRegister.jsf"; instead of
"http://localhost:8080/appname/register/ClientRegister.jsf";. This
second way appears when I put the way I wrote first, which I presume
is correct, but this also gives me the same 404 page.

On Wed, Jul 8, 2009 at 4:40 PM, Dj Apal [GR]<[email protected]> wrote:


<h:outputLink value="/register/
ClientRegister.jsf" >link</h:outputLink>

2009/7/8 Marcelo Lotif <[email protected]>


Hi all,

Fir. I'm new to MyFaces and I'm stating to build a new application.
I'm using MyFaces + Facelets + RichFaces, and It's all already up and
running on Eclipse, but I'm trying to put some of my pages inside a
subfolder and I was not well succeeded. Here's an example of what I
got:

 - WebContent
   - META-INF
   - WEB-INF
       - lib
       - faces-config.xml
       - web.xml
   - ClientRegister.jspx
   - Template.jspx
   - index.jspx

with a link structured like this:
<h:outputLink value="ClientRegister.jsf" >link</h:outputLink>

The above example is working. Here's what I'm trying to do:

 - WebContent
   - META-INF
   - WEB-INF
       - lib
       - faces-config.xml
       - web.xml
   - register
       - ClientRegister.jspx
   - Template.jspx
   - index.jspx

with a link structured like this:
<h:outputLink value="register/ClientRegister.jsf" >link</h:outputLink>

And this is not working.

I've already googled with no success.

Can someone point me what am I doing wrong?

--
Marcelo Lotif










Reply via email to