• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Action calling another action for captcha

 
Ranch Hand
Posts: 53
MyEclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
MyEclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 94
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
MyEclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic