You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2002/07/04 00:15:56 UTC

DO NOT REPLY [Bug 10458] New: - Editing User causes JavaScript Error

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10458>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10458

Editing User causes JavaScript Error

           Summary: Editing User causes JavaScript Error
           Product: Tomcat 4
           Version: 4.1.6
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Webapps:Administration
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: andrewconrad@msn.com


Editing a User causes a JavaScript error because the script is trying to focus 
on a hidden object.

line 20 of /webapp/admin/users/user.jsp
---
<html:form method="POST" action="/users/saveUser" focus="username">
---

but username is not guaranteed to be focusable because if your editing an 
existing user, the field is hidden. (non focusable object IE5+)


This bug also occurs in role.jsp and group.jsp

two fixes:
1) remove focus attribute from  html:form element

2) update to Struts nightly build 20020624 or greater, but this will require a 
few updates to the admin package because the admin package uses a deprecated 
class, org.apache.struts.util.PropertyUtils in the class 
org.apache.webapp.admin.AttributeTag.  I included the changes below, because 
eventually these updates have to be made, even if they are not for this fix.

I don't agree with the changes to the html:form element to check for object 
existence in the browser.  It should check it on the server, and output the 
correct code accordingly, but thats their issue.


The changes to org/apache/webapp/adminAttributeTag.java should be
---- starting line 73 --
//import org.apache.struts.util.PropertyUtils; //Not avail. in Struts 1.1.b1+
import org.apache.commons.beanutils.PropertyUtils; // New Location
---- end --

then the admin build.xml needs to be updated to get access to the commons-
beanutils.jar

--- new build.xml  ---
<project name="admin" default="build-main" basedir=".">


  <!-- ===================== Initialize Property Values =================== -->

  <!-- See "build.properties.sample" in the top level directory for all     -->
  <!-- property values you must customize for successful building!!!        -->
  <property file="build.properties"/>
  <property file="../build.properties"/>
  <property file="../../build.properties"/>
  <property file="${user.home}/build.properties"/>

  <!-- Build Defaults -->
  <property name="build.compiler"  value="classic"/>
  <property name="webapps.build"   value="${basedir}/../build"/>
  <property name="webapps.dist"    value="${basedir}/../dist"/>
  <property name="webapp.name"     value="admin"/>

  <!-- Construct Admin classpath -->
  <path id="admin.classpath">
    <pathelement location="${commons-modeler.jar}"/>
    <pathelement location="${jmx.jar}"/>
    <pathelement location="${servlet.jar}"/>
    <pathelement location="${struts.jar}"/>
    <pathelement location="${commons-beanutils.jar}"/>
  </path>


  <!-- =================== BUILD: Set compile flags ======================= -->
  <target name="flags">

    <!-- JDK flags -->
    <available property="jdk.1.2.present" classname="java.util.HashMap" />
    <available property="jdk.1.3.present"
     classname="java.lang.reflect.Proxy" />
    <available property="jdk.1.4.present" classname="java.nio.Buffer" />

    <!-- Ant flags -->
    <available property="style.available"
     classname="org.apache.tools.ant.taskdefs.optional.TraXLiaison" />

    <!-- Class availability flags -->
    <condition property="jaxp.present">
      <and>
        <available classname="javax.xml.parsers.SAXParser"
         classpath="${xerces.jar}" />
        <available classname="org.xml.sax.ContentHandler"
         classpath="${xerces.jar}" />
      </and>
    </condition>
    <available property="jmx.present"
     classname="javax.management.MBeanServer"
     classpath="${jmx.jar}" />
    <available property="modeler.present"
     classname="org.apache.commons.modeler.Registry"
     classpath="${commons-modeler.jar}"/>
    <available property="servlet.present"
     classname="javax.servlet.Servlet"
     classpath="${servlet.jar}" />
    <available property="struts.present"
     classname="org.apache.struts.action.ActionForm"
     classpath="${struts.jar}" />
    <available property="beanutils.present"
    	classname="org.apache.commons.beanutils.PropertyUtils"
    	classpath="${common-beanutils.jar}" />

    <!-- JAR files availability flags -->
    <available property="jmx.jar.present"   file="${jmx.jar}" />
    <available property="modeler.jar.present" file="${commons-modeler.jar}" />
    <available property="servlet.jar.present" file="${servlet.jar}" />
    <available property="struts.jar.present"  file="${struts.jar}" />
    <available property="beanutils.jar.present" file="${commons-
beanutils.jar}" />

    <!-- Conditional compilation flags (determined from the flags above) -->
    <condition property="compile.admin">
      <or>
        <equals arg1="${full.dist}" arg2="on" />
        <and>
          <equals arg1="${struts.present}" arg2="true" />
          <equals arg1="${jmx.present}" arg2="true" />
          <equals arg1="${modeler.present}" arg2="true" />
          <available file="${struts.lib}/struts-bean.tld" />
          <available file="${struts.lib}/struts-html.tld" />
          <available file="${struts.lib}/struts-logic.tld" />
        </and>
      </or>
    </condition>

    <!-- Conditional copy flags (determined from the flags above) -->
    <condition property="copy.struts.jar">
      <or>
        <equals arg1="${full.dist}" arg2="on" />
        <equals arg1="${struts.jar.present}" arg2="true" />
      </or>
    </condition>

  </target>


  <!-- =================== BUILD: Set compile flags ======================= -->
  <target name="flags.display" depends="flags" unless="flags.hide">

    <echo message="--- Build environment for Tomcat Server Configuration 
