java - getting request variable in DAO -
i have scenario unable access variable present in action class in dao. struts framework ejb , old code jsp written in java class file. reverse side code display jsp comes java , ejb class files interface. particular variable in action class obtained request variable. want use variable in dao class. can think of 2 options. set in form , use form in dao , value. wouldnt work form reinitialised in method used. 2nd set them in session or request value null in dao.
how else can done. want access variable action class in dao. please suggest. thanks!
use overloaded method
say have
public void save(string firstname, string secondname){ jdbc.save(firstname, secondname); }
but need new parameter! create same method , this
public void save(string firstname, string secondname, string userid){ //this keep backward compatibility if(userid == null){ //whatever in older method, in case simple save jdbc.save(firstname, secondname); } else { jdbc.save(firstname, secondname, userid); } } public void save(string firstname, string secondname){ save(firstname, secondname, null); }
Comments
Post a Comment