This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
My app has a few pages that don't require a login. But I want to show the login options on each of those pages.
If I had a form that contained fields for logging in a user, and I want to include that on any page when the user is not logged in, how would I go about defining the input parameters in the struts-config.xml file because after I have included that loginblock.jsp on welcome.jsp, the input would be "welcome.jsp" however, if I included it on bla.jsp wouldn't the input parameter change?
One possible solution: Make it so the loginblock is not its own form but a part of each page's form. I assume this jsp(f) is a static include.
You would then need a parent to the ActionForms to handle the new fields and a parent class to the Actions to hold a method that does the login functionality. The only other thing needed is a check in each Action to see which button was clicked - if it was the Login button then call the parent Action's method.
The best solution for your problem is "using tiles". Create a page with the login form and include in whatever pages you needed. So on clicking the login button will call the login action. Hope this will solve your problem.