Application ---" />

    <echo message="If ${property_name} is displayed, then the property is not 
set)" />

    <echo message="--- Build options ---" />
    <echo message="full.dist=${full.dist}" />
    <echo message="build.sysclasspath=${build.sysclasspath}" />
    <echo message="compile.debug=${compile.debug}" />
    <echo message="compile.deprecation=${compile.deprecation}" />
    <echo message="compile.optimize=${compile.optimize}" />

    <echo message="--- Ant Flags ---" />
    <echo message="&lt;style&gt; task available (required)
=${style.available}" />

    <echo message="--- JDK ---" />
    <echo message="jdk.1.2.present=${jdk.1.2.present}" />
    <echo message="jdk.1.3.present=${jdk.1.3.present}" />
    <echo message="jdk.1.4.present=${jdk.1.4.present}" />

    <echo message="--- Required Libraries ---" />
    <echo message="jaxp.present=${jaxp.present}" />
    <echo message="jmx.present=${jmx.present}" />
    <echo message="modeler.present=${modeler.present}" />
    <echo message="servlet.present=${servlet.present}" />

    <echo message="--- Required JARs ---" />
    <echo message="jmx.jar.present=${jmx.jar.present}" />
    <echo message="modeler.jar.present=${modeler.jar.present}" />
    <echo message="servlet.jar.present=${servlet.jar.present}" />
    <echo message="struts.jar.present=${struts.jar.present}" />
		<echo 
message="beanutils.jar.present=${beanutils.jar.present}" />

    <echo message="--- Optional JARs ---" />

    <echo message="--- Conditional compilation flags ---" />
    <echo message="compile.admin=${compile.admin}" />

    <echo message="--- Distribution flags ---" />
    <echo message="copy.struts.jar=${copy.struts.jar}" />

  </target>


  <!-- ======================== BUILD: Copy JARs ========================== -->
  <target name="copy-struts.jar" if="struts.present">
    <copy todir="${webapps.build}/${webapp.name}/WEB-INF/lib" 
file="${struts.jar}"/>
    <copy todir="${webapps.build}/${webapp.name}/WEB-INF" 
file="${struts.lib}/struts-bean.tld"/>
    <copy todir="${webapps.build}/${webapp.name}/WEB-INF" 
file="${struts.lib}/struts-html.tld"/>
    <copy todir="${webapps.build}/${webapp.name}/WEB-INF" 
file="${struts.lib}/struts-logic.tld"/>
  </target>


  <!-- =================== BUILD: Create Directories ====================== -->
  <target name="build-prepare">
    <mkdir dir="${webapps.build}"/>
    <mkdir dir="${webapps.build}/${webapp.name}"/>
    <mkdir dir="${webapps.build}/${webapp.name}/WEB-INF"/>
    <mkdir dir="${webapps.build}/${webapp.name}/WEB-INF/classes"/>
    <mkdir dir="${webapps.build}/${webapp.name}/WEB-INF/lib"/>
  </target>


  <!-- ================ BUILD: Copy Static Files ========================== -->
  <target name="build-static" depends="flags,flags.display,build-prepare,copy-
struts.jar">
    <copy todir="${webapps.build}/${webapp.name}">
      <fileset dir=".">
        <exclude name="build.*"/>
        <exclude name="**/*.java"/>
      </fileset>
    </copy>
    <copy tofile="${webapps.build}/${webapp.name}/WEB-
INF/classes/org/apache/webapp/admin/ApplicationResources.properties" 
file="${webapps.build}/${webapp.name}/WEB-
INF/classes/org/apache/webapp/admin/ApplicationResources_en.properties">
    </copy>
  </target>


  <!-- ================= BUILD: Compile Server Components ================= -->
  <target name="build-main" depends="build-static" if="compile.admin">

    <javac   srcdir="WEB-INF/classes"
             destdir="${webapps.build}/${webapp.name}/WEB-INF/classes"
             debug="${compile.debug}" deprecation="${compile.deprecation}"
             optimize="${compile.optimize}"
             excludes="**/CVS/**">
      <classpath refid="admin.classpath" />
    </javac>

  </target>


  <!-- ==================== BUILD: Rebuild Everything ===================== -->
  <target name="all" depends="build-clean,build-main"
   description="Clean and build admin webapp"/>


  <!-- ======================= BUILD: Clean Directory ===================== -->
  <target name="build-clean">
    <delete dir="${webapps.build}"/>
  </target>


  <!-- ======================= DIST: Create Directories =================== -->
  <target name="dist-prepare">
    <mkdir dir="${webapps.dist}"/>
  </target>


  <!-- ======================= DIST: Create Distribution Files ============ -->
  <target name="dist" depends="build-main,dist-prepare"
   description="Create admin webapp binary distribution">
      <jar   jarfile="${webapps.dist}/${webapp.name}.war"
             basedir="${webapps.build}/${webapp.name}" includes="**"/>
  </target>


  <!-- ======================= DIST: Clean Directory ====================== -->
  <target name="dist-clean">
    <deltree dir="${dist.dir}"/>
  </target>


  <!-- ====================== Convenient Synonyms ========================= -->
  <target name="clean" depends="build-clean,dist-clean"
   description="Clean build and dist directories"/>


</project>
--- end of build.xml ---

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>