• 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

struts form beans

 
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi i am developing an application in struts using dbcp
I have mysql database.I my table i have one field of type int example user_id int.

In formbean i declaring as String



I am getting this null value for
System.out.println(" LoginActionForm.user_id===="+LoginActionForm.user_id);



Tomcat console



PLease help me
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can not access ActionForm property directly, in execute method of your Action class , first import your LoginActionForm form bean , initialize it e.g LoginActionForm loginForm = (LoginActionForm) form;
Then called corresponding getter method on it to get value e.g

System.out.println(" LoginActionForm.user_id===="+loginForm.getUser_id());

Hope you understand that.

Regards,
Mandar Velankar
 
Satyajeet Kadam
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for your solution.
but it is not in Action class it is different class that verify user login
I pasting my code below
I want it to acess in













 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems like your issues might be with your class LoginActionForm. Why do you have all the properties defined as static? That would mean that properties such as user_id would be the same across all users. Also, do you expect Struts to populate this class from a form? I would wonder if Struts would populate static properties...seems like it would. If LoginActionForm is actually a form, then it should extent ActionForm (or a class that extends ActionForm).

- Brent
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic