A whiteboard error occurred while accessing the struts2 action page.

Source: Internet
Author: User

A whiteboard error occurred while accessing the struts2 action page.

Therefore, you must set the stack to intercept this action,

<Bean id = "authenticationinterceptor" class = "com. COSL. util. Interceptor. authenticationinterceptor"> </bean> <! -- Permission interceptor -->

 

<? XML version = "1.0" encoding = "UTF-8"?> <! Doctype struts public "-// Apache Software Foundation // DTD struts configuration 2.1 // en" "http://struts.apache.org/dtds/struts-2.1.dtd"> <struts> <package name = "struts-my" extends = "JSON -Default "> <interceptors> <! -- Determine whether to log on and whether to have access permissions --> <interceptor name = "auth" class = "authenticationinterceptor"/> <! -- This is com. COSL. util. interceptor. authenticationinterceptor interceptor in applicationcontext. the XML file is instantiated --> <Interceptor-stack name = "mystack"> <Interceptor-ref name = "auth"> </Interceptor-ref> <Interceptor-ref name =" defaultstack "> </Interceptor-ref> </Interceptor-stack> </interceptors> <default-interceptor-ref name =" mystack "> </default-interceptor-ref> <default-action-ref name = "notfound"/> <global-Results> <result name = "nologin" type = "Redirect">/pages/developer/loginjsp </result> <result name = "nopower" type = "Redirect">/no_power.jsp </result> </Global-Results> <action name = "notfound" class = "com. COSL. util. commonaction "method =" notfound "> <result name =" success ">/not_found.jsp </result> </Action> </package> </struts>

 

<Package name = "diaocha" extends = "struts-my" namespace = "/pages/diaocha"> <action name = "diaochajsp" class = "com. COSL. action. diaochaaction "method =" diaochajsp "> <Interceptor-ref name =" defaultstack "/> <! -- After debugging for four hours, no result is returned when I directly access the action because interceptor intercepts it. --> <result name = "diaochajsp">/admin/editpasswordjsp. JSP </result> </Action> </package>

 

That is because the accessed action is intercepted by the following code, and the accessed action is accessed before login, that is, the action accessed in non-login status, intercepted by the following interceptor,

Public class authenticationinterceptor extends actinterceptor {@ override Public String intercept (actioninvocation Invocation) throws exception {// todo auto-generated method stub map = invocation. getinvocationcontext (). getsession (); If (map. get ("user ")! = NULL) {// return "nologin"; return invocation. Invoke () ;}else {// get logon User Permissions} return NULL ;}}

 

A whiteboard error occurred while accessing the struts2 action page.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.