Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java Open Source > Struts
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #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?

Reply With Quote
  #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.

Reply With Quote
  #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.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 11:54 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.