SIDE-BANNERCENTER-BANNERSIDE-BANNER * Oh God! Let there be PEACE. Make them calm, gentle, humble and stable. Make them realize their mistakes. Make them to confess, seek and pray for forgiveness. Let there be forgiveness for true hearts. Show them the right path on which they can walk. Let there be justice, satisfaction and happiness. Let them know that you are the justice and truth. Let them know that the innocent is never punished. Give them the strength, courage and wisdom to quit bad and to achieve good purpose. Let there be leaders who are followed by goodness. Make them competitive to achieve good. Remove their greed, wickedness and bad ambitions. Let them know that your love is infinite. Speak to them in simple ways so they understand. May your heart hear their pure hearts. * Never say die.Live and let live.* Accept Good if not, it Perishes.* What you Sow is what you Reap.* United we Stand divided we Fall.* Where there is a Will there is a Way.* Love is the strongest Power on earth.* When going gets Tough the Tough gets going.* For every problem created there is a perfect Solution.* When your hand starts paining you don't Cut it, Cure it.* A good purpose of life is the persistence to be constructive.* The arch of justice is wide, but it bends towards freedom and justice.* Lion king says he wants all the Power but none of the Responsibilities.* Life is a puzzle which can be solved by Hard work, Character and Discipline.* Money is like Manure, Spread it and it does good.* Pile it up in one place and it Stinks.* When a man wants to be a King he should exactly know the responsibilities of a King.* The only thing necessary for evil to triumph is for good men to do nothing - Edmund Burke.* Face is the reflection of mind.* A purpose of life is a life of purpose.* Beauty lies in the eyes of the beholder.* Necessity is the mother of all inventions. Real friends are those who help us in troubles.* Freedom and Power are lost if it’s miss utilized. Repeating mistakes will lead to sin and blunders.* Quantity is appreciated only when it has Quality.* Everyday is a new day, which brings hope with it.* Ego of superiority is the destruction of individuality.* We cannot learn to swim without going into the water.* Everything happens for good and thus leads to destiny.* Every problem has a perfect solution, we need to find them.* A good purpose of life is the persistence for constructiveness.* It’s hard to create good things where as it’s easy to break them.* Ideas are appreciated and respected only when we express them.* Mistakes do happen by humans, they are forgiven when we pray.* Freedom means giving others the right to achieve good purposes.* We have to put our efforts and leave the rest for destiny to decide.* All big things start with a first step.* First step is sometimes difficult.* Prayers come true when the purpose is good, thus pray for everyone.* Dreams come true when we have faith and pray for good things in life.* We got to have strength, courage and wisdom to achieve good things in life.* Every relationship has a meaning; we have to give them the proper meaning.* The only thing necessary for the triumph of evil is for good men to do nothing.* If wealth is lost, nothing is lost. If health is lost, something is lost. But, if character is lost, everything is lost.* “Stand up, be bold, be strong. Take the whole responsibility on your own shoulders, and know that you are the creator of your own destiny.” - Swami Vivekananda.
HOME-PAGEREALIZATIONQUOTESPUZZLESPRAYERSPERCEPTIONSMUSIC-DOWNLOADSTORIESJOKES
BOOKSBITTER-TRUTHANCIENT-SCRIPTURESBEAUTIFUL-LIFETHOUGHTSFRIENDSHIPPRAYERS-TO-WORSHIPWinning-Publications

QUANTITY is appreciated only when it has QUALITY. Recitation is the mother of Memory. Necessity is the mother of Invention. Knowledge grows when distributed. Enrichment for Information Technology. Persistence to be constructive is the key to success.

Thursday, February 14, 2008

Struts



* How STRUTS Works? (Steps Involved in the process.) (Tutor) (API Doc)
* Client request is handled by ActionServlet. (Controller) (Questions)
* Requested page (Ex: Login.jsp) is produced to client. (Intro to Struts: Ex)
* Login.jsp page contains html:form tag, to collect the client entered data. (Tag Lib Doc)
* struts-config.xml file has "action-mappings" element to specify action bean.
* struts-config.xml file has "form-beans" element to specify the form bean.
* struts-config.xml file has "plug-in" element to specify the validator bean (Ex: validator-rules.xml and validator.xml).
* The form data entered by client is populated in ActionForm.
* Server container invokes "Action" bean's execute method to return "ActionForward" object.
* Action beans "execute()" method initializes "HttpSession" object using "HttpRequest" object. Then, retrieves values from the FORM bean by creating the object. Creates "Serializable" object after retrieving the data from database. Assigns it to "setAttribute" method of session object for later retrieval.

