Hi! I am wondering is this Struts2 ( *2.1.6* ) fw bug, or am i just misunderstanding something :). I created action mapping witch maps to an action and passes two args to it from base url (not param part), like this:
<action name="person-*-*" class="example.Person"> <param name="cmd">{1}</param> <param name="id">{2}</param> <result>/example/abc.jsp</result> </action> Then i created action, which justs do nothing :), but print something when setter are called: public void setCmd(String cmd) { System.out.println( "set:cmd" ); this.cmd = cmd; } public String getId() { return id; } public void setId(String id) { System.out.println( "set:id" ); this.id = id; } public String getDum() { return dum; } public void setDum(String dum) { System.out.println( "set:dum" ); this.dum = dum; } Requesting URL http://localhost:8080/struts_2_test/example/person-view-2?dum=3 gives: set:cmd set:id set:cmd set:dum set:id I know that setter is just setter, but this thing really annoys me :). Any thoughts? Thanks!
<?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> <package name="example" namespace="/example" extends="struts-default"> <action name="HelloWorld" class="example.HelloWorld"> <result>/example/HelloWorld.jsp</result> </action> <action name="person-*-*" class="example.Person"> <param name="cmd">{1}</param> <param name="id">{2}</param> <result>/example/abc.jsp</result> </action> <action name="Login_*" method="{1}" class="example.Login"> <result name="input">/example/Login.jsp</result> <result type="redirectAction">Menu</result> </action> <action name="*" class="example.ExampleSupport"> <result>/example/{1}.jsp</result> </action> <!-- Add actions here --> </package> </struts>
<?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" /> <include file="example.xml"/> <package name="default" namespace="/" extends="struts-default"> <default-action-ref name="index" /> <action name="index"> <result type="redirectAction"> <param name="actionName">HelloWorld</param> <param name="namespace">/example</param> </result> </action> </package> <!-- Add packages here --> </struts>
--------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org For additional commands, e-mail: dev-h...@struts.apache.org