p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Struts (http://p2p.wrox.com/forumdisplay.php?f=211)
-   -   <html:option> question (http://p2p.wrox.com/showthread.php?t=38615)

Edward King February 17th, 2006 04:02 AM

<html:option> question
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>

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?

longjava February 17th, 2006 09:35 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>

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.

vakorde May 4th, 2006 09:14 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.

All times are GMT -4. The time now is 02:23 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.