You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rauf Khan <mk...@gmail.com> on 2006/07/28 07:09:23 UTC

page going out of tiles

Hi All,

   Iam using tiles for my project which has a header,menubar, body & footer.


  For *body* i have a registration form, for which iam validating using
validator frame. For which the code is given below. When i enter only
numbers in the password field it works fine & the *resultpage* will be
displayed & ALSO the page will be in the tiles(body) only. Suppose if i
enter characters in the password field its not displaying msg "please enter
only numbers"  (ComposeForm.password.valid) & ALSO the *resultpage *is
coming out of the tiles & displays as a single page. Any solution.

<!-- compose form Validation-->
 <form name="InfoForm">
    <field  property="fname" depends="required">
        <arg0 key="ComposeForm.fname"/>
   </field>
   <field  property="password"  depends="required,mask">
        <msg name="mask" key="ComposeForm.password.valid"/>
        <arg key="ComposeForm.password"/>
        <var>
                <var-name>mask</var-name>
                <var-value>^[0-9]*$</var-value>
        </var>
   </field>
   <field  property="email" depends="required,email">
          <arg0 key="ComposeForm.email"/>
      </field>
 </form>

Thanks in advance.

Regards
Rauf Khan

Re: page going out of tiles

Posted by Rauf Khan <mk...@gmail.com>.
Thanks for that, now it works fine.

 If i enter characters in the password field the alert :"please enter only
numbers" <ComposeForm.numbers> is not displayed but rest of the other alerts
are displaying.

validation.xml
-----------------------
<!-- compose form Validation-->
 <form name="InfoForm">
    <field  property="fname" depends="required">
   <arg0 key="ComposeForm.fname"/>
 </field>
     <field  property="password"  depends="required,mask">
     <msg name="mask" key="ComposeForm.numbers"/>
           <arg key="ComposeForm.password"/>
  <var>
                         <var-name>mask</var-name>
                         <var-value>^[0-9]*$</var-value>
                     </var>
      </field>
      <field  property="email" depends="required,email">
          <arg0 key="ComposeForm.email"/>
      </field>
 </form>

Rauf Khan


On 7/28/06, Antonio Petrelli <br...@tariffenet.it> wrote:
>
> Rauf Khan ha scritto:
> > FYI :
> > Compose page is the page that iam trying to validate, thats the reason i
> > have written there.
> > compose.jsp
>
> It is exactly what I suspected. If the validation fails, it will return
> to the page specified in "input" attribute in the action mapping, that
> is "/jsp/compose.jsp".
> That page contains only the form and it is not the complete Tiles
> definition, therefore you will see that form "out of Tiles".
>
> I hope it clears the concept
> Antonio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: page going out of tiles

Posted by Antonio Petrelli <br...@tariffenet.it>.
Rauf Khan ha scritto:
> FYI :
> Compose page is the page that iam trying to validate, thats the reason i
> have written there.
> compose.jsp

It is exactly what I suspected. If the validation fails, it will return 
to the page specified in "input" attribute in the action mapping, that 
is "/jsp/compose.jsp".
That page contains only the form and it is not the complete Tiles 
definition, therefore you will see that form "out of Tiles".

I hope it clears the concept
Antonio

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: page going out of tiles

Posted by Rauf Khan <mk...@gmail.com>.
FYI :
 Compose page is the page that iam trying to validate, thats the reason i
have written there.
compose.jsp
--------------------

<%@ taglib uri="/tags/struts-html"  prefix="html" %>

<html:html>
<body>
<br>
<h1>COMPOSE PAGE</h1>
<br>
<html:form action = "/some" method= "post" onsubmit="return
validateInfoForm(this);">
    Name :&nbsp; <html:text property="fname" /><BR>
    Password :  &nbsp; <html:password property="password" /><BR>
    Email : &nbsp; <html:text property="email"  /><BR>
<html:submit/>

<!-- Begin Validator Javascript Function-->
<html:javascript formName="InfoForm"/>
<!-- End of Validator Javascript Function-->

</html:form>
</body>
</html:html>



On 7/28/06, Antonio Petrelli <br...@tariffenet.it> wrote:
>
> Rauf Khan ha scritto:
> >        <action   path="/some"    name="InfoForm"
> > type="InformationAction"      scope="request"     validate="true"
> > input="/jsp/compose.jsp">
> >            <forward name="next" path="resultpage"/>
> >        </action>
>
> The problem is in the "input" attribute: you have to put either
> "composepage" (the name of the definition, I am not sure if it works) or
> a JSP page inclusing the "composepage" definition, via the <tiles:insert
> definition="composepage"> tag.
> "/jsp/composepage.jsp" seems to be the body, not the complete page, am I
> right?
>
> HTH
> Antonio
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: page going out of tiles

