I am attaching my files here. I am using Tomcat 5.5.12.
my layout page - siteLayout.jsp
<%@ taglib uri="/Web-inf/tlds/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/Web-inf/tlds/struts-html.tld" prefix="html"%>
<%@ taglib uri="/Web-inf/tlds/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/Web-inf/tlds/struts-tiles.tld" prefix="tiles"%>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title><tiles:getAsString name="title" ignore="true"/></title>
</head>
<body>
<html:errors/>
<html:form action="/validate.do?command=validate">
<table border="1">
<tr>
<td width="50%">
<tiles:insert attribute="tile1" ignore="true"/>
</td>
<td width="50%">
<tiles:insert attribute="tile2" />
</td>
</tr>
</table>
</html:form>
</body>
</html>
Tile 1.jsp
<%@ taglib uri="/Web-inf/tlds/struts-html.tld" prefix="html"%>
<table>
<tr>
<td align="center" colspan="2">
<font size="4"><b>Please Enter the Following Details</b></font>
</tr>
<tr>
<td align="right">
<b>Name</b>
</td>
<td align="left">
<html:text property="name" size="30" maxlength="30"/>
</td>
</tr>
</table>
Tile2.jsp
<%@ taglib uri="/Web-inf/tlds/struts-html.tld" prefix="html"%>
<table>
<tr>
<td align="right">
<b>Address</b>
</td>
<td align="left">
<html:text property="address" size="30" maxlength="30"/>
</td>
</tr>
<tr>
<td align="right">
<b>E-mail address</b>
</td>
<td align="left">
<html:text property="emailAddress" size="30" maxlength="30"/>
</td>
</tr>
<tr>
<td align="right">
<html:submit>Save</html:submit>
</td>
<td align="left">
<html:cancel>Cancel</html:cancel>
</td>
</tr>
</table>
struts-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD
Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<data-sources>
</data-sources>
<form-beans>
<form-bean name="myValForm" type="bean.MyValForm" />
</form-beans>
<global-forwards>
<forward name="error_fwd" path="/jsp/Error.jsp" />
</global-forwards>
<action-mappings>
<action path="/initVal" type="bean.MyValAction"
scope="request">
<forward name="success" path="validationDef"/>
</action>
<action path="/validate" type="bean.MyValAction"
name="myValForm" scope="request" validate="true"
input="validationDef">
<forward name="success" path="validationDef"/>
</action>
</action-mappings>
<controller>
</controller>
<message-resources parameter="resources.resources"/>
<message-resources parameter="resources.Validation"/>
<plug-in className="org.apache.struts.tiles.TilesPlugin">
<set-property property="definitions-config"
value="/WEB-INF/tiles-defs.xml" />
<set-property property="moduleAware" value="true" />
<set-property property="definitions-parser-validate"
value="true" />
</plug-in>
<plug-in
className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"
value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml" />
</plug-in>
</struts-config>
MyValForm.java
package bean;
import org.apache.struts.validator.ValidatorForm;
public class MyValForm extends ValidatorForm {
public MyValForm(){
super();
}
private String name;
private String address;
private String emailAddress;
/**
* @return Returns the address.
*/
public String getAddress() {
return address;
}
/**
* @param address The address to set.
*/
public void setAddress(String address) {
this.address = address;
}
/**
* @return Returns the emailAddress.
*/
public String getEmailAddress() {
return emailAddress;
}
/**
* @param emailAddress The emailAddress to set.
*/
public void setEmailAddress(String emailAddress) {
this.emailAddress = emailAddress;
}
/**
* @return Returns the name.
*/
public String getName() {
return name;
}
/**
* @param name The name to set.
*/
public void setName(String name) {
this.name = name;
}
}
}
Dave Newton
<[EMAIL PROTECTED] To: Struts Users Mailing
List <[email protected]>
com> cc:
Subject: Re: Tiles and
Validator Framework
02/28/2006 07:57
PM
Please respond to
"Struts Users
Mailing List"
Shiby Maria John wrote:
> Anyone has an answer to my problem ??
>
> I want to use both Tiles and Validator in my application.
> Any tips why it is not working for me??
>
I use Tiles and the validation framework all the time with no
problems.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]