File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes scriptlets in html:option Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "scriptlets in html:option" Watch "scriptlets in html:option" New topic

scriptlets in html:option

Ritu varada
Ranch Hand

Joined: Sep 08, 2004
Posts: 117
I am trying to using a constants file while using the options tag in html library. I am not able to figure out the syntax.

I am saying

<html ption value= "<%= Constants.STATUS_CD_DUP %>" >DUPLICATE</html ption>

I have imported the neccessary class but I am having trouble with the syntax. Is there a better way to do this ? Thanks.

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33102

The syntax is correct. What error message do you get?

A better way to do this would be to put the names/values in a List and access that through the Struts tags.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
When using scriptlets inside html:xxxx tags, it does make a difference which version you use. In some cases, I was unable to get them to work with Version 1.1, but version 1.2 is much better about this.

Consultant, Sima Solutions
sreenath reddy
Ranch Hand

Joined: Sep 21, 2003
Posts: 415
hi ritu

The syntax is very much fine and it works in all the versions starting from 1.0 version.let us know whats the error u r getting
Ritu varada
Ranch Hand

Joined: Sep 08, 2004
Posts: 117
I am actually getting a parser error. Let me try that once more and let you guys know. Thanks a lot for your help.
Ritu varada
Ranch Hand

Joined: Sep 08, 2004
Posts: 117
I had a closing tag missing and I thought that the syntax was wrong. But, good to know that I was right on the syntax. Thank you guys
I agree. Here's the link:
subject: scriptlets in html:option
jQuery in Action, 3rd edition