* Steps involved in data retrieval from database, in STRUTS.
(1) Use "InitialContext" to create "Context" Ex: Context ctx = new InitialContext();
(2) Use "Context" to create DataSource Ex: DataSource ds = (DataSource) ctx.lookup(jdbc/oracleds");
(3) Use "DataSource" to create "Connection" Ex: Connection con = ds.getConnection();
(4) Use "Connection" to create "Statement" Ex: Statement stmt = con.createStatement();
(5) Use "Statement" to create "ResultSet" Ex: ResultSet rs = stmt.executeQuery(String);
(6) Use "ResultSet" to create "String" Ex: String str = rs.getString(No.#);
(7) Use "String" to create "User Object" Ex: UserObject user = user.setUserId(str);

(Note: Changes from step "4" onwards.)
Steps involved in creating "CallableStatement insted of "Statement". (for Stored Procedures)
(4) Use "Connection" to create "CallableStatement" (Ex:)
Ex: CallableStatement cstmt = con.prepareCall("{call myProc}"); // String
cstmt.registerOutParameter(1, OracleTypes.CURSOR); // this # is later passed in getObject parameter.
(5) Use "CallableStatement" to create "ResultSet"
Ex: ResultSet rs = cstmt.getObject(No.#); // # of
cstmt.registerOutParameter
(6) Use "ResultSet" to create "String" Ex: String str = rs.getString(No.#);
(7) Use "String" to create "Array List Object" Ex: ArrayList alist = alist.add(Object);

* Theory: There are two "configuration files" in struts applications.
(1) Web application deployment descriptor (web.xml) (Directory Structure)
(2) Struts configuration file (struts-config.xml) (Apache Guide)

* Web.xml: This is placed in WEB-INF directory. This is used by web container on startup to configure the runtime environment. (Example) (Apache)
Element "servlet-class" is used to specify ActionServlet, which acts as a controller.
Element "url-pattern" *.do is used to specify that url mapping with *.do will be processed by ActionServlet.
Element "init-param" is used to specify the struts-config.xml used to config runtime environment. “Initialization parameters” Ex: "init-value" "param-value" *.xml.
Element "load-on-startup" No.# directs the web container to initiate an instance of init() method of servlet. The integer value specifies the order in which the servlet is called. A negative value indicates container to load in any order.
Element "welcome-file-list" specifies the starting page for web application.
Element "tag-lib" specifies JSP tag libraries to use in JSP files, which helps the container to find descriptor tld files. Ex: struts-html.tld, struts-bean.tld, struts-logic.tld, etc. (Tag Lib Doc)

* Struts-config.xml: This is used by struts framework to configure the application. This is a default name, and can be changed in web.xml file. Its normally placed in WEB-INF directory. We can also use more than one struts-config.xml files. Ex: "param-name" struts-config.xml, struts-config2.xml etc.
Element "data-source" is used to setup data source for struts framework. It contains multiple (set-property property="_" value="_") elements. Property attribute is name of setter method. Value attribute is value passed to setter method.
Element "form-beans" is used to configure ActionForm to be used in Action class. Within this element multiple elements of "form-bean" can be configured.
Element "global-exception" is used to configure exception handling.
Element "global-forwards" is used to forward an action to a view. It contains multiple "forward" elements (this can also be in action element). If the forward name is same in both places then action level takes precedence.
Element "action-mapping" is used to map Action class to request path. It may contain multiple action elements. (ActionMapping)
Element "message-resources" is used to specify the "*.properties" file, which contains text messages. (MessageResources)

* What is Jakarta Struts Framework?
A: Jakarta Struts is open source implementation of MVC (Model-View-Controller) pattern for the development of web based applications. Jakarta Struts is robust architecture and can be used for the development of application of any size. Struts framework makes it much easier to design scalable, reliable Web applications with Java.

* What is Struts?
A: The core of the Struts framework is a flexible control layer based on standard technologies like Java Servlets, JavaBeans, ResourceBundles, and XML, as well as various Jakarta Common packages.
Struts encourages application architectures based on the Model 2 approach, a variation of the classic Model-View-Controller (MVC) design paradigm.
Struts provides its own CONTROLLER component and integrates with other technologies to provide the Model and the View.
For the MODEL, Struts can interact with standard data access technologies, like JavaBeans, JDBC and EJB, as well as most any third-party packages, like Hibernate, iBATIS, or Object Relational Bridge.
For the VIEW, Struts works well with JavaServer Pages (JSP), including JSTL and JSF, as well as Velocity Templates, XSLT, and other presentation systems. The Struts framework provides the invisible underpinnings every professional web application needs to survive. Struts helps you create an extensible development environment for your application, based on published standards and proven design patterns.

(Hibernate-Intro) - (Hibernate-Xml-Mapping) - (Hibernate-Questions) - (Struts-Plugin) - (Example)

* What is ActionServlet?
A: The class (org.apache.struts.action.ActionServlet), in the Jakarta Struts Framework plays the role of a controller. All the client requests to the server are handled by this controller.

* How you will make available any Message Resources Definitions file to the Struts Framework Environment?
A: The Message Resources Definitions file are simple "*.properties" files and these files contains the messages that can be used in the struts project. Message Resources Definitions files can be added to the struts-config.xml file through tag "message-resources".

* What is Action Class?
A: The Action Class is part of the MODEL and is a wrapper around the business logic. To use the Action, we need to Subclass and overwrite the execute() method. All the database/business processing are done in the Action Class.
execute method returns: ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response ) (Example) (Intro to Struts)
{
String pwd = form.getPassword(); /* Retrive value from ActionForm */
/* validate this pwd in database and assign "result" as "success" or "failed" */
return mapping.findForward(String result); /*
ActionForward object */
}
The return type of the execute method is ActionForward which is used by the Struts Framework (struts-config.xml) to forward the request to the VIEW file.

* What is ActionForm?
A: An ActionForm is a JavaBean that extends org.apache.struts.action.ActionForm. ActionForm maintains the session state for web application and the ActionForm object is automatically populated on the server side with data entered from the
client side VIEW form. (Example)

* What is Struts Validator Framework? (Ex: Intro to Struts)
A: Struts Framework provides the functionality to validate the form data. It can be use to validate the data on the users browser as well as on the server side. Struts Framework emits the java scripts and it can be used to validate the form data on the client browser. Server side validation of form can be accomplished by sub classing the FormBean with DynaValidatorForm class. (Dyna Ex.) (Ex:2) (Code:1) (Code:2)
The Validator framework was developed as a third-party add-on to Struts. Now the Validator framework is a part of Jakarta Commons project and it can be used with or without Struts. The Validator framework comes integrated with the Struts Framework and can be used without doing any extra settings.

* Give the Details of XML files used in Validator Framework? (Intro) (Guide)
A: The Validator Framework uses two XML configuration files validator-rules.xml and validation.xml. The validator-rules.xml defines the standard validation routines, these are reusable and used in validation.xml. to define the form specific validations. The validation.xml defines the validations applied to a form bean. Validation.xml defines mapping for client entered string data. Validator-rules.xml defines mapping for the ClassName used to process the data.

* How you will enable front-end validation based on the xml in validation.xml?
A: Specify parameter values of VIEWform in validation.xml and add the below code in the VIEW file.
"html:javascript formname='VIEWform' dynamicjavascript='true' staticjavascript='true' "
This generates the client side java script as defined in the validation.xml. [Article]

* How to get data from the velocity page in a action class? (Velocity) (Overview)
A: We can get the values in the action classes by using data.getParameter(\"variable name defined in the velocity page\");
Velocity separates Java code from the web pages. It's an alternative to JSP. It permits web page designers to reference methods defined in Java code. (What is Velocity?)


Read: Peace
Read some More good ones Here: Friendship

Here is something nice to motivate:
*[Let’s-make-it-happen.] *[Someone-Somewhere.] *[Logic-of-Good-and-Bad.] *[Only-One-I-have-got.]

*[Faith-in-Patience.] *[Ingredients-of-Super-Power.] *[Successful-Life.] *[Amazing-Constructive-Vibrations.]

* * * * * * * * * * * * *

"WE" has More Power than "I". Please leave a comment if you encounter any problems or have any suggestions.

Home Download Music Prayers Life Is Beautiful Add to Google
Life is Beautiful.
*Creating-successful-constructive-personality. *Why-God-Gave-Us-Friends? *Way-to-Paradise. *Creating-the-Beautiful-World. *Doing-the-job-of-goodness. *Life-is-Meaningful. *The-A-to-Z-for-Goodness. *Life-is-full-of-Tests. *History-Proves-That. *Love-in-different-forms. *True-to-the-heart.

No comments:

About Me

My photo
Simple guy who believes in being Competitive rather than being Ambitious. Persistence to be constructive, without frustrations, is a good purpose of life.
.

* * * * * * * * * * * * *

MeetUp Message Board:
Read: Wishes-and-Prayers. *Issue-of-Illegal-Immigration-&-Happy-Kingdom. *The-New-York-Hillary-Rodham-Clinton *Cast-God-Religion! *Barack-Obama-Meetup *Duty- Responsibility-Law-and-Order *John-Edwards-One-America *Good-Wishes-Life-is-Meaningful-&-Beautiful *Dennis-Kucinich-Meetup *Let-there-be-peace! *Bill-Richardson-for-President-2008 *Logic-of-Good-and-Bad-convert-bad-to-good *MORAL-STORY-Elephants-held-by-small-ropes.
* * * * * * * * * * * * *

Realizations.
*Realizations-In-Real-Life-Please-be-gentle-and-humble. *Manoj-D-Kargudri. *Amazing-Constructive-Vibrations. *Astrology. *Creating-Leaders. *How-ideas-are-concluded-and-decisions-are-materialized. *“Relationships-in-Life”-“Partnerships-in-Life”. *The-path-of-victory-the-path-of-life-winning-in-looseing. *An-attempt-for-definition. *Speak-with-a-heart. *These-are-contagious. *Key-to-happy-kingdom. *MIRACLES. *Better-to-create-one! *Cast-God-and-Religion! *Manoj-Kargudri. *Things-become-inevitable! *We-are-all-looking-for! *Phase-of-Life. *Destiny-Karma-and-God. *Struggle-perfection-and-Money. *Independence-and-Freedom. *Relationships-and-Happiness.
* * * * * *

Quotes.
*Love-Compassion-Tolerance-Forgiveness-Courtesy. *Manoj-D-Kargudri. *True-to-Heart-going-back-to-Basics!
* * * * * *

Puzzles-Riddles-Think.
*River-Crossing-Puzzles-Brain-Teasers. *Manoj-Kargudri. *Perpetual-Motion-Gravity-and-Kinetics. *Illusions-Paradoxes-Perpetually-ascending-staircase. *Milk-man-with-no-measureing-jar. *Amazing-Horoscope-Mind-Reader. *Find-the-hidden-images-in-these-STEREOGRAMS. *Are-they-12-or-13? *What-would-U-do? *ABCD-Four-Digit-Number. *10-Digit-Number. *4-QUESTIONS...GOOD-LUCK! *Think-Wise.
* * * * * *

Prayers.
*God-gave-us-everything-we-ever-needed. *Good-Wishes. *Manoj-Kargudri. *Love-Compassion-Tolerance-Forgiveness-Courtesy. *Interview-With-God! *He-is-the-one! *Candle-of-Hope! *Let-there-be-Peace! *Manoj-Kargudri.
* * * * * *

Perceptions.
*Issue-of-Illegal-Immigration. *To-which-religion-does-this-universe-belongs-to? *Law-and-order-helps-to-maintain-justice. *Implementing-regulations-by-justice. *Putting-our-sincere-efforts. *Religion-and-cast. *Impact-of-reservation-based-on-religion-and-cast. *Free-and-Fare-Education-system-Electoral-system.
* * * * * *

Stories.
*The-Monkey’s-Justice-for-two-cats. *The-Blind-Men-And-The-Elephant. *Manoj-Kargudri. *Two-rich-merchants-and-a-thief. *Healing-is-contagious. *Two-saints-in-a-market-place. *A-Terrible-Fight-Between-Two-Wolves. *Hen-that-laid-golden-eggs. *Healing-forgiveness-and-affection. *Elephants-held-by-small-ropes. *Story-of-Punyakoti-the-strength-of-truth. *What-is-the-reason? *Reply-Depends-on-the-Question. *Critical-mass-Experiment. *The-Brahman's-Wife-and-the-Mongoose. *The-Boy-Who-Cried-Wolf. *Difference-between-Heaven-and-Hell! *Freedom-and-Prison! *It's-in-Your-Eyes!
* * * * * *

Jokes.
*Please-listen-to-me. *The-Silent-Treatment! *Surgeon-Vs-Mechanic. *Manoj-Kargudri. *God's-doing-a-lot-better-job-lately.
* * * * * *

The-Bitter-Truth.
*Duty-Responsibility-Law-and-Order. *"Happy-Kingdom"-proudly-proclaimed-as-"Paradise". *Trying-to-learn-something-for-the-first-time. *Time-is-the-only-solution. *For-every-Action-there-is-an-Equal-and-Opposite-Reaction. *Logic-of-Good-and-Bad. *Manoj-Kargudri. *Duties-Responsibilities-verses-Luxuries-and-Pleasures. *Beggars!
* * * * * *

Life-is-Beautiful.
*Creating-successful-constructive-personality. *Why-God-Gave-Us-Friends? *Way-to-Paradise. *Creating-the-Beautiful-World. *Doing-the-job-of-goodness. *Life-is-Meaningful. *Manoj-Kargudri. *The-A-to-Z-for-Goodness. *Life-is-full-of-Tests. *History-Proves-That. *Love-in-different-forms. *True-to-the-heart.
* * * * * *

Prayers-To-Worship.
*Please-do-not-leave-me-ever. *Let’s-make-it-happen. *Faith-in-Patience. *The-only-one-I've-got. *Someone-somewhere. *How-I-Love-You. *Will-You? *Successful-Life. *Manoj-Kargudri. *Please-say-something. *Way-to-Paradise. *My-Everything.
* * * * * *

Friendship.
*Life-Still-Has-A-Meaning. *Heavenly-Garden. *GOD-SPEAK-TO-ME! *Why-God-Made-Friends? *I-asked-the-Lord! *A-Best-Friend! *Why-GOD-Gave-Us-Friends? *Portrait-of-a-Friend. *Friends-till-the-end. *Some-Assorted! *Forever-Friends. *What-is-a-friend!
* * * * * *

Winning-Publications.
*Significance-of-Nava-ratna (Nava-Graha). *Amazing-Constructive-Vibrations. *Manoj-Kargudri. *The-piercing-of-the-ears (karnavedha) . *Nature-Cure. *Steps-to-improve-work-place. *Steps-Involved-In-Relationships. *Some-of-the-aspects-which-materialize-the-relationships.
* * * * * *

Music-Download.
*Bhakti-Songs. *Manoj-Kargudri. *English-Songs. *Gazal-Bhajan-Hindi. *Hindi-Life. *Hindi-Love. *Hindi-Old-Kishore. *Hindi-Old-Mukesh. *Hindi-Old-Songs. *Hindi-Rock. *Hindi-Pops. *Instrumental. *Vocal-Ragas.
* * * * * *

Technology.
*READ: Why-JAVA *Manoj-Kargudri. *Start-Learning-JAVA *Why-Java's-Hot *Start-Using-LINUX *Java-Q-&-A *Question *Java-SE-6-Doc *Struts-Doc *Java-Tutorial-Index *Java-Certification *Tech. *Struts. *Manoj-Kargudri. *Servlet. *JSP. *EJB. *JNDI-JMS *SQL. *JDBC. *CORE-JAVA: *OOP *CLASS. *Manoj-Kargudri. *ABSTRACT *EXCEPTIONS *THREADS *UTILS *PACKAGES *JVM *CASTING *NETWORKING *RMI-XML
* * * * * *

MUSIC-DOWNLOAD.
*Hindi-Vocal-Raga. *Hindi-Remix-Rock. *Hindi-Old-Songs. *Hindi-Mukesh-Mohd-Rafi-Songs. *Hindi-LOVE-Songs. *Hindi-Remix-LIFE. *English-Rock-Songs. *Kannada-Janapada-Geete. *Kannada-Film-Songs. *Kannada-Devotional-Songs. *Instrumental-Music. *Manoj-Kargudri. *Hindi-Pop-Songs. *Hindi-Bhakti-Songs. *Hindi-Kishore-Kumar-SAD. *Hindi-Kishore-Kumar-JOY. *Hindi-R-D-Burman. *Hindi-Gazals. *English-Soft-Songs.
* * * * * *