Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs
True to the literal meaning of the word, "Struts" provides supporting building blocks and infrastructure components to build a Web-based application. It is an MVC-based (Model View Controller) open source framework developed and supported by the Apache Software Foundation. Because of its support for extensibility and plug-ins, the framework has picked up stupendous popularity among J2EE-based application developers. The framework can be extended and customized to suit a particular application need.
Though covering all the aspects of this framework and documenting the best practices may not be possible in one article, the subsequent sections discuss some of the best practices for developing with Struts.
The primary sources of information for this article are the Struts users' mailing list, the Struts developers' mailing list, and my experience with Struts-based applications.
The article discusses the following main points:
The Java Community Process (JCP) has released the Java Metadata Interface Specification, and some programmers are involved in the open source project Beehive. Both of these projects strive to reduce coding. However, the question is whether Struts has a facility that can be used for writing a generic JSP (JavaServer Pages) page for specific types of screens in an application so that a separate JSP page doesn't have to be written for each screen. For example, to reduce our coding efforts, we might want to develop a generic JSP page for all search screens in an application or for submitting batch processes or reports, where the parameters to be input vary for every report/batch.
Form beans are classes that must have getter and setter methods for every field in JSP, and the problem is how to write these methods for dynamic fields.
Possible solutions are:
field1, field2, field3, and so on, and provide their getter and setter methods in the form bean. Here, the number of fields that can appear on the
screen cannot be more than the number of variables in the form bean.
In the second approach, an increase in the number of fields in JSP requires no alteration in any component; therefore, it is the recommended best practice. The implementation details follow:
<logic:iterate name= "FormName" property="propertyName" indexId="abc" > <html:nested property='dynaProperty(<bean:write name="abc")'/> </logic:iterate>
()—in front of dynaProperty (in the JSP page as shown above), is taken as key, and either the getDynaProperty() or setDynaProperty() method from the form bean is called. These values should be stored in a HashMap against the key, which can later be retrieved in the Action class from the HashMap against the key.public class testVarForm extends ActionForm
{
private HashMap hMap = new HashMap();
public testVarForm() { }
public void setDynaProperty(String key, Object value) {
this.hMap.put(key, value);
}
public Object getDynaProperty(String key) {
return this.hMap.get(key);
}
public HashMap getHashMap() {
return this.hMap;
}
public void setHashMap(HashMap newHMap)
{
this.hMap =newHMap;
}
}
When developers use Web-based applications, they often try to break into the security. The most common habit is to view the source of HTML in the browser and somehow determine the path of JSP pages and access them. The intent is to highlight the vulnerability of JSP pages accessible without authorization. Users who lack authorization to view the source might observe the source URL while sitting with another user who is authorized to work on that specific screen. Later, this unauthorized user could log in to the application and type the URL in the browser. In some cases, such users are able to make their way through.
Archived Discussions (Read only)