Some reader favorites:
EJB fundamentals and session beans
Create a scrollable virtual desktop in Swing
OSGi without the Eclipse
It's become common to equate OSGi with Eclipse or Equinox, but in fact other OSGi implementations exist. This post from JW
blogger Oleg Mikheev fills a much needed gap - walking through the process of developing a Hello World bundle with Apache Felix and the IDE of your choice.
| Memory Analysis in Eclipse |
| Enterprise AJAX - Transcend the Hype |
Page 2 of 6
A rule of thumb in naming the ActionForm objects in struts-config.xml is to end the object name with Form, thereby simplifying the maintenance of these forms in session. For example: ReservationForm, SearchUserForm, BankAccountForm, UserProfileForm, and so on.
The code below further clarifies ActionForm(s) management by illustrating a generic menu traversal action with the Action mappings:
public class MenuAction {
public ActionForward perform(ActionMapping _mapping,
ActionForm _form,
HttpServletRequest _request,
HttpServletResponse _response)
throws IOException, ServletException {
// Check end-user permissions whether allowed into the requested
// functionality
checkIfUserAllowedToProceed(_mapping, _form, _request, _response);
// Clean up the session object (this logic is in its own method)
String formName = null;
HttpSession session = _request.getSession();
Enumeration e = session.getAttributeNames();
while(e.hasMoreElements()) {
formName = (String)e.nextElement();
if (formName.endsWith("Form")){
session.removeAttribute(formName);
}
}
// Now find out which functionality the end-user wants to go to
String forwardStr = _request.getParameter("nextFunctionality");
if (forwardStr != null && forwardStr.trim().length() > 0){
return _mapping.findForward(forwardStr);
}
else {
return _mapping.findForward("index");
}
}
}
The following Action mapping is an example of how to implement an action based on a menu selection:
<!-- A generic menu action that forwards the user from one
functionality to another functionality (after checking permissions)
-->
<action path="/menuAction"
type="x.y.z.MenuAction"
input="/menu.jsp">
<forward name="create_reservation" path="/actionResv.do"/>
<forward name="index" path="/menu.jsp"/>
<forward name="add_person" path="/actionPerson.do"/>
<forward name="logout" path="/actionLogout.do"/>
</action>
The example and the mapping are self-explanatory.
Any JSP can have one to many entry points and one to many exit points, depending on the complexity of the page itself. Recognizing
these relationships is paramount to understanding and maintaining the complexity of the user interface. We have defined the
relationships between a JSP page and an Action class as:
In a 1:1 relationship, a user goes from one JSP page to another through an Action class; this facilitates tight coupling between a JSP page and an Action. The only extra overhead is one Action mapping in struts-config.xml. This single Action with only one Action mapping in struts-config.xml can be used to go from one page to another.
Referencing one JSP page directly through another is poor practice; the user's permissions that go to the target JSP page
cannot be checked (if applicable). This also leads to maintenance issues. To avoid these issues, always go from one JSP page
to another through an Action class: