File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes How to pass variable to Model/Business class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to pass variable to Model/Business class" Watch "How to pass variable to Model/Business class" New topic

How to pass variable to Model/Business class

D. Deepak Sharma
Ranch Hand

Joined: May 12, 2012
Posts: 31
Hello I am writing a code to validate the credentials of user that is username and user id from my data base and called chkValue(uid, uname) method

The action class code is like this:

here i am getting data from ActionForm class and want that data get authorization from chkValue() method from diff class where I can retrieve data using hibernate from the database
there are 2 main problem

  • how to pass these parameter to checkValue class
  • How to retrieve data using Hibernate and write the code for chkValue() method and return value so appropriate mapping can be called.

  • Sandy Chatterjee
    Ranch Hand

    Joined: Jun 27, 2012
    Posts: 55


    Create a package named DAO. And create a class named

    Below is the code for

    Here is the code for


    Action class will be the same Action class mentioned by you. Just add the following line to your Action class:

    Hope it's clear to you now. If you have any confusions reply back to me.

    Also I have answered your previous queries.


    Take up one idea. Make that one idea your life; dream of it; think of it; live on that idea. Let the brain, the body, muscles, nerves, every part of your body be full of that idea, and just leave every other idea alone. This is the way to success.
    I agree. Here's the link:
    subject: How to pass variable to Model/Business class
    It's not a secret anymore!