struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lee Clemens" <j...@leeclemens.net>
Subject RE: Strut2.1.6 Type Conversion Problem
Date Wed, 05 Aug 2009 15:15:34 GMT
Not sure if it's related, but did you try using Long for your setter, or
Object - and then see what it is an instance of?

It may be useful to post the setter, since that is what the issue is with.
Misspelled, etc?

-----Original Message-----
From: shahid@mobily [mailto:shahid.qmr@gmail.com] 
Sent: Wednesday, August 05, 2009 10:04 AM
To: user@struts.apache.org
Subject: Strut2.1.6 Type Conversion Problem


I just started on strut2, I am facing a very basic problem.
for the int field it should convert the type and only shd give error if
provided an invalid integer value such as 123abc.


I have an Action Class 

public class PolicyAction extends ActionSupport   {
private java.sql.Date passwordExpiry;
private long passwordExpiryCount;
// Getters and Setters for the above fields are defined

}

I have a JSP defines the two fields for input

<sx:datetimepicker id="passwordExpiry" name="passwordExpiry" label="Password
Expiry" displayFormat="dd-MMM-yyyy" staticDisplay=""/>
<s:textfield name="passwordExpiryCount" cssClass="textbox" maxlength="30"
label="Password Expiry Count" required=""/>
<s:submit value=" Add " cssClass="btn1" align="right" />

A Validation XML file (for the above two fileds it defines)

<field name="passwordExpiry">
		<field-validator type="required">
			<message>Password Expiry is required.</message>
		</field-validator>
		<field-validator type="date">
			<message>Date Format is "dd-MMM-yyyy"</message>
		</field-validator>
	</field>
	<field name="passwordExpiryCount">
		<field-validator type="required">
			<message>Password Expiry Count is
required.</message>
		</field-validator>
		<field-validator type="int">
			1
			10
			<message>Count must be between 1 and 10</message>
		</field-validator>
	</field>



When I submit the Form with empty values it produces the following Error on
console for the passwordExpiryCount Filed. 




ognl.MethodFailedException: Method "setPasswordExpiryCount" failed for
object com.mobily.billingmds.web.security.action.PolicyAction@6f205e
[java.lang.NoSuchMethodException:
setPasswordExpiryCount([Ljava.lang.String;)]
	at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:823)
	at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:964)
	at
ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:
75)
	at
ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:131)
	at
com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAcces
sor.java:28)
	at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1656)
	at
com.opensymphony.xwork2.ognl.accessor.CompoundRootAccessor.setProperty(Compo
undRootAccessor.java:50)
	at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1656)
	at ognl.ASTProperty.setValueBody(ASTProperty.java:101)
	at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
	at ognl.SimpleNode.setValue(SimpleNode.java:246)
	at ognl.Ognl.setValue(Ognl.java:476)
	at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:192)
	at
com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:155
)
	at
com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:143
)
	at
com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters(Para
metersInterceptor.java:273)
	at
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(Parame
tersInterceptor.java:187)
	at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(Method
FilterInterceptor.java:87)
	at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
	at
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(Parame
tersInterceptor.java:195)
	at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(Method
FilterInterceptor.java:87)
	at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
	at
com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(St
aticParametersInterceptor.java:148)
	at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
	at
org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterce
ptor.java:93)
	at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
	at
org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInt
erceptor.java:235)
	at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
	at
com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDr
ivenInterceptor.java:89)
	at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
	at
com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(S
copedModelDrivenInterceptor.java:128)
	at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
	at
org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(Prof
ilingActivationInterceptor.java:104)
	at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
	at
org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(Debu
ggingInterceptor.java:267)
	at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
	at
com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingIn
terceptor.java:126)
	at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
	at
com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareIn
terceptor.java:138)
	at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(Method
FilterInterceptor.java:87)
	at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
	at
com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nIntercepto
r.java:148)
	at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
	at
org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletCon
figInterceptor.java:164)
	at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
	at
com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasIntercep
tor.java:128)
	at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
	at
com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(Ex
ceptionMappingInterceptor.java:176)
	at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
	at
org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
	at
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:468)
	at
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.jav
a:395)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:215)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:188)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:213)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:172)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127
)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117
)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:108)
	at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
	at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875)
	at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processC
onnection(Http11BaseProtocol.java:665)
	at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.jav
a:528)
	at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWo
rkerThread.java:81)
	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:689)
	at java.lang.Thread.run(Thread.java:595)
/-- Encapsulated exception ------------\
java.lang.NoSuchMethodException: setPasswordExpiryCount([Ljava.lang.String;)
	at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:810)
	at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:964)
	at
ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:
75)
	at
ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:131)
	at
com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAcces
sor.java:28)
	at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1656)
	at
com.opensymphony.xwork2.ognl.accessor.CompoundRootAccessor.setProperty(Compo
undRootAccessor.java:50)
	at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1656)
	at ognl.ASTProperty.setValueBody(ASTProperty.java:101)
	at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
	at ognl.SimpleNode.setValue(SimpleNode.java:246)
	at ognl.Ognl.setValue(Ognl.java:476)
	at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:192)
	at
com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:155
)
	at
com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:143
)
	at
com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters(Para
metersInterceptor.java:273)
	at
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(Parame
tersInterceptor.java:187)
	at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(Method
FilterInterceptor.java:87)
	at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
	at
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(Parame
tersInterceptor.java:195)
	at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(Method
FilterInterceptor.java:87)
	at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
	at
com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(St
aticParametersInterceptor.java:148)
	at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
	at
org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterce
ptor.java:93)
	at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
	at
org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInt
erceptor.java:235)
	at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
	at
com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDr
ivenInterceptor.java:89)
	at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
	at
com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(S
copedModelDrivenInterceptor.java:128)
	at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
	at
org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(Prof
ilingActivationInterceptor.java:104)
	at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
	at
org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(Debu
ggingInterceptor.java:267)
	at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
	at
com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingIn
terceptor.java:126)
	at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
	at
com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareIn
terceptor.java:138)
	at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(Method
FilterInterceptor.java:87)
	at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
	at
com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nIntercepto
r.java:148)
	at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
	at
org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletCon
figInterceptor.java:164)
	at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
	at
com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasIntercep
tor.java:128)
	at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
	at
com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(Ex
ceptionMappingInterceptor.java:176)
	at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
	at
org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
	at
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:468)
	at
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.jav
a:395)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:215)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:188)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:213)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:172)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127
)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117
)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:108)
	at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
	at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875)
	at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processC
onnection(Http11BaseProtocol.java:665)
	at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.jav
a:528)
	at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWo
rkerThread.java:81)
	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:689)
	at java.lang.Thread.run(Thread.java:595)
\--------------------------------------/
expr: passwordExpiryCount val: [Ljava.lang.String;@1b602b9 context:
ognl.OgnlContext@a430b469
root:[com.mobily.billingmds.web.security.action.PolicyAction@6f205e,
com.opensymphony.xwork2.DefaultTextProvider@6cd0f9] value:
[Ljava.lang.String;@1b602b9

-- 
View this message in context:
http://www.nabble.com/Strut2.1.6-Type-Conversion-Problem-tp24827859p24827859
.html
Sent from the Struts - User mailing list archive at Nabble.com.


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




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


Mime
View raw message