wood burning stoves 2.0*
The moose likes Struts and the fly likes html:text and html:textarea problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html:text and html:textarea problem" Watch "html:text and html:textarea problem" New topic
Author

html:text and html:textarea problem

Minajagi Papaiah
Greenhorn

Joined: Sep 14, 2005
Posts: 1
Dear All,

I am faced with this problem

My jsp page has this form by name urgencyReason
<TD>
<html:text property="urgencyReason" onkeeypress="return textValidate(this,event,'<%alphaNumeric%>')" onchaange="return hasOnlySplCumNumChars(this)"/>
</TD>

I am calling textValidate onkeeypress, it takes 3 arguments
the last arg being the allowed set of characters for this field.

In this case alphaNumeric is my variable which has the value like
Stringg alphaNumeric="ABCDEFGH123";

the html version(view source) looks like this
<TD>
<input type="text" name="urgencyReason" value="" onkeeypress="return textValidate(this,event,'<%=alphaNumeric%>')" onchaange="return hasOnlySplCumNumChars(this)">
</TD>


Now,pls notice the content (in bold) in view source.
Ideally the contents of alphaNumeric should have come in,but the content in bold itself is being treated as the set of allowed characters.

I have no clue as to how I should be calling this.

Can you kindly point out where,how etc I am going wrong in this case.
[ September 14, 2005: Message edited by: Papaiah ]
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

OK, in the jsp alphaNumeric is in a regular scriptlet (which is also in illegal syntax)... but the html has it written in as an expression scriptlet. That is not possible. Copy/paste problem?

Anyway, if you use an expression scriptlet as a value of an attribute on a Struts tag, the entire attribute must be the expression scriptlet.

onkeeypress='<%= "return textValidate(this,event,/"" + alphaNumeric + "/")%>'

Hope this helps.

Please take a few moments to read the Javaranch naming policy. Basically your name needs to be 2 words in addition to being believable - you are already halfway there!

After reading the policy, you can change your name here. Welcome to the Ranch.


A good workman is known by his tools.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: html:text and html:textarea problem
 
Similar Threads
raw HTML in Mozilla
calling a java Script file into the Jsp
Ajax, Struts, and a few pesky event based issues
taglib c:out tag problem
Struts 1 -- Wrong data displaying in my JSP page