문제

Im trying to use 2 different functions for onChange event as follows:

<html:select  property="distributionCategoryCode" tabindex="5"   onchange="<c:choose><c:when test="${model.editT == true}">enableTextboxDirect('${model.dtxtrmks}');</c:when><c:otherwise>enableTextboxDirect();</c:otherwise></c:choose>" >

But getting JSP error as follows:

Expecting quoted value, got character: = Attribute: ${model.editTaxes is not a valid attribute name Expecting quoted value, got character: t

Any inputs?

도움이 되었습니까?

해결책

You can't arbitrarily nest JSP tags like that, it's not legal JSP (or XML).

You need to set the value separately.

In this case I barely see a reason to special-case it in the rendered output, instead pass two parameters to enableTextboxDirect. I don't see a usecase for doing it any other way.

<html:select property="distributionCategoryCode"
             onchange="enableTextboxDirect(${model.editT}, '${model.dtxtrmks}')>

Even if you had to write a one-liner JS wrapper in case you cannot modify enableTextboxDirect it's still a better solution than bothering to change the entire attribute.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top