Hi,
I am getting this exception "java.lang.ClassCastException: org.apache.struts.validator.DynaValidatorForm
" when I try to click search button in my jsp which I could not able to rectify or identify. Can any one help where I am going wrong in this. I dont have a problem with first submit button. I am using lookupdispatchaction for this
Exception is:
-------------
javax.servlet.ServletException: java.lang.ClassCastException: org.apache.struts.validator.DynaValidatorForm
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:520)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:427)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
My jsp looks like this:
AddonDomain.jsp
---------------
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" session="true" %>
<%@ taglib uri=" prefix="bean" %>
<%@ taglib uri=" prefix="html" %>
<%@ taglib uri=" prefix="logic" %>
<html>
<head>
<script type="text/javascript">
var xmlHttp;
function checkparksubdom(str)
{
var str2= document.getElementById("subdomain").value;
//alert(str2);
alert(str);
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
var url="Subdetails.do?code="+str+"&&code1="+str2;
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
function stateChanged()
{
if (xmlHttp.readyState==4)
{
if(xmlHttp.status == 200)
{
document.getElementById("msg").value="";
var subdomNameEle = xmlHttp.responseXML.getElementsByTagName("DOMNAME");
var subName = subdomNameEle[0].firstChild.nodeValue;
document.getElementById("msg").innerText=subName;
}
}
}
</script>
<style>
td
{
font-family:verdana, arial, helvetica, Sans-Serif; font-size:12px
}
</style>
<script src="sorttable.js"></script>
<script>
function funReset()
{
document.getElementById("selector").value="none";
document.getElementById("newDomName").value="";
document.getElementById("uName").value="";
document.getElementById("documentRoot").value="";
document.getElementById("password").value="";
document.getElementById("passwordAgain").value="";
document.getElementById("search").value="";
}
function pwdvalid()
{
setTimeout("document.getElementById('pass').style.display='block'",600);
}
function againPwdValid()
{
setTimeout("document.getElementById('again').style.display='block'",600);
checkPwd();
}
function checkPwd()
{
if(document.getElementById("password").value!=document.getElementById("passwordAgain").value)
{
setTimeout("document.getElementById('error').style.display='block'",800);
setTimeout("document.getElementById('again').style.display='none'",800);
setTimeout("document.getElementById('errinfo').style.display='block'",800);
}
else
{
setTimeout("document.getElementById('error').style.display='none'",800);
setTimeout("document.getElementById('again').style.display='block'",800);
setTimeout("document.getElementById('errinfo').style.display='none'",800);
}
}
function msg()
{
if(document.getElementById("password").value!=document.getElementById("passwordAgain").value)
{
setTimeout("document.getElementById('error').style.display='block'",800);
setTimeout("document.getElementById('again').style.display='none'",800);
setTimeout("document.getElementById('errinfo').style.display='block'",800);
alert("Password does not match. Retype again");
}
else
{
setTimeout("document.getElementById('error').style.display='none'",800);
setTimeout("document.getElementById('again').style.display='block'",800);
setTimeout("document.getElementById('errinfo').style.display='none'",800);
}
}
</script>
<title><bean:message bundle="domains" key="whm.jsp.title"/></title>
</head>
<body onload="funReset()" >
<table width="70%" align="center">
<tr>
<td>
<font color="blue">
<html:messages bundle="domains" id="messages" message= "true">
Addon Domain <bean:write name= "messages" /> <br >
</html:messages>
</font>
<font color="red">
<html:errors bundle="domains"/>
</font>
<br></br>
<font size="3">
<img src="images/domains/subdomains.jpg" width="30" height="30"/><b><bean:message bundle="domains" key="domain.addondomain.heading"/></b>
</font>
<br></br>
<font size="2">
<bean:message bundle="domains" key="domain.addondomain.description"/><html:img src="images/domains/homeb.gif" />
<br></br><bean:message bundle="domains" key="domain.addondomain.description1"/>
<br></br>
<b><bean:message bundle="domains" key="domain.addondomain.createanaddondomain"/></b>
</font>
<html:form action="/AddonDomain.do" method="post" focus="selector">
<div style="border: 1px solid rgb(170, 170, 170); padding: 5px; background-color: rgb(235, 235, 235); width: 700;height:135">
<table>
<tr>
<td align="right">Select the Subdomain :</td>
<td >
<html:select property="selector">
<htmlption value="none">Select from the list</htmlption>
<logic:notEmpty name="listSubdomains">
<htmlptions collection="listSubdomains" property="subdomName"/>
</logic:notEmpty>
</html:select>
</td>
<td></td>
</tr>
<tr>
<td align="right">
<bean:message bundle="domains" key="domain.addondomain.newdomainname"/> :
</td>
<td>
<html:text property="newDomName" size="30" maxlength="20"/>
</td>
<td><html:errors property="newDomainName"/></td>
</tr>
<tr>
<td align="right">
<bean:message bundle="domains" key="domain.addondomain.subdomain"/> :
</td>
<td>
<html:text property="uName" size="30" maxlength="20" onblur="checkparksubdom();"/>
</td>
<td><html:errors property="uName"/></td>
</tr>
<tr>
<td align="right">
<bean:message bundle="domains" key="domain.root"/> : <img src="images/domains/homeb.gif" />
</td>
<td>
<html:text property="documentRoot" size="30" />
</td>
<td></td>
</tr>
<tr>
<td align="right">
<bean:message bundle="domains" key="domain.addondomain.password"/> :
</td>
<td>
<htmlassword property="password" size="30" maxlength="10" onkeypress="pwdvalid();"/>
</td>
<td><img src="images/domains/success.png" id="pass" style="display:none"/></td>
</tr>
<tr>
<td align="right">
<bean:message bundle="domains" key="domain.addondomain.passwordagain" /> :
</td>
<td>
<htmlassword property="passwordAgain" size="30" maxlength="10" onfocus="againPwdValid();" onkeyup="checkPwd();"/>
</td>
<td><img src="images/domains/success.png" id="again" style="display:none"/><img src="images/domains/error.png" id="error" style="display:none"/></td>
<td><font id="errinfo" style="display:none; font-size:10px;">Password does not match </font></td>
</tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr>
<td></td>
<td align="center">
<html:submit property="method" onclick="msg()">
<bean:message bundle="domains" key="domain.addondomain.adddomain"/>
</html:submit>
</td>
<td></td>
</tr>
</table>
<br></br>
</div>
<font size="2"><bean:message bundle="domains" key="domain.addondomain.hint"/></font><br></br>
<br></br>
<font size="2"><b><bean:message bundle="domains" key="domain.addondomain.modifyaddondomain"/></b></font><br></br>
<table cellSpacing="0" cellPadding="3" width="100%" border="0">
<tr>
<td align="right">
<p>
<bean:message bundle="domains" key="subdomain.search"/>
<html:text size="20" property="search"/>
<html:submit property="method">
<bean:message bundle="domains" key="domain.button.go"/>
</html:submit>
</p>
</td>
</tr>
</table>
<table width="100%" border="1" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th align="center" background="images/tbl-bg.jpg" height="1">
<bean:message bundle="domains" key="domain.addondomain.addondomains"/>
</th>
<th align="center" background="images/tbl-bg.jpg" height="1">
<bean:message bundle="domains" key="domain.root"/>
</th>
<th align="center" background="images/tbl-bg.jpg" height="1">
<bean:message bundle="domains" key="domain.addondomain.username"/>
</th>
<th align="center" background="images/tbl-bg.jpg" height="1">
<bean:message bundle="domains" key="domain.addondomain.redirectto"/>
</th>
<th align="center" background="images/tbl-bg.jpg" height="1">
<bean:message bundle="domains" key="domain.addondomain.actions"/>
</th>
</tr>
</thead>
<tbody>
<logic:notEmpty name="parkedSubdomList">
<logic:iterate id="account" name="parkedSubdomList" scope="request" >
<tr>
<td>
<bean:write name="account" property="addonDomain"/>
</td>
<td>
<bean:write name="account" property="documentRoot"/>
</td>
<td>
<bean:write name="account" property="uName"/>
</td>
<td>
<bean:write name="account" property="redirectUrl"/>
</td>
<td align="center">
<html:link href="./EditAddondomain.do" paramId="addonDomain" paramName="account" paramProperty="addonDomain">
Modify
</html:link>
</td>
</tr>
</logic:iterate>
</logic:notEmpty>
<logic:empty name="parkedSubdomList">
<tr>
<td colspan="5">
No Subdomains are configured
</td>
</tr>
</logic:empty>
</tbody>
</table>
</html:form>
<br><br><br>
<center>
<jsp:include page="/pages/Footer.jsp"></jsp:include>
</center>
</td>
</tr>
</table>
</body>
</html>
struts-config.xml
-----------------
<form-bean name="AddonDomainForm" type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="newDomName" type="java.lang.String"/>
<form-property name="uName" type="java.lang.String"/>
<form-property name="documentRoot" type="java.lang.String"/>
<form-property name="password" type="java.lang.String"/>
<form-property name="passwordAgain" type="java.lang.String"/>
<form-property name="search" type="java.lang.String"/>
<form-property name="selector" type="java.lang.String"/>
<form-property name="addonDomain" type="java.lang.String"/>
<form-property name="redirecturl" type="java.lang.String"/>
</form-bean>
<action path="/AddonDomain"
type="com.marvel.domains.actions.DomainLookupAction"
name="AddonDomainForm"
scope="session"
input="/pages/domains/AddonDomain.jsp"
parameter="method"
validate="true"
>
<forward name="success" path="/pages/domains/AddonDomain.jsp" />
</action>
I am getting this exception "java.lang.ClassCastException: org.apache.struts.validator.DynaValidatorForm
" when I try to click search button in my jsp which I could not able to rectify or identify. Can any one help where I am going wrong in this. I dont have a problem with first submit button. I am using lookupdispatchaction for this
Exception is:
-------------
javax.servlet.ServletException: java.lang.ClassCastException: org.apache.struts.validator.DynaValidatorForm
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:520)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:427)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
My jsp looks like this:
AddonDomain.jsp
---------------
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" session="true" %>
<%@ taglib uri=" prefix="bean" %>
<%@ taglib uri=" prefix="html" %>
<%@ taglib uri=" prefix="logic" %>
<html>
<head>
<script type="text/javascript">
var xmlHttp;
function checkparksubdom(str)
{
var str2= document.getElementById("subdomain").value;
//alert(str2);
alert(str);
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
var url="Subdetails.do?code="+str+"&&code1="+str2;
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
function stateChanged()
{
if (xmlHttp.readyState==4)
{
if(xmlHttp.status == 200)
{
document.getElementById("msg").value="";
var subdomNameEle = xmlHttp.responseXML.getElementsByTagName("DOMNAME");
var subName = subdomNameEle[0].firstChild.nodeValue;
document.getElementById("msg").innerText=subName;
}
}
}
</script>
<style>
td
{
font-family:verdana, arial, helvetica, Sans-Serif; font-size:12px
}
</style>
<script src="sorttable.js"></script>
<script>
function funReset()
{
document.getElementById("selector").value="none";
document.getElementById("newDomName").value="";
document.getElementById("uName").value="";
document.getElementById("documentRoot").value="";
document.getElementById("password").value="";
document.getElementById("passwordAgain").value="";
document.getElementById("search").value="";
}
function pwdvalid()
{
setTimeout("document.getElementById('pass').style.display='block'",600);
}
function againPwdValid()
{
setTimeout("document.getElementById('again').style.display='block'",600);
checkPwd();
}
function checkPwd()
{
if(document.getElementById("password").value!=document.getElementById("passwordAgain").value)
{
setTimeout("document.getElementById('error').style.display='block'",800);
setTimeout("document.getElementById('again').style.display='none'",800);
setTimeout("document.getElementById('errinfo').style.display='block'",800);
}
else
{
setTimeout("document.getElementById('error').style.display='none'",800);
setTimeout("document.getElementById('again').style.display='block'",800);
setTimeout("document.getElementById('errinfo').style.display='none'",800);
}
}
function msg()
{
if(document.getElementById("password").value!=document.getElementById("passwordAgain").value)
{
setTimeout("document.getElementById('error').style.display='block'",800);
setTimeout("document.getElementById('again').style.display='none'",800);
setTimeout("document.getElementById('errinfo').style.display='block'",800);
alert("Password does not match. Retype again");
}
else
{
setTimeout("document.getElementById('error').style.display='none'",800);
setTimeout("document.getElementById('again').style.display='block'",800);
setTimeout("document.getElementById('errinfo').style.display='none'",800);
}
}
</script>
<title><bean:message bundle="domains" key="whm.jsp.title"/></title>
</head>
<body onload="funReset()" >
<table width="70%" align="center">
<tr>
<td>
<font color="blue">
<html:messages bundle="domains" id="messages" message= "true">
Addon Domain <bean:write name= "messages" /> <br >
</html:messages>
</font>
<font color="red">
<html:errors bundle="domains"/>
</font>
<br></br>
<font size="3">
<img src="images/domains/subdomains.jpg" width="30" height="30"/><b><bean:message bundle="domains" key="domain.addondomain.heading"/></b>
</font>
<br></br>
<font size="2">
<bean:message bundle="domains" key="domain.addondomain.description"/><html:img src="images/domains/homeb.gif" />
<br></br><bean:message bundle="domains" key="domain.addondomain.description1"/>
<br></br>
<b><bean:message bundle="domains" key="domain.addondomain.createanaddondomain"/></b>
</font>
<html:form action="/AddonDomain.do" method="post" focus="selector">
<div style="border: 1px solid rgb(170, 170, 170); padding: 5px; background-color: rgb(235, 235, 235); width: 700;height:135">
<table>
<tr>
<td align="right">Select the Subdomain :</td>
<td >
<html:select property="selector">
<htmlption value="none">Select from the list</htmlption>
<logic:notEmpty name="listSubdomains">
<htmlptions collection="listSubdomains" property="subdomName"/>
</logic:notEmpty>
</html:select>
</td>
<td></td>
</tr>
<tr>
<td align="right">
<bean:message bundle="domains" key="domain.addondomain.newdomainname"/> :
</td>
<td>
<html:text property="newDomName" size="30" maxlength="20"/>
</td>
<td><html:errors property="newDomainName"/></td>
</tr>
<tr>
<td align="right">
<bean:message bundle="domains" key="domain.addondomain.subdomain"/> :
</td>
<td>
<html:text property="uName" size="30" maxlength="20" onblur="checkparksubdom();"/>
</td>
<td><html:errors property="uName"/></td>
</tr>
<tr>
<td align="right">
<bean:message bundle="domains" key="domain.root"/> : <img src="images/domains/homeb.gif" />
</td>
<td>
<html:text property="documentRoot" size="30" />
</td>
<td></td>
</tr>
<tr>
<td align="right">
<bean:message bundle="domains" key="domain.addondomain.password"/> :
</td>
<td>
<htmlassword property="password" size="30" maxlength="10" onkeypress="pwdvalid();"/>
</td>
<td><img src="images/domains/success.png" id="pass" style="display:none"/></td>
</tr>
<tr>
<td align="right">
<bean:message bundle="domains" key="domain.addondomain.passwordagain" /> :
</td>
<td>
<htmlassword property="passwordAgain" size="30" maxlength="10" onfocus="againPwdValid();" onkeyup="checkPwd();"/>
</td>
<td><img src="images/domains/success.png" id="again" style="display:none"/><img src="images/domains/error.png" id="error" style="display:none"/></td>
<td><font id="errinfo" style="display:none; font-size:10px;">Password does not match </font></td>
</tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr>
<td></td>
<td align="center">
<html:submit property="method" onclick="msg()">
<bean:message bundle="domains" key="domain.addondomain.adddomain"/>
</html:submit>
</td>
<td></td>
</tr>
</table>
<br></br>
</div>
<font size="2"><bean:message bundle="domains" key="domain.addondomain.hint"/></font><br></br>
<br></br>
<font size="2"><b><bean:message bundle="domains" key="domain.addondomain.modifyaddondomain"/></b></font><br></br>
<table cellSpacing="0" cellPadding="3" width="100%" border="0">
<tr>
<td align="right">
<p>
<bean:message bundle="domains" key="subdomain.search"/>
<html:text size="20" property="search"/>
<html:submit property="method">
<bean:message bundle="domains" key="domain.button.go"/>
</html:submit>
</p>
</td>
</tr>
</table>
<table width="100%" border="1" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th align="center" background="images/tbl-bg.jpg" height="1">
<bean:message bundle="domains" key="domain.addondomain.addondomains"/>
</th>
<th align="center" background="images/tbl-bg.jpg" height="1">
<bean:message bundle="domains" key="domain.root"/>
</th>
<th align="center" background="images/tbl-bg.jpg" height="1">
<bean:message bundle="domains" key="domain.addondomain.username"/>
</th>
<th align="center" background="images/tbl-bg.jpg" height="1">
<bean:message bundle="domains" key="domain.addondomain.redirectto"/>
</th>
<th align="center" background="images/tbl-bg.jpg" height="1">
<bean:message bundle="domains" key="domain.addondomain.actions"/>
</th>
</tr>
</thead>
<tbody>
<logic:notEmpty name="parkedSubdomList">
<logic:iterate id="account" name="parkedSubdomList" scope="request" >
<tr>
<td>
<bean:write name="account" property="addonDomain"/>
</td>
<td>
<bean:write name="account" property="documentRoot"/>
</td>
<td>
<bean:write name="account" property="uName"/>
</td>
<td>
<bean:write name="account" property="redirectUrl"/>
</td>
<td align="center">
<html:link href="./EditAddondomain.do" paramId="addonDomain" paramName="account" paramProperty="addonDomain">
Modify
</html:link>
</td>
</tr>
</logic:iterate>
</logic:notEmpty>
<logic:empty name="parkedSubdomList">
<tr>
<td colspan="5">
No Subdomains are configured
</td>
</tr>
</logic:empty>
</tbody>
</table>
</html:form>
<br><br><br>
<center>
<jsp:include page="/pages/Footer.jsp"></jsp:include>
</center>
</td>
</tr>
</table>
</body>
</html>
struts-config.xml
-----------------
<form-bean name="AddonDomainForm" type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="newDomName" type="java.lang.String"/>
<form-property name="uName" type="java.lang.String"/>
<form-property name="documentRoot" type="java.lang.String"/>
<form-property name="password" type="java.lang.String"/>
<form-property name="passwordAgain" type="java.lang.String"/>
<form-property name="search" type="java.lang.String"/>
<form-property name="selector" type="java.lang.String"/>
<form-property name="addonDomain" type="java.lang.String"/>
<form-property name="redirecturl" type="java.lang.String"/>
</form-bean>
<action path="/AddonDomain"
type="com.marvel.domains.actions.DomainLookupAction"
name="AddonDomainForm"
scope="session"
input="/pages/domains/AddonDomain.jsp"
parameter="method"
validate="true"
>
<forward name="success" path="/pages/domains/AddonDomain.jsp" />
</action>