Subject: <html:option> question
Posted By: Edward King Post Date: 2/17/2006 3:02:20 AM
I want to set a default value of select,such as follows:

<html:select property="loglevel" size="1">
<html:option value="0">0</html:option>
<html:option value="1" selected>1</html:option>
<html:option value="2">2</html:option>
<html:option value="3">3</html:option>
</html:select>

But when I run it,it raise error:
org.apache.jasper.JasperException: /index.jsp(8,48) equal symbol expected

I want to know how to make a select option was selected using Struts?

Reply By: longjava Reply Date: 2/17/2006 8:35:29 AM
You need to set the value attribute of the select tag.

The following code will fix your problem:
<html:select property="loglevel" value="1" size="1">
  <html:option value="0">0</html:option>
  <html:option value="1">1</html:option>
  <html:option value="2">2</html:option>
  <html:option value="3">3</html:option>
</html:select>

Notice how I set the value attribute of the select tag to 1, this will cause the value 1 in the option is rendered as selected.

Hope this help.

Reply By: vakorde Reply Date: 5/4/2006 9:14:43 AM
I am not sure but do you need the attribute size in the element?
and more about the error i don't think this is because of that...

---------------------------
Vikrant Korde
3i Infotech, Vashi,
Mumbai, Maharashtra, India.

Go to topic 38481

Return to index page 296
Return to index page 295
Return to index page 294
Return to index page 293
Return to index page 292
Return to index page 291
Return to index page 290
Return to index page 289
Return to index page 288
Return to index page 287