Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

html:select in Struts

 
Priya Jotwani
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

I have a JSP Page with two select boxes. When I write the Usual HTML code for the two DropDown, everything seems to be in place. But as soon as I replace <select> and <option> with <html:select> and <html ption> tags, I cannot see any dropdown kinda thing and also, the options come as normal labels in the same line.I ahve imported the requited .tld files also.
Below mentioned is my Code



Any Idea as to what could be the Reason ??



TIA,
Priya.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Priya,
Do you have them in a <html:form> instead of a <form>

For the future, there is a disable smilies checkbox below the UBB codes that you can check.
 
Priya Jotwani
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeanne,

I have them in <html:form>.

TIA,
Priya
 
John Smith
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As long as your taglib is:



and the taglibs are in your web.xml that should work, when the html page opens up view source and see what you have. It may not be being parsed properly?

While we're on this topic I have a question also, I want to know if I set the options through an action form reset can I then select which one of them if to be selected by default? So it would be blue already when the jsp is displayed.
 
Sheldon Fernandes
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just wanted to make an observation, it may not be the reason your code is not working.

The <htmlption> tags need to have a valid "value" attribute. These are currently empty in your case. The "value" will be submitted when an option is selected. It is also used to determine which option to show as selected when the page loads.

And John, the answer to your question is yes. But remember to put appropriate values in the "value" attribute. Also you have to use either <htmlption> or <htmlptions>. Using normal <option> will not work for showing an option as selected when a page loads.

Sheldon
 
Priya Jotwani
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sheldon,

I tried putting the value in the value attribute of html ption tag . But that doesn't work either. I have imported the strtuts-html.tld with the correct path . Also its has entry in my web.xml.
Can it because I have not put my ActionForm.class file in the classes folder of WEB-INF ??

TIA,
Priya
 
sreenath reddy
Ranch Hand
Posts: 415
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi priya

There is no way that this can happen check properly whether tld is included properly and remove the cache from the server andf restart ........

and one more thing just test <html:text > and if this properly renders <input type="text"> then its not the problem with tld(I hope if html:select is not working even this wont work )
 
Priya Jotwani
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I tried even the <html:text> but Nothing Works
PLEASE HELP

TIA,
Priya
 
sreenath reddy
Ranch Hand
Posts: 415
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi priya

If u can post the code of ur jsp (mainly the top part where u have included the tlds) it could give some clue

u can send that offline

sreenathn@huawei.com
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic