Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

attribute has no value

Status
Not open for further replies.

c62ip64

Technical User
Mar 23, 2006
4
US
I’m having a problem retrieving a value from an application resource using a bean tag. I don’t have a problem referencing the tag when creating the input field. I’m getting an error, ‘JspTranslate: Attribute textarea.maxchar has no value’, when I use the tag to create a textarea. The code from the JSP follows:

<TR><TD> <input name=busPurposeLen type=text value="<bean:message key="textarea.maxchar" />" size=3 maxlength=3 readonly> characters available</TD></TR>

<TR><TD><html:textarea property="businessPurpose" cols="82" rows="4"
onchange="trim(this.form.businessPurpose, this.form.busPurposeLen, <bean:message key="textarea.maxchar" />)"
onkeydown="textCounter(this.form.businessPurpose, this.form.busPurposeLen, <bean:message key="textarea.maxchar" />)"
onkeyup="textCounter(this.form.businessPurpose, this.form.busPurposeLen, <bean:message key="textarea.maxchar" />)" /><BR><BR></TD></TR>

I’m not sure why I’m getting the error using the html:textarea element.

Tom
 
It looks like you're nesting some double quotation marks which makes the textarea.maxchar look like it's outside the quotes. That would make it look as if it's an attribute instead of the value of an attribute.

try either escaping your internal quotes with a backslash or using apostrophes around the outside and double quotes on the inside.

-G
 
Thanks for your response. I've tried using apostrophes for the outside attributes and keeping the internal double quotes. I'm now getting a syntax error when the web page is loaded. The following is the new code from the JSP:

<TD><html:textarea property="businessPurpose" cols="82" rows="4"
onkeydown='textCounter(this.form.businessPurpose, this.form.busPurposeLen, <bean:message key="textarea.maxchar"/>)'
onkeyup='textCounter(this.form.businessPurpose, this.form.busPurposeLen, <bean:message key="textarea.maxchar"/>)' /><BR><BR></TD>

The line from the HTML source that is causing the syntax error is:
<TD><textarea name="businessPurpose" cols="82" rows="4" onkeydown="textCounter(this.form.businessPurpose, this.form.busPurposeLen, <bean:message key="textarea.maxchar"/>)"
onkeyup="textCounter(this.form.businessPurpose, this.form.busPurposeLen, <bean:message key="textarea.maxchar"/>)"></textarea><BR><BR></TD>

I understand the syntax error. The bean tag is being generated in the HTML instead of the value. Is there a way I can pass the value instead. I've also tried escaping the internal quotes but this causes another error.

Tom
 
It seems it doesn't recognize the bean tag... Have you included it in this JSP before using @taglib tag? I've been working for long with Struts and nowadays I still forget it some times... :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top