struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Raghuveer.V" <raghuve...@infotechsw.com>
Subject RE: Struts2 - OGNL - access bean property in model object
Date Tue, 22 Sep 2009 05:14:26 GMT
Hi Franciou,

I have a clarification here.
If model is initialized in prepare method, then it will be called for every
call of other Action invocation methods in action class like add ,edit
delete and save button actions.

What can be done if I want prepare method to be called only for the first
time when page loads and doesn’t to be called for other button actions
(CRUD).

Regards,
Raghu

-----Original Message-----
From: François Rouxel [mailto:rouxelec@yahoo.com] 
Sent: Monday, September 21, 2009 5:08 PM
To: Struts Users Mailing List
Subject: Re : Struts2 - OGNL - access bean property in model object

maybe the model is not on the stack...or on the stack but null

be sure your prepare() method initialize properly your bean...

fr/

 ____________________________________________
____________________________________________



----- Message d'origine ----
De : Raghuveer.V <raghuveerv@infotechsw.com>
À : user@struts.apache.org
Envoyé le : Lundi, 21 Septembre 2009, 7h02mn 25s
Objet : Struts2 - OGNL - access bean property  in model object





I have following property in model object(ScopedModelDriven).



CBookingFactorsBean cBookingFactorsBean=null;



In JSP page i get error when accessing [b]'salesAfterDiscount'[/b] property
of custom object(CBookingFactors[b]Bean[/b]) in
model(CBookingFactors[b]Model[/b]).



------------------

JSP page:



<s:textfield name="CBookingFactorsBean.salesAfterDiscount" size="13"
cssClass="Input"/>



----------------------------        



WARNING: Error setting value

ognl.OgnlException: target is null for setProperty(null,
"SalesAfterDiscount", [Ljava.lang.String;@110d68a)

        at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1651)

        at ognl.ASTProperty.setValueBody(ASTProperty.java:101)

        at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)

        at ognl.SimpleNode.setValue(SimpleNode.java:246)

        at ognl.ASTChain.setValueBody(ASTChain.java:172)

        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.ScopedModelDrivenInterceptor.intercept(S
copedModelDrivenInterceptor.java:128)

        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.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
org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletCon
figInterceptor.java:164)

        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.ng.ExecuteOperations.executeAction(ExecuteOper
ations.java:77)

        at
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilt
er(StrutsPrepareAndExecuteFilter.java:76)

        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:210)

        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:174)

        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:151)

        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)

        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:685)

        at java.lang.Thread.run(Unknown Source)


      



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


Mime
View raw message