aspose file tools
The moose likes JSP and the fly likes How to dynamically evaluate a tag within a java file? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "How to dynamically evaluate a tag within a java file?" Watch "How to dynamically evaluate a tag within a java file?" New topic
Author

How to dynamically evaluate a tag within a java file?

Lu Jin
Greenhorn

Joined: Feb 22, 2003
Posts: 17
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:

if(attributeSpec.getDataType().equalsIgnoreCase("Doube"))
{
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 ]

SCJP, SCWCD, SCBCD, OCA, Next-->SCEA
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56157
    
  13

Please continue the discussion of this topic in the original post that you started.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: How to dynamically evaluate a tag within a java file?
 
Similar Threads
How to dynamically evaluate a tag within a java file
Conversion help plz!!!
Unable to locate setter methof for attribute lock in the tag class
How to Avoid Default Values for Double or Any Wrapper Class
dynamic text box value into database