Solved

Changing from html:text to html:select

Posted on 2004-09-21
3
181 Views
Last Modified: 2010-04-01
Hi!

I changed from the html:text to html:select and insert doesn’t work. When I view table, there are no record for it.
++++++++++++++++
<span class="data_heading"><bean:message key="label.flights"/>:</span>
<html:text property="flights"  styleClass="formfield" maxlength="10" size="10"/>

++++++++++++++++++
<span class="data_heading"><bean:message key="label.flights"/>:</span>
   <html:select property="flights" styleClass="formfield">
               <html:option value="">Select one</html:option>
            <html:option value="one">1</html:option>
            <html:option value="two">2</html:option>
               <html:option value="three">3</html:option>
         </html:select>&nbsp;&nbsp;&nbsp;
++++++++++++++++++
However, something like this works.
<span class="data_heading"><bean:message key="label.assistance"/>:</span>&nbsp;
      <html:select property="assistance" styleClass="formfield">
               <html:option value="">Select one</html:option>
            <html:option value="Independent">Independent</html:option>
            <html:option value="Supervision">Supervision</html:option>
               <html:option value="Contact">Contact guard</html:option>
         </html:select>

any idea?

0
Comment
Question by:dkim18
  • 2
3 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 12112497
What methods do you have for getFlights and setFlights in your form bean...

And how do they differ from getAssistance and setAssistance?

As far as I can see, your code should be ok...
0
 

Author Comment

by:dkim18
ID: 12112666
I thought it should be ok, but it doesn't work for database part...
+++++++++

      public String getFlights() {
            return flights;
      }
      /**
       * @param flights The flights to set.
       */
      public void setFlights(String flights) {
            this.flights = flights;

++++++++++++

      public String getAssistance() {
            return assistance;
      }
      /**
       * @param assistance The assistance to set.
       */
      public void setAssistance(String assistance) {
            this.assistance = assistance;
0
 
LVL 35

Accepted Solution

by:
TimYates earned 200 total points
ID: 12112743
That should work...

Are you sure the field in the database hasn't changed?  Or the database code itself?

Remember, you are now sending "one", "two" or "three", wheras you may have been expecting "1", "2", "3" before...

I'd print out the value before you add it to the database...  Then if that is null, I'd trace back through your code from database to ActionForm, printing out the value of that field as you go...you should see the point that it becomes null then, and fix the code...

Tim
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Stuck in Bootstrap WysiHtml Editor 3 43
thymeleaf natural templating vs JSP 2 162
tomcat startup error 5 132
How  can  i  resolve  HTTP Status 404 -? 8 58
Direct mail marketing is the act of mailing materials straight to prospective customers. This wide form of marketing is one of the oldest methods of communicating with a geographic based demographic. So is it useful in 2017 and beyond?
No single Antivirus application (despite claims by manufacturers) will catch or protect you from all Virus / Malware or Spyware threats. That doesn't stop you from further protecting yourself however - and this article is to show you how.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question