java - A method from struts2 action class is not executing -


i'm porting webapp struts 2.0 2.3. cannot make dynamicmethodinvocation work. have action class add() method. submitting form on register!add.shtml not execute method. cannot find reason this.

here jars use:

struts2-core-2.3.16.jar xwork-core-2.3.16.jar struts2-spring-plugin-2.3.16.jar 

here's part struts.xml

<?xml version="1.0" encoding="utf-8" ?> <!doctype struts public         "-//apache software foundation//dtd struts configuration 2.3//en"         "http://struts.apache.org/dtds/struts-2.3.dtd"> <struts>     <constant name="struts.objectfactory" value="spring"/>     <constant name="struts.devmode" value="true"/>     <constant name="struts.url.includeparams" value="none" />     <constant name="struts.enable.dynamicmethodinvocation" value="true"/>     <constant name="struts.action.extension" value="shtml"/>      <package name="item" extends="struts-default" strict-method-invocation="true">         <action name="register" class="profileaction">             <!--<result>/web-inf/jsp/register.jsp</result>-->             <result name="success">/web-inf/jsp/register_success.jsp</result>             <result name="input">/web-inf/jsp/register.jsp</result>             <result name="error">/web-inf/jsp/register.jsp</result>             <allowed-methods>execute,add,save</allowed-methods>         </action> 

there simple struts-beans.xml. there no other files .properties.

anyone?

ps here's action code. don't think matters. tried put breakpoint on first line. debugger doesn't there.

public string add() {     try {         stringbuilder sb = new stringbuilder();         sb.append("<person>\n")                 .append("<fullname>").append(getlastname()).append(" ").append(getfirstname()).append("</fullname>\n")                 .append("<login>").append(getlogin()).append("</login>\n")                 .append("<email>").append(getlogin()).append("</email>\n")                 .append("<phone>").append(getphone()).append("</phone>\n")                 .append("</person>\n");         url url = new url(getcreatepersonurl());         httpurlconnection connection = (httpurlconnection) url.openconnection();         connection.setrequestmethod("post");         connection.setdooutput(true);         connection.setrequestproperty("content-type", "application/xml; charset=utf8");         outputstreamwriter wr= new outputstreamwriter(connection.getoutputstream());         wr.write(sb.tostring());         inputstream content = connection.getinputstream();         bufferedreader in = new bufferedreader(new inputstreamreader(content));          string line;         if ((line = in.readline()) != null)             if (!line.equalsignorecase("<status>ok</status>")) {                 addactionerror("Регистрация в данный момент не возможна"); // todo обработка ошибок от zayavkaapi                  return action.error;             }     } catch (ioexception e) {         addactionerror("Регистрация в данный момент не возможна"); // todo обработка ошибок от zayavkaapi          return action.error;     }      customer c = new customer();     c.setkeyword(getkeyphrase());     c.setpassword(getpassword());     c.setlogin(getlogin());     c.setemail(getemail());     contactperson cp = new contactperson();     cp.setfirstname(getfirstname());     cp.setlastname(getlastname());     cp.setmiddlename(getmiddlename());      arraylist<contactinfo> cil = new arraylist<contactinfo>();     contactinfo ci = new contactinfo();     ci.setcontactinfotypeid("address");// Адрес     ci.setcountryid(getcountry());     ci.setfield2(getcity());     cil.add(ci);      ci = new contactinfo();     ci.setcontactinfotypeid("phone");// Телефон     //string[] strings = getphone().split(" ");     ci.setfield1(getcountrycode());     ci.setfield2(getcitycode());     ci.setfield3(getphone());     ci.setfield4(getofficephone());     //if (strings.length > 3)     cil.add(ci);      ci = new contactinfo();     ci.setcontactinfotypeid("email");// e-mail     ci.setfield1(getemail());     cil.add(ci);      cp.setcontactinfolist(cil);     c.setmaincontactperson(cp);     arraylist<contactperson> cpl = new arraylist<contactperson>();     cpl.add(cp);     c.setcontactpersons(cpl);     long customerid = customermanager.createcustomer(c);     customer = customermanager.getcustomerbyid(customerid);      user user = new user(getlogin(), md5calc.md5(getpassword()) , true, true, true, true, new grantedauthority[]{new grantedauthorityimpl("role_customer")});     usernamepasswordauthenticationtoken result = new usernamepasswordauthenticationtoken(user, getlogin(), user.getauthorities());     securitycontextholder.getcontext().setauthentication(result);      return action.success; } 

posting code here suggested me adding @skipvalidation annotation add() method. , started execute. tom suggested hitting validation error not output errors section. , preveneted method being executed.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -