0

Code:

  <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>

Error message:

Multiple markers at this line

  • Syntax error on tokens, delete these tokens
  • Syntax error on tokens, ( expected instead

Code:

var tabMessages = new Array();

Error message:

Syntax error, insert ")" to complete Expression

My JS file:

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>

var tabMessages = new Array();

tabMessages['errors.invalid']='<bean:message key="errors.invalid" arg0="{0}" arg1="{1}" arg2="{2}" arg3="{3}" arg4="{4}" />';
tabMessages['errors.maxlength']='<bean:message key="errors.maxlength" arg0="{0}" arg1="{1}" arg2="{2}" arg3="{3}" arg4="{4}" />';
tabMessages['errors.minlength']='<bean:message key="errors.minlength" arg0="{0}" arg1="{1}" arg2="{2}" arg3="{3}" arg4="{4}" />';
tabMessages['errors.range']='<bean:message key="errors.range" arg0="{0}" arg1="{1}" arg2="{2}" arg3="{3}" arg4="{4}" />';
tabMessages['errors.required']='<bean:message key="errors.required" arg0="{0}" arg1="{1}" arg2="{2}" arg3="{3}" arg4="{4}" />';
tabMessages['errors.byte']='<bean:message key="errors.byte" arg0="{0}" arg1="{1}" arg2="{2}" arg3="{3}" arg4="{4}" />';
tabMessages['errors.date']='<bean:message key="errors.date" arg0="{0}" arg1="{1}" arg2="{2}" arg3="{3}" arg4="{4}" />';
tabMessages['errors.double']='<bean:message key="errors.double" arg0="{0}" arg1="{1}" arg2="{2}" arg3="{3}" arg4="{4}" />';
tabMessages['errors.float']='<bean:message key="errors.float" arg0="{0}" arg1="{1}" arg2="{2}" arg3="{3}" arg4="{4}" />';
tabMessages['errors.integer']='<bean:message key="errors.integer" arg0="{0}" arg1="{1}" arg2="{2}" arg3="{3}" arg4="{4}" />';
tabMessages['errors.long']='<bean:message key="errors.long" arg0="{0}" arg1="{1}" arg2="{2}" arg3="{3}" arg4="{4}" />';
tabMessages['errors.short']='<bean:message key="errors.short" arg0="{0}" arg1="{1}" arg2="{2}" arg3="{3}" arg4="{4}" />';
tabMessages['errors.creditcard']='<bean:message key="errors.creditcard" arg0="{0}" arg1="{1}" arg2="{2}" arg3="{3}" arg4="{4}" />';
tabMessages['errors.email']='<bean:message key="errors.email" arg0="{0}" arg1="{1}" arg2="{2}" arg3="{3}" arg4="{4}" />';
tabMessages['errors.numeric']='<bean:message key="errors.numeric" arg0="{0}" arg1="{1}" arg2="{2}" arg3="{3}" arg4="{4}" />';
tabMessages['errors.filetype']='<bean:message key="errors.filetype" arg0="{0}" arg1="{1}" arg2="{2}" arg3="{3}" arg4="{4}" />';
tabMessages['errors.accord.nonvalide']='<bean:message key="affichagePaa.erreur.accord.nonvalide" arg0="{0}" arg1="{1}" arg2="{2}" arg3="{3}" arg4="{4}" />';
tabMessages['errors.telephone']='<bean:message key="errors.telephone" arg0="{0}" arg1="{1}" arg2="{2}" arg3="{3}" arg4="{4}" />';
tabMessages['errors.incorrectYear']='<bean:message key="error.incorrectYear" arg0="{0}" arg1="{1}" arg2="{2}" arg3="{3}" arg4="{4}" />';


tabMessages['errors.dateCumulAnnuelDepassee']='<bean:message key="declaration.saisieCARealise.validationCumulAnnuel.possibleALaBonneDate.erreur" arg0="{0}" arg1="{1}" arg2="{2}" arg3="{3}" arg4="{4}" />';
tabMessages['errors.dateCumulAnnuelEnCours']='<bean:message key="declaration.saisieCARealise.validationCumulAnnuel.dateOK.erreur" arg0="{0}" arg1="{1}" arg2="{2}" arg3="{3}" arg4="{4}" />';
tabMessages['errors.dateCumulAnnuelNonAtteinte']='<bean:message key="declaration.saisieCARealise.validationCumulAnnuel.dateDepassee.erreur" arg0="{0}" arg1="{1}" arg2="{2}" arg3="{3}" arg4="{4}" />';
tabMessages['errors.cumulAnnuelDejaValide']='<bean:message key="declaration.saisieCARealise.validationCumulAnnuel.dej�Valider.erreur" arg0="{0}" arg1="{1}" arg2="{2}" arg3="{3}" arg4="{4}" />';

tabMessages['negociation.suppression.ristourne']='<bean:message key="negociation.suppression.ristourne" arg0="{0}" arg1="{1}" arg2="{2}" arg3="{3}" arg4="{4}" />';
tabMessages['changement.champApplication.ristourne']='<bean:message key="negociation.AjoutRistourne.changement.champApplication.ristourne" arg0="{0}" arg1="{1}" arg2="{2}" arg3="{3}" arg4="{4}" />';
tabMessages['matrice.suppression.familleaSuivre']='<bean:message key="matrice.suppression.familleaSuivre" arg0="{0}" arg1="{1}" arg2="{2}" arg3="{3}" arg4="{4}" />';

tabMessages['alerte.suppression.simple']='<bean:message key="alerte.suppression.simple" arg0="{0}" arg1="{1}" arg2="{2}" arg3="{3}" arg4="{4}" />';
tabMessages['alerte.suppression.complexe']='<bean:message key="alerte.suppression.complexe" arg0="{0}" arg1="{1}" arg2="{2}" arg3="{3}" arg4="{4}" />';

tabMessages['cumul.annuel.temporaire']='<bean:message key="cumul.annuel.temporaire" arg0="{0}" arg1="{1}" arg2="{2}" arg3="{3}" arg4="{4}" />';

tabMessages['calcul.retrocession.type.retrocession.differente']='<bean:message key="calcul.retrocession.type.retrocession.differente" arg0="{0}" arg1="{1}" arg2="{2}" arg3="{3}" arg4="{4}" />';


function getMessage(key, arg0, arg1, arg2, arg3, arg4) {
    var res = tabMessages[key];
    if (arg0 != undefined) {
        res = res.replace(/\{0\}/g, arg0);
    }
    if (arg1 != undefined) {
        res = res.replace(/\{1\}/g, arg1);
    }
    if (arg2 != undefined) {
        res = res.replace(/\{2\}/g, arg2);
    }
    if (arg3 != undefined) {
        res = res.replace(/\{3\}/g, arg3);
    }
    if (arg4 != undefined) {
        res = res.replace(/\{4\}/g, arg4);
    }
    return res;
}

enter image description here

what is wrong ..?

3
  • 2
    are you mixing jsp and js? Commented Jan 27, 2016 at 19:14
  • @redflar3 yes i mixing jsp and js Commented Jan 27, 2016 at 19:27
  • 1
    Possible duplicate of Using JSP code in JavaScript Commented Jan 27, 2016 at 19:30

1 Answer 1

1

Mixing jsp and JS can and/or will produce unexepected results. One way is collecting all JSP related variables in one place and factoring out non-JSP codes into another pure/static JavaScript files.

Sign up to request clarification or add additional context in comments.

1 Comment

Could be. Could also be the way JSP's and JS mixes together. It's hard to know but it's almost common to find this kind of bug with JSP + JS together. You're code looks okay at first sight, so you might want to check other places for the culprit. The error message you got feels like you haven't done anything wrong though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.