• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Action calling another action for captcha

 
maganti suryanarayana
Ranch Hand
Posts: 53
Java MyEclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Joe Ess
Bartender
Posts: 9312
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
maganti suryanarayana
Ranch Hand
Posts: 53
Java MyEclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 94
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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.
 
maganti suryanarayana
Ranch Hand
Posts: 53
Java MyEclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 94
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic