wood burning stoves 2.0*
The moose likes Struts and the fly likes Action calling another action for captcha Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Action calling another action for captcha" Watch "Action calling another action for captcha" New topic
Author

Action calling another action for captcha

maganti suryanarayana
Ranch Hand

Joined: Mar 30, 2010
Posts: 53

hi ,

I have a problem with action calling another action in struts2. I have written code for registration form and in the registration.jsp i used s:form action="register.jsp"

In that jsp there are three fields, name, password , email and i have implemented captcha in another action class. I am not understanding how to call this captchaAction.java in registerAction.java

thanks

surya


surya
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8836
    
    7

maganti suryanarayana wrote:hi ,
registration.jsp i used s:form action="register.jsp"


First off, the action attribute of the form tag should be an action name, not a JSP page.
Next, I have no idea how you are trying to call your captcha action. Can you show us some code?


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
maganti suryanarayana
Ranch Hand

Joined: Mar 30, 2010
Posts: 53

Joe Ess wrote:
maganti suryanarayana wrote:hi ,
registration.jsp i used s:form action="register.jsp"


First off, the action attribute of the form tag should be an action name, not a JSP page.
Next, I have no idea how you are trying to call your captcha action. Can you show us some code?

Joe Ess wrote:
maganti suryanarayana wrote:hi ,
registration.jsp i used s:form action="register.jsp"


First off, the action attribute of the form tag should be an action name, not a JSP page.
Next, I have no idea how you are trying to call your captcha action. Can you show us some code?


struts.xml


Customer.jsp

CustomerAction.java


CaptchaAction.java


web.xml



CaptchaImage.java


the problem is that before i call customerBO.register(customer), i need to call the action for captcha.

thanks

surya
Yogesh Lonkar
Ranch Hand

Joined: Jul 17, 2012
Posts: 94



I don't know how important it is for you to keep Captcha verification in separate Action class, but from my point of view you can just use above verification code in your register() method as "error" result is same for "registerCustomer" as well as "doCaptcha" action. only thing is that you have to work on "success" result.


Learning some thing New Every Day
maganti suryanarayana
Ranch Hand

Joined: Mar 30, 2010
Posts: 53

Yogesh Lonkar wrote:


I don't know how important it is for you to keep Captcha verification in separate Action class, but from my point of view you can just use above verification code in your register() method as "error" result is same for "registerCustomer" as well as "doCaptcha" action. only thing is that you have to work on "success" result.


Hi, i am writing it in different action so that i can use the same code for email verification, mobile verification etc etc. So i want to make it generic.

thanks

surya
Yogesh Lonkar
Ranch Hand

Joined: Jul 17, 2012
Posts: 94

maganti suryanarayana wrote:
Hi, i am writing it in different action so that i can use the same code for email verification, mobile verification etc etc. So i want to make it generic.
surya

In that case you can create some Util Class with static method for validation where you can pass request object as argument(considering parameters to be validated remain same) and get boolean result upon which you can decide which message to fetch to user
 
wood burning stoves
 
subject: Action calling another action for captcha
 
Similar Threads
Tech Word Game
captcha, using simple servlet and struts mapping
Can't get ImageIcon to show up from captcha
about register function
JCaptcha and Struts problem