Hi, If you want to keep the bean in a separate class then your action class that needs to implement two interfaces Modeldriven and Preparable. Its called model driven approach in struts 2
class MyBean { // attributes // getter and setter } class MyAction extends ActionSupport implements ModelDrive, Preparable { MyBean myBean; public Object getModel() { return myBean; } public void prepare() { myBean = new MyBean(); } } } This is beautifully explained in the book Struts 2 black book on page number 435. please find at http://books.google.co.in/books?id=-V86IiyqZ_YC&pg=PA357&lpg=PA357&dq=struts2+black+book+model+driven+and+preparable+example&source=bl&ots=riNsAvbHwX&sig=NclG8_JKyS3sKH6taJFCKgmjGvQ&hl=en&ei=MF3KTe2DN4nNrQemwLCJBQ&sa=X&oi=book_result&ct=result&resnum=1&ved=0CBgQ6AEwAA#v=onepage&q&f=false http://books.google.co.in/books?id=-V86IiyqZ_YC&pg=PA357&lpg=PA357&dq=struts2+black+book+model+driven+and+preparable+example&source=bl&ots=riNsAvbHwX&sig=NclG8_JKyS3sKH6taJFCKgmjGvQ&hl=en&ei=MF3KTe2DN4nNrQemwLCJBQ&sa=X&oi=book_result&ct=result&resnum=1&ved=0CBgQ6AEwAA#v=onepage&q&f=false arin_12 wrote: > > I am trying to develop a small struts apps. I want to write all the setter > and getter method in a separate Bean file and want to keep the controller > clean :) If we remem, struts 1.2 style. > > I dont want to use viewname.elementname style. This create a issue in the > javascript validation. As JS is not able to recognize the "." dot. > > <s:textfield id="alName" name="objAllergyView.alName"/> > <s:textfield id="alDescription" name="objAllergyView.alDescription"/> > > Thanks, > -- View this message in context: http://struts.1045723.n5.nabble.com/Separate-Java-Bean-Class-for-Getter-Setter-method-tp4385274p4386991.html Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org