Posted by Antonio Petrelli <br...@tariffenet.it>.
Rauf Khan ha scritto:
>        <action   path="/some"    name="InfoForm"
> type="InformationAction"      scope="request"     validate="true"
> input="/jsp/compose.jsp">
>            <forward name="next" path="resultpage"/>
>        </action>

The problem is in the "input" attribute: you have to put either 
"composepage" (the name of the definition, I am not sure if it works) or 
a JSP page inclusing the "composepage" definition, via the <tiles:insert 
definition="composepage"> tag.
"/jsp/composepage.jsp" seems to be the body, not the complete page, am I 
right?

HTH
Antonio


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: page going out of tiles

Posted by Rauf Khan <mk...@gmail.com>.
Hi,

   I have copied the following <action-mappings> & <tiles-definitions> for
ur kind reference.

1)
<action-mappings>
            <!-- Default "Welcome" action -->
           <action  path="/Welcome1"   forward="welcomepage"/>

     <action  path="/inbox"   forward="inboxpage"/>
     <action  path="/compose"   forward="composepage"/>

        <action   path="/some"    name="InfoForm"
type="InformationAction"      scope="request"     validate="true"
input="/jsp/compose.jsp">
            <forward name="next" path="resultpage"/>
        </action>
    </action-mappings>
2)

<tiles-definitions>

    <definition name=".mainLayout" path="/templates/main_layout.jsp">
        <put name="title" value="Testing Page 1 Title"/>
        <put name="header" value="/jsp/header.jsp"/>
        <put  name="menubar" value="/jsp/menubar.jsp"/>
        <put name="newsupdates" value="/jsp/newsupdates.jsp"/>
        <put name="body"  value="/jsp/body.jsp"/>
        <put name="footer"  value="/jsp/footer.jsp"/>
    </definition>

   <definition name="welcomepage" extends=".mainLayout">
        <put name="title" value="This is Welcome Page"/>
    </definition>

   <definition name="inboxpage" extends=".mainLayout">
        <put name="title" value="This is Inbox Page"/>
        <put name="body" value="/jsp/inbox.jsp"/>
    </definition>

   <definition name="composepage" extends=".mainLayout">
        <put name="title" value="This is Compose Page"/>
        <put name="body" value="/jsp/compose.jsp"/>
    </definition>

    <definition name="resultpage" extends=".mainLayout">
        <put name="title" value="This is Result Page"/>
        <put name="body"  value="/jsp/result.jsp"/>
    </definition>

   </tiles-definitions>

Regards
Rauf Khan

On 7/28/06, Antonio Petrelli <br...@tariffenet.it> wrote:
>
> Rauf Khan ha scritto:
> > For *body* i have a registration form, for which iam validating using
> > validator frame. For which the code is given below. When i enter only
> > numbers in the password field it works fine & the *resultpage* will be
> > displayed & ALSO the page will be in the tiles(body) only. Suppose if i
> > enter characters in the password field its not displaying msg "please
> > enter
> > only numbers"  (ComposeForm.password.valid) & ALSO the *resultpage *is
> > coming out of the tiles & displays as a single page.
>
> If I understood you well, if the value of the password is correct, it
> will display the correct page (with header, footer, etc.). When it is
> wrong it will display only the body part.
> But to tell you a solution, please post your action mapping (with
> forwards) and all Tiles definitions involved (if any).
>
> Ciao
> Antonio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: page going out of tiles

Posted by Antonio Petrelli <br...@tariffenet.it>.
Rauf Khan ha scritto:
> For *body* i have a registration form, for which iam validating using
> validator frame. For which the code is given below. When i enter only
> numbers in the password field it works fine & the *resultpage* will be
> displayed & ALSO the page will be in the tiles(body) only. Suppose if i
> enter characters in the password field its not displaying msg "please 
> enter
> only numbers"  (ComposeForm.password.valid) & ALSO the *resultpage *is
> coming out of the tiles & displays as a single page.

If I understood you well, if the value of the password is correct, it 
will display the correct page (with header, footer, etc.). When it is 
wrong it will display only the body part.
But to tell you a solution, please post your action mapping (with 
forwards) and all Tiles definitions involved (if any).

Ciao
Antonio

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org