This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Getting an error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Getting an error" Watch "Getting an error" New topic
Author

Getting an error

Bacchi Gerem
Ranch Hand

Joined: Jan 23, 2004
Posts: 120
Hi,

while iam trying to run following code . I am getting an error.



<html:select property="endYear"name ="customerForm" >
<% Calendar = Calendar.getInstance();
int NUM_YEARS1 = 3; // show 3 years out
int year1 = calendar1.get(java.util.Calendar.YEAR);
for (int i = 0; i < NUM_YEARS1; i++) {
System.out.println("Year = "+year1); %>

<html ption value="<%=year1%>"><%=year1%></html ption>
<% year1++;
} %>


error:



cannot find symbol
symbol : method setValue(int)
location: class org.apache.struts.taglib.html.OptionTag
_jspx_th_html_option_54.setValue(year1);
^
1 error


Thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60822
    
  65

Please be sure to use UBB code tags when posting code to the forums. Unformatted code is extermely hard to read and most people will just go elsewhere. Please read this for more information.

You can go back and change your post to add code tags by clicking the .


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bacchi Gerem
Ranch Hand

Joined: Jan 23, 2004
Posts: 120
<html:select property="endYear"name ="customerForm" >
<% Calendar = Calendar.getInstance();
int NUM_YEARS1 = 3; // show 3 years out
int year1 = calendar1.get(java.util.Calendar.YEAR);
for (int i = 0; i < NUM_YEARS1; i++) { %>
<html ption value="<%=year1%>"><%=year1%></html ption>
<% year1++;
} %>
</html:select>


error:



cannot find symbol
symbol : method setValue(int)
location: class org.apache.struts.taglib.html.OptionTag
_jspx_th_html_option_54.setValue(year1);
^
1 error
Alaa Nassef
Ranch Hand

Joined: Jan 28, 2008
Posts: 460
Hello Bhaskar,

Simply, the setValue method in the option tag of the html tag library takes a string, and you are giving it an integer. I suggest that you use JSTL with EL instead of scriptlets, so that you won't face type conversion problems like this.


Visit my blog: http://jnassef.blogspot.com/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting an error
 
Similar Threads
update html:options
set html option value by bean: message key=...
Code optimization for html:option tag
how to get the default values when the jsp page is submited
html option tag error