can you put a breakpoint in the setter and see where is it called from? (both times)
musachy On Thu, Jul 16, 2009 at 8:08 AM, Ritvars Rundzāns<rrundz...@gmail.com> wrote: > Hi! > > I am wondering, why setters for cmd and id fields @ my Person action (see > below) is called twice. For example, when browser requests > /person-aaa-bbb?dum=ccc , this gets stdout-ed : > > example.per...@113981b 18061339 > setCmd ]aaa[ > setId ]bbb[ > setCmd ]aaa[ > setDum ]ccc[ > setId ]bbb[ > execute > > I know setter is just a setter, but this thing is really annoying me :) - > definately this kind of behaviour is undesirable. Any thoughts? > > struts.xml: > --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- > --- > > <?xml version="1.0" encoding="UTF-8" ?> > <!DOCTYPE struts PUBLIC > "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" > "http://struts.apache.org/dtds/struts-2.0.dtd"> > > <struts> > > <constant name="struts.enable.DynamicMethodInvocation" value="false" /> > <constant name="struts.devMode" value="false" /> > > <package name="default" namespace="/" extends="struts-default"> > > <action name="person-*-*" class="example.Person"> > <param name="cmd">{1}</param> > <param name="id">{2}</param> > > <result>jsp/abc.jsp</result> > </action> > > <action name="index"> > > <result type="redirectAction"> > <param name="actionName">HelloWorld</param> > <param name="namespace">/example</param> > </result> > > </action> > > </package> > > </struts> > < --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- > --- --- > > > Action: > --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- > --- > > package example; > > import com.opensymphony.xwork2.ActionSupport; > > @SuppressWarnings("serial") > public class Person extends ActionSupport { > // > private String cmd; > private String id; > private String dum; > // > > public String execute() throws Exception { > System.out.println( "execute" ); > return SUCCESS; > } > > public Person() { > System.out.println( this + " " + this.hashCode() ); > } > > // > public String getCmd() { > return cmd; > } > > public void setCmd(String cmd) { > System.out.println( "setCmd ]" + cmd + "[" ); > this.cmd = cmd; > } > > public String getId() { > return id; > } > > public void setId(String id) { > System.out.println( "setId ]" + id+ "[" ); > this.id = id; > } > > public String getDum() { > return dum; > } > > public void setDum(String dum) { > System.out.println( "setDum ]" + dum+ "[" ); > this.dum = dum; > } > > } > > < --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- > --- --- > > I uploaded war, so you can see this mystic stuff for yourself: > > With no jars (grab them from struts2-blank app), 4kb: > http://maiss.02.lv/faili/batman/s2test_nolibs.war > Working version, 4mb: http://maiss.02.lv/faili/batman/s2test.war > -- "Hey you! Would you help me to carry the stone?" Pink Floyd --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org