[jdom-interest] check if an element exists

Mike Brenner mikeb at mitre.org
Fri Jan 19 13:16:44 PST 2007


In this one particular case, you could put the following into
your tomcat/conf/Catalina/localhost/webapp.xml file

        <Realm className="org.apache.catalina.realm.JDBCRealm"
               driverName="com.mysql.jdbc.Driver"
               connectionURL="jdbc:mysql://localhost:3306/cat_wash"
               connectionName="cat_wash"
               connectionPassword="cat_wash"
               userTable="users_cat_wash"
               userNameCol="cat_wash_admin"
               userCredCol="cat_wash_password"
               userRoleTable="users_cat_wash_roles"
               roleNameCol="role"
               digest="SHA"/>

The tomcat will look up the user id and role automatically.



Ernesto Reig wrote:
> What could be the easiest way to check if a certain username exists?
> I have an xml like this:
> 
> <tomcat-users>
>    <role rolename="tomcat"/>
>    <role rolename="role1"/>
>    <role rolename="manager"/>
>    <user username="tomcat" password="tomcat" roles="tomcat"/>
>    <user username="both" password="tomcat" roles="tomcat,role1"/>
>    <user username="role1" password="tomcat" roles="role1"/>
> </tomcat-users>
> 
> When it comes to check if a certain user with a certain username exists, 
> I don know an easy way to do that. Can someone help? Thnx.




More information about the jdom-interest mailing list