Please commit these changes to the HEAD branch. thanks, --Manveen
Comments: ------------- 1) Front-end validation added for the server screen. Checks added: -Portnumber : * cannot be null, * must be a valid integer (cannot be random characters) * in the range 1-65535. -ShutdownText: * must be atleast characters. 2) The I18N is also in place for this. Added corresponding front end validation error messages to ApplicationResources.properties files for english and spanish. 3) Navigation tree. Modified colors of selected/unselected nodes from red/green to black Bold/black. Changed style sheet to use arial font.
Index: admin.css =================================================================== RCS file: /home/cvspublic/jakarta-tomcat-4.0/webapps/admin/admin.css,v retrieving revision 1.2 diff -u -r1.2 admin.css --- admin.css 2001/12/06 21:46:09 1.2 +++ admin.css 2001/12/11 21:23:28 @@ -2,34 +2,35 @@ color: #FFFFFF; margin: 3px 5px 5px 3px; font-size: large; - font-family: Verdana, Arial, Helvetica, Sans-Serif; + font-family: Arial, Verdana,Helvetica, Sans-Serif; } .page-title-text { color: #FFFFFF; + font-weight: bold; margin: 3px 5px 5px 3px; - font-size: large; - font-family: Verdana, Arial, Helvetica, Sans-Serif; + font-size: normal; + font-family: Arial, Verdana, Helvetica, Sans-Serif; } .table-title-text { color: #000000; font-weight: bold; margin: 3px 5px 5px 4px; - font-family: Verdana, Arial, Helvetica, Sans-Serif; + font-family: Arial, Verdana, Helvetica, Sans-Serif; } .table-header-text { color: #FFFFFF; - font-weight: bold; + font-weight: normal; margin: 3px 5px 1px 15px; - font-family: Verdana, Arial, Helvetica, Sans-Serif; + font-family: Arial, Verdana,Helvetica, Sans-Serif; } .table-label-text { color: #000000; margin: 3px 5px 3px 15px; - font-family: Verdana, Arial, Helvetica, Sans-Serif; + font-family: Arial, Verdana, Helvetica, Sans-Serif; } .table-normal-text { @@ -46,42 +47,42 @@ .front-table { background-color: #FFFFFF; - font-family: Verdana, Arial, Helvetica, Sans-Serif; + font-family: Arial, Verdana, Helvetica, Sans-Serif; } .page-title-row { background-color: #7171A5; text-align: right; - font-family: Verdana, Arial, Helvetica, Sans-Serif; + font-family: Arial, Verdana, Helvetica, Sans-Serif; } .header-row { background-color: #9999CC; text-align: center; - font-family: Verdana, Arial, Helvetica, Sans-Serif; + font-family: Arial, Verdana, Helvetica, Sans-Serif; } .sort-row { background-color: #CECEFF; text-align: center; - font-family: Verdana, Arial, Helvetica, Sans-Serif; + font-family: Arial, Verdana, Helvetica, Sans-Serif; } .line-row { background-color:#CCCCCC; - font-family: Verdana, Arial, Helvetica, Sans-Serif; + font-family: Arial, Verdana, Helvetica, Sans-Serif; } .button { background-color: #CCCCFF; - font-family: Verdana, Arial, Helvetica, Sans-Serif; + font-family: Arial, Verdana, Helvetica, Sans-Serif; } a.button-link-text:visited, a.button-link-text:link, a.button-link-text:active { color: #000000; background-color: #CCCCFF; font-weight: bold; - font-family: Verdana, Geneva, Helvetica, Arial, Sans-Serif; + font-family: Arial, Verdana, Geneva, Helvetica, Sans-Serif; text-decoration: none; } @@ -89,6 +90,6 @@ color: #000000; background-color: #CCCCFF; font-weight: bold; - font-family: Verdana, Geneva, Helvetica, Arial, Sans-Serif; + font-family: Arial, Verdana, Geneva, Helvetica, Sans-Serif; text-decoration: underline; } Index: index.jsp =================================================================== RCS file: /home/cvspublic/jakarta-tomcat-4.0/webapps/admin/index.jsp,v retrieving revision 1.7 diff -u -r1.7 index.jsp --- index.jsp 2001/12/06 23:49:19 1.7 +++ index.jsp 2001/12/11 21:23:28 @@ -13,9 +13,9 @@ <!-- Body --> -<frameset rows="100,*" border="1"> +<frameset rows="100,*" border="2"> <frame name="banner" src='<%= response.encodeURL("banner.jsp") %>' scrolling="no"> - <frameset cols="300,*" border="1"> + <frameset cols="300,*" border="2"> <frame name="tree" src='<%= response.encodeURL("setUpTree.do") %>' scrolling="auto"> <frame name="content" src='<%= response.encodeURL("blank.jsp") %>' scrolling="auto"> </frameset> Index: server.jsp =================================================================== RCS file: /home/cvspublic/jakarta-tomcat-4.0/webapps/admin/server.jsp,v retrieving revision 1.1 diff -u -r1.1 server.jsp --- server.jsp 2001/12/06 23:38:29 1.1 +++ server.jsp 2001/12/11 21:23:28 @@ -24,8 +24,9 @@ <td align="right" nowrap> <div class="page-title-text"> <html:select property="action"> - <html:options collection="actionVals" property="value" - labelProperty="label"/> + <bean:define id="actionVals" name="serverForm" property="actionVals"/> + <html:options collection="actionVals" + property="value" labelProperty="label"/> </html:select> </div> </td> @@ -80,6 +81,7 @@ <td> <div class="table-normal-text" > <html:select property="debugLvl"> + <bean:define id="debugLvlVals" name="serverForm" +property="debugLvlVals"/> <html:options collection="debugLvlVals" property="value" labelProperty="label"/> </html:select> Index: tree-control-test.css =================================================================== RCS file: /home/cvspublic/jakarta-tomcat-4.0/webapps/admin/tree-control-test.css,v retrieving revision 1.1 diff -u -r1.1 tree-control-test.css --- tree-control-test.css 2001/11/06 20:40:13 1.1 +++ tree-control-test.css 2001/12/11 21:23:28 @@ -1,18 +1,18 @@ .tree-control { - font-family: verdana, geneva, helvetica, arial, sans-serif; + font-family: arial, verdana, geneva, helvetica, sans-serif; font-size: 80%; line-height: 1.0; } .tree-control-selected { - color: red; + color: black; font-weight: bold; text-decoration: none; } .tree-control-unselected { - color: green; - font-style: italic; + color: black; + font-style: normal; font-weight: normal; text-decoration: none; } cvs server: Diffing WEB-INF cvs server: Diffing WEB-INF/classes cvs server: Diffing WEB-INF/classes/org cvs server: Diffing WEB-INF/classes/org/apache cvs server: Diffing WEB-INF/classes/org/apache/webapp cvs server: Diffing WEB-INF/classes/org/apache/webapp/admin Index: WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_en.properties =================================================================== RCS file: /home/cvspublic/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_en.properties,v retrieving revision 1.5 diff -u -r1.5 ApplicationResources_en.properties --- WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_en.properties 2001/12/06 22:57:54 1.5 +++ WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_en.properties +2001/12/11 21:23:28 @@ -26,3 +26,7 @@ server.portnumber=Port Number server.debuglevel=Debug Level server.shutdown=Shutdown +error.portNumberText.required=<li>PortNumber cannot be empty</li> +error.shutdownText.length=<li>Shutdown Text must be atleast 6 characters</li> +error.portNumber.format=<li>PortNumber not a valid integer!</li> +error.portNumber.range=<li>PortNumber seems out of range. Valid range is 1-65535. +</li> Index: WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_es.properties =================================================================== RCS file: /home/cvspublic/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_es.properties,v retrieving revision 1.6 diff -u -r1.6 ApplicationResources_es.properties --- WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_es.properties 2001/12/06 23:19:17 1.6 +++ WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_es.properties +2001/12/11 21:23:28 @@ -23,6 +23,10 @@ sample.moreText.required=<li>\u00abM\u00e1s Texto\u00bb no puede ser vac\u00edo</li> save.success=\u00a1Guardar tiene \u00e9xito! server.heading=Tomcat Servidor -server.portnumber=Número de acceso +server.portnumber=Numero de acceso server.debuglevel=Ponga a punto llano server.shutdown=Parada normal +error.portNumberText.required=<li>PortNumber no puede ser vacio.</li> +error.shutdownText.length=<li>El texto de la parada normal debe ser caracteres del +atleast 6!</li> +error.portNumber.format=<li>PortNumber no un numero entero valido! </li> +error.portNumber.range=<li>PortNumber se parece fuera de rango. El rango valido es +1-65535.</li> Index: WEB-INF/classes/org/apache/webapp/admin/ServerAction.java =================================================================== RCS file: /home/cvspublic/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ServerAction.java,v retrieving revision 1.1 diff -u -r1.1 ServerAction.java --- WEB-INF/classes/org/apache/webapp/admin/ServerAction.java 2001/12/06 22:55:57 1.1 +++ WEB-INF/classes/org/apache/webapp/admin/ServerAction.java 2001/12/11 21:23:28 @@ -83,20 +83,23 @@ import javax.management.MBeanAttributeInfo; import javax.management.MBeanOperationInfo; import javax.management.MBeanInfo; +import org.apache.struts.util.MessageResources; + /** * Implementation of <strong>Action</strong> that validates a user logon. * * @author Jazmin Jonson + * @author Manveen Kaur * @version $Revision: 1.1 $ $Date: 2001/12/06 22:55:57 $ */ public final class ServerAction extends Action { - + private static MBeanServer mBServer = null; - + // --------------------------------------------------------- Public Methods - - + + /** * Process the specified HTTP request, and create the corresponding HTTP * response (or forward to another web component that will create it). @@ -113,58 +116,75 @@ * @exception ServletException if a servlet exception occurs */ public ActionForward perform(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) - throws IOException, ServletException { + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) + throws IOException, ServletException { + + System.out.println(mapping.getInput()); try{ - + + // front end validation and checking. + // =================================================== + MessageResources messages = getResources(); + + // Validate the request parameters specified by the user + ActionErrors errors = new ActionErrors(); + + // Report any errors we have discovered back to the original form + if (!errors.empty()) { + saveErrors(request, errors); + return (new ActionForward(mapping.getInput())); + } + if(mBServer == null) { - ApplicationServlet servlet = (ApplicationServlet)getServlet(); + ApplicationServlet servlet = (ApplicationServlet)getServlet(); mBServer = servlet.getServer(); - } - Iterator serverItr = - mBServer.queryMBeans(new ObjectName(TomcatTreeBuilder.SERVER_TYPE + - TomcatTreeBuilder. WILDCARD), - null).iterator(); - + } + Iterator serverItr = + mBServer.queryMBeans(new ObjectName(TomcatTreeBuilder.SERVER_TYPE + + TomcatTreeBuilder. WILDCARD), + null).iterator(); + ObjectName serverObjName = - ((ObjectInstance)serverItr.next()).getObjectName(); - - String shutdownText = request.getParameter("shutdownText"); - String portNumberText = request.getParameter("portNumberText"); - String debugLvlText = request.getParameter("debugLvl"); - - if(shutdownText != null) { - - mBServer.setAttribute(serverObjName, - new Attribute(SetUpServerAction.SHUTDOWN_PROP_NAME, - shutdownText)); - } - - if(portNumberText != null) { - + ((ObjectInstance)serverItr.next()).getObjectName(); + + String shutdownText = request.getParameter("shutdownText"); + String portNumberText = request.getParameter("portNumberText"); + String debugLvlText = request.getParameter("debugLvl"); + + if(shutdownText != null) { + + mBServer.setAttribute(serverObjName, + new Attribute(SetUpServerAction.SHUTDOWN_PROP_NAME, + shutdownText)); + } + + if(portNumberText != null) { + Integer port = new Integer(portNumberText); - mBServer.setAttribute(serverObjName, - new Attribute(SetUpServerAction.PORT_PROP_NAME, - port)); - } - - if(debugLvlText != null) { + mBServer.setAttribute(serverObjName, + new Attribute(SetUpServerAction.PORT_PROP_NAME, + port)); + } + + if(debugLvlText != null) { Integer debugLvl = new Integer(debugLvlText); - mBServer.setAttribute(serverObjName, - new Attribute(SetUpServerAction.DEBUG_PROP_NAME, - debugLvl)); - } - + mBServer.setAttribute(serverObjName, + new Attribute(SetUpServerAction.DEBUG_PROP_NAME, + debugLvl)); + } + }catch(Throwable t){ t.printStackTrace(System.out); //forward to error page - } + } + if (servlet.getDebug() >= 1) + servlet.log(" Forwarding to success page"); // Forward back to the test page return (mapping.findForward("Save Successful")); - + } - + } Index: WEB-INF/classes/org/apache/webapp/admin/ServerForm.java =================================================================== RCS file: /home/cvspublic/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ServerForm.java,v retrieving revision 1.1 diff -u -r1.1 ServerForm.java --- WEB-INF/classes/org/apache/webapp/admin/ServerForm.java 2001/12/06 22:55:57 1.1 +++ WEB-INF/classes/org/apache/webapp/admin/ServerForm.java 2001/12/11 21:23:28 @@ -69,119 +69,154 @@ import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; +import java.util.ArrayList; /** - * Form bean for the user locale page. This form has the following fields, - * with default values in square brackets: - * <ul> - * <li><b>someText</b> - Entered text value - * <li><b>moreText</b> - Entered text value - * </ul> - * + * Form bean for the server form page. * @author Patrick Luby + * @author Manveen Kaur * @version $Revision: 1.1 $ $Date: 2001/12/06 22:55:57 $ */ public final class ServerForm extends ActionForm { - + // ----------------------------------------------------- Instance Variables - + /** * The text for the port number. */ private String action = null; - + private String portNumberText = "8080"; - + /** * The text for the debug level. */ private String debugLvl = "0"; - + /** * The text for the debug level. */ - + private String shutdownText = null; - - + + private ArrayList debugLvlVals = null; + private ArrayList actionVals = null; // ------------------------------------------------------------- Properties - + + /** - * Return the portNumberText. + * Return the debugVals. + */ + public ArrayList getDebugLvlVals() { + + return this.debugLvlVals; + + } + + /** + * Set the debugVals. + */ + public void setDebugLvlVals(ArrayList debugLvlVals) { + + this.debugLvlVals = debugLvlVals; + + } + + + /** + * Return the ActionVals. + */ + public ArrayList getActionVals() { + + return this.actionVals; + + } + + /** + * Set the portNumberText. + */ + public void setActionVals(ArrayList actionVals) { + + this.actionVals = actionVals; + + } + + /** + * Return the Action. */ public String getAction() { - + return this.action; - + } - + /** - * Set the portNumberText. + * Set the action. */ public void setAction(String action) { - - this.portNumberText = action; - + + this.action = action; + } - - + + /** * Return the portNumberText. */ public String getPortNumberText() { - + return this.portNumberText; - + } - + /** * Set the portNumberText. */ public void setPortNumberText(String portNumberText) { - + this.portNumberText = portNumberText; - + } - + /** * Return the Debug Level Text. */ public String getDebugLvl() { - + return this.debugLvl; - + } - + /** * Set the Debug Level Text. */ public void setDebugLvl(String debugLvl) { - + this.debugLvl = debugLvl; - + } - + /** * Return the Shutdown Text. */ public String getShutdownText() { - + return this.shutdownText; - + } - + /** * Set the Shut down Text. */ public void setShutdownText(String shutdownText) { - + this.shutdownText = shutdownText; - + } - + // --------------------------------------------------------- Public Methods - + /** * Reset all properties to their default values. * @@ -189,15 +224,15 @@ * @param request The servlet request we are processing */ public void reset(ActionMapping mapping, HttpServletRequest request) { - + this.portNumberText = null; this.debugLvl = "0"; - this.shutdownText = null; + this.shutdownText = null; this.action = null; - + } - - + + /** * Validate the properties that have been set from this HTTP request, * and return an <code>ActionErrors</code> object that encapsulates any @@ -209,20 +244,41 @@ * @param request The servlet request we are processing */ public ActionErrors validate(ActionMapping mapping, - HttpServletRequest request) { - - + HttpServletRequest request) { + ActionErrors errors = new ActionErrors(); - - /* Do nothing for now - if ((someText == null) || (someText.length() < 1)) - errors.add("someText", new ActionError("sample.someText.required")); - if ((moreText == null) || (moreText.length() < 1)) - errors.add("moreText", new ActionError("sample.moreText.required")); - */ - + + String submit = request.getParameter("submit"); + if (submit != null) { + + // check for portNumber -- must not be blank, must be in + // the range 1 to 65535. + + if ((portNumberText == null) || (portNumberText.length() < 1)) { + errors.add("portNumberText", + new ActionError("error.portNumberText.required")); + } else { + try { + int port = Integer.parseInt(portNumberText); + if ((port <= 0) || (port >65535 )) + errors.add("portNumberText", + new ActionError("error.portNumber.range")); + } catch (NumberFormatException e) { + errors.add("portNumberText", + new ActionError("error.portNumber.format")); + } + } + + // shutdown text can be any non-empty string of atleast 6 characters. + + if ((shutdownText == null) || (shutdownText.length() < 7)) + errors.add("shutdownText", + new ActionError("error.shutdownText.length")); + + } + return errors; - + } - + } Index: WEB-INF/classes/org/apache/webapp/admin/SetUpServerAction.java =================================================================== RCS file: /home/cvspublic/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/SetUpServerAction.java,v retrieving revision 1.1 diff -u -r1.1 SetUpServerAction.java --- WEB-INF/classes/org/apache/webapp/admin/SetUpServerAction.java 2001/12/06 22:55:57 1.1 +++ WEB-INF/classes/org/apache/webapp/admin/SetUpServerAction.java 2001/12/11 +21:23:28 @@ -226,7 +226,9 @@ // Hardcode debuglvl for now serverFm.setDebugLvl(debug.toString()); serverFm.setShutdownText(shutdown); - + serverFm.setActionVals(actionList); + serverFm.setDebugLvlVals(debugLvlList); + // Forward back to the test page return (mapping.findForward("Server"));
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>