This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring in Action (5th edition) and have Craig Walls on-line!
See this thread for details.
Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

How to dynamically evaluate a tag within a java file?  RSS feed

Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to develop a "propertyTable" tag, its input is the object's class name. Based on the attibutes of the class, this tag will display a table and let user to key in the attribute value for the object. That means, in the jsp file, if we write:
<prefix: propertyTable objectSchemaId="customer"/>
then the following table will be displayed:

| Customer Name(String): | Input box (text and number) |
| Is Member(Boolean): | Check box (true or false) |
| Total Amount(Double): | Input box (number only) |

In the doStartTag() method of PropertyTableTag, I will retrieve all the attributes of object "customer" based on the objectSchemaId. And based on the data type of those attributes, I will dynamically display the different types of input box to the user. For example, if the totalAmount is "Double", then a number only text box will be displayed in the table, and if the isMember attribute is "Boolean", then a check box will be displayed.

In the doStartTag() method of PropertyTableTag, I wrote:

htmlCode.append("<prefix:myInput name='xxx' dataType='Double'/>");

But instead of displaying <input type="text"...>,
<prefix:myInput name='xxx' dataType='Double'/> will be directly displayed to the client.

So,my question is, in a java file (not jsp), how to dynamically evaluate the "myInput" tag and get its plain html code? "myInput" tag can also be a nested tag.
[ May 24, 2005: Message edited by: Lu Jin ]
Posts: 67164
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please continue the discussion of this topic in the original post that you started.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!