Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java Open Source > Struts
| Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Struts section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old February 17th, 2006, 04:02 AM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 62
Thanks: 0
Thanked 0 Times in 0 Posts
Default <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>
</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?

  #2 (permalink)  
Old February 17th, 2006, 09:35 AM
Authorized User
 
Join Date: Jan 2006
Location: , , USA.
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to longjava
Default

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.

  #3 (permalink)  
Old May 4th, 2006, 09:14 AM
Authorized User
 
Join Date: Apr 2006
Location: NaviMumbai, Maharashtra, India.
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to vakorde
Default

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.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove <select a value> option roy_mm Reporting Services 0 February 25th, 2007 02:26 AM
<style> tags in a <body> vs. <div> bcat BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 1 March 27th, 2005 08:50 AM
rephrased question - for variable inside HTML <td> crmpicco Classic ASP Basics 1 February 11th, 2005 04:03 AM
HELP: XSL -> HTML <select selected=true> jedbartlett XSLT 4 October 7th, 2004 11:16 PM
Dynamic HTML <<Events>> babloo81 Javascript 2 December 29th, 2003 12:40 PM





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