Java Tutorial - Java Script :
Understanding Error Handling with Struts
ActionForm aForm,
HttpServletRequest aRequest,
HttpServletResponse aResponse)
throws ServletException
{
RegisterForm f = (RegisterForm) aForm;
String userid = f.getUSERID();
String password = f.getPASSWD1();
return aMapping.findForward(“main”);
}
}
Upon successful processing of the form and the business model, the Action class forwards to the main view (shown in Figure 7.5), which we saw from the action mapping above is main.jsp.
<%@ taglib uri=”/WEB-INF/struts-html.tld” prefix=”html” %>
<%@ taglib uri=”/WEB-INF/struts-bean.tld” prefix=”bean” %>
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”>
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY BGCOLOR=”#FFFFFF”>
<TABLE border=”1” width=”100%” height=”100%”>
<TBODY>
<TR>
<TD></TD>
<TD></TD>
<TD></TD>
</TR>
<TR>
<TD></TD>
<TD align=”center”>
<H2>Welcome
<bean:write name=”registerForm” property=”FNAME”/>
<bean:write name=”registerForm” property=”LNAME”/>
to<BR> OLD FRIENDS INCORPORATED</H2><BR>
</TD>
<TD></TD>
</TR>
<TR>
<TD></TD>
<TD></TD>
<TD></TD>
</TR>
</TBODY>
</TABLE>
</BODY>
</HTML>
An interesting feature to note, and the hallmark of the MVC architecture, is the way we are able to pull data from our ActionForm. The bean:write taglib is used to place the users first and last name on the main screen by leveraging
the getter methods that are exposed in our ActionForm bean.
