struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ronald Andersen <ronald.a.ander...@gmail.com>
Subject Re: convention plugin struts.xml interceptors
Date Tue, 01 Nov 2016 03:00:33 GMT
Hi Lakasz

Below is the struts.xml and LoginAction (for reference). Using default for
 package name in 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 to define result path locations to project root directory -->
<constant name="struts.convention.result.path" value="/"></constant>
<package name="default" namespace="/" extends="struts-default">
        <interceptors>
            <interceptor name="myCustomInterceptor"
class="net.codejava.struts.MyCustomInterceptor" />
            <interceptor-stack name="customStack">
                <interceptor-ref name="myCustomInterceptor"/>
            </interceptor-stack>
        </interceptors>
    </package>

</struts>

package net.codejava.struts;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.validator.annotations.EmailValidator;
import
com.opensymphony.xwork2.validator.annotations.RequiredStringValidator;



public class LoginAction extends ActionSupport {
/**
*
*/
private static final long serialVersionUID = -7413249884096556212L;
private String email;
private String password;

public String execute() {
if (email != null && email.equals("admin@codejava.net")) {
return SUCCESS;
} else {
return INPUT;
}
}
@RequiredStringValidator(message = "Please enter your e-mail address.")
@EmailValidator(message = "Please enter a valid e-mail address.")
public void setEmail(String email) {
this.email = email;
}
@RequiredStringValidator(message = "Please enter your password.")
public void setPassword(String password) {
this.password = password;
}
public String getEmail() {
return email;
}
public String getPassword() {
return password;
}
}

On Mon, Oct 31, 2016 at 3:58 PM, Lukasz Lenart <lukaszlenart@apache.org>
wrote:

> 2016-10-30 18:59 GMT+01:00 ronald.a.andersen@gmail.com
> <ronald.a.andersen@gmail.com>:
> > My actions are working fine by following the convention rules - no
> struts.xml required; I need to configure a custom interceptor, so
> struts.xml is required. As soon as I add the struts.xml, the following
> exception is returned:
> >
> > Oct 30, 2016 1:54:22 PM org.apache.struts2.dispatcher.Dispatcher error
> > SEVERE: Exception occurred during processing request: No result defined
> for action net.codejava.struts.LoginAction and result success
> > No result defined for action net.codejava.struts.LoginAction and result
> success
> >
> > How can the struts.xml be configured to ignore the action or how can the
> convention plugin override the struts.xml? Do not want to add the
> LoginAction to the struts.xml
>
> Can you post content of your struts.xml? I think you have defined a
> main package and that's why such action isn't available.
>
>
> Regards
> --
> Ɓukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message