Jeroen Christiaens

Greenhorn
+ Follow
since Jan 27, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jeroen Christiaens

Hi everyone,

I have defined a complex validation + script in my validation-rules.xml
I declare the validation rule to be applied on a field in the form
but when I try to load the JSP page, I can see that the other checks (like required, minlength etc... are generated, although my own check is not generated. I want to do client checking on this little extra check too because if it's not possible, it's useless (for me) to do checks at the client side at all. The thing that I want to check is that a field A is (almost) equal to a field B, except the final character (which should be A in field A and B in field B). So "0123AA12345A" and "0123AA12345B" will be accepted, otherwise, alert box.

I hope someone already implemented some more complex validation rules and knows how to solve the problem.

Jeroen

-------------------- validation-rules.xml (snipped) --------------
<validator
name="vpnBoxIDsCompareEqualExceptAB" classname="com.mycompany.ui.util.validator.VPNBoxIDsCompareEqualExceptAB"
method="validateVpnBoxIDsCompareEqualExceptAB"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest"
depends="" msg="errors.vpnboxidscompareequalexceptab">
<javascript>
<![CDATA[
function validateVpnBoxIDsCompareEqualExceptAB(form) {
var field1 = form['fieldA'];
var field2 = form['fieldB'];
var pack = form['packType'];

if (pack.value != 'DoCheck') {return true;}

if (((field1.type == 'text') || (field1.type == 'textarea')) &&
((field2.type == 'text') || (field2.type == 'textarea')) &&
((field1.value.length > 0) || (field2.value.length > 0)))
{
var sub1 = null;
if (fields1.value.length > 0) {
sub1 = field1.value.substring(0, field1.value.length-1);
}

var sub2 = null;
if (field2.value.length > 0) {
sub2 = field2.value.substring(0, field2.value.length-1);
}

if (sub1 == sub2)
{
if ((field1.value == sub1+'A') && (field2.value == sub2+'B'))
{
return true;
}
}
}

alert('The permanent VPN Box ID and dial-up VPN Box ID are not the same (except A or B)');
return false;
}
]]>
</javascript>
</validator>


---------------------------- declare checks on form fields ----------------
...
<field
property="fieldA"
depends="vpnBoxIDsCompareEqualExceptAB">
<msg name="vpnBoxIDsCompareEqualExceptAB" key="order.status.mask.error.permvpnid"/>
<arg0 key="order.status.vpnbox.permanent"/>
<var>
<var-name>fieldB</var-name>
<var-value>dialupVPNBoxID</var-value>
</var>
<var>
<var-name>packType</var-name>
<var-value>summary.packType</var-name>
</var>
</field>
...
17 years ago
Hi all,
I try to do authentication in JBoss with an Oracle DB.
The web form displays and can be filled in, but he always denies the access and goes back to the login.jsp page, although the correct username/password are in the DB.
I think it has something to do with the OracleDS. I think JBoss cannot find the datasource, althoug the declaration file is in the deploy dir.
Does anyone know what to do or what I have done wrong?
Thanks a lot,
Jeroen
***************** FILE oracle-ds.xml in <jboss>/server/default/deploy *****
<?xml version="1.0" encoding="UTF-8"?>
<!-- JBoss Server Configuration for oracle -->
<datasources>
<local-tx-datasource>
<jndi-name>OracleDS</jndi-name>
<connection-url>jdbc:oracle:oci8:@myserver</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<user-name>myUsername</user-name>
<password>myPassw</password>
<!-- Checks the Oracle error codes and messages for fatal errors -->
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
<min-pool-size>5</min-pool-size>
<max-pool-size>20</max-pool-size>
</local-tx-datasource>
</datasources>
********************** login-config.xml in <jboss>/server/default/conf **********
<application-policy name="MyWebRealm">
<authentication>
<login-module code="org.jboss.security.auth.spi.DataBaseServerLoginModule" flag="required">
<module-option name="dsJndiName">java:/OracleDS</module-option>
<module-option name="principalsQuery">SELECT password FROM users WHERE loginname=?</module-option>
<module-option name="rolesQuery">SELECT role, 'Roles' FROM userroles WHERE loginname=?</module-option>
</login-module>
</authentication>
</application-policy>

*************** in my Web application: web.xml **************
<!--security-constraint>
<display-name>Security My Web Application</display-name>
<web-resource-collection>
<web-resource-name>LocalysWeb Security</web-resource-name>
<description>Restrict all access to this application</description>
<url-pattern>*.jsp</url-pattern>
<url-pattern>*.do</url-pattern>
</web-resource-collection>

<auth-constraint>
<description>Only authorise users with the following roles defined.</description>
<role-name>administrator</role-name>
</auth-constraint>

<user-data-constraint>
<description>Protection should be CONFIDENTIAL if SSL is installed (or NONE)</description>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>

<login-config>
<auth-method>FORM</auth-method>
<realm-name>MyWebRealm</realm-name>
<form-login-config>
<form-login-page>/login.jsp</form-login-page>
<form-error-page>/login.jsp</form-error-page>
</form-login-config>
</login-config>

<security-role>
<role-name>administrator</role-name>
</security-role>
18 years ago