Linux -Blue forest free software | Return to home page | Site Map | Search WWW | Contact Us |
Your current position : Homepage > Free Software > Technological exchanges >Application Programming


    

Blue Forest http://www.lslnet.com at 10:18 on June 6, 2006


Calling the problem Action类 javaBean

Package welcome;

Import org.apache.struts.action.ActionMapping;
Import org.apache.struts.action.ActionForm;
Import javax.servlet.http.HttpServletRequest;
Import javax.servlet.http.HttpServletResponse;
Import org.apache.struts.action.ActionForward;
Import org.apache.struts.action.Action;
Import welcome.Bean1;
Public class RegAction extends Action --
Int flag=1;
Public int checkuser (String users, String passd) (
Bean1 co=new Bean1 ();
Co.CheckUser (users, passd);
Return flag;
    }
Public ActionForward execute (ActionMapping actionMapping,
ActionForm actionForm.
HttpServletRequest request.
HttpServletResponse response) (
Int flag=1;
//Default Target to success
String target=new String ( "success");
RegActionForm regActionForm = (RegActionForm) actionForm;
String username= ((RegActionForm) form). GetUser ();
String passd= ((RegActionForm) form). GetPass ();
Flag=checkuser (username, passd);
//Set The target failure
If (flag==1) (
((RegActionForm) form) setUser ( "username");
((RegActionForm) form) setPass ( "passd");
Target=new String ( "failure");
        }
Else (
Request.setAttribute ( "user", user);
        }
//Forward To the appropiate View
Retrun (mapping.findForward (target));
    }
}
Compiler such a mistake "RegAction.java" : not a statement at line 30, column 11
"RegAction.java" : '; 'Expected at line 30, column 32
"RegAction.java" : not a statement at line 31, column 11
"RegAction.java" : '; 'Expected at line 31, column 32
It is how things will return to the country. Thank you, the

Calling the problem Action类 javaBean

(RegActionForm) form.setUser ( "username");
(RegActionForm) form.setPass ( "passd");

Test!

Calling the problem Action类 javaBean

Written out of the country, urged the prawn



 Privacy Policy  Copyright © 1999-2000 LSLNET.COM. All rights reserved. Blue Forest website owners. E-mail : Webmaster@lslnet.com