• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to solve this

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Friends,

I developed login form in struts.

In this form i have 2 fields.

<tr class="table_row">
<td>
<bean:message key="label.login" />
</td>

<td>
<html:select property="district" styleId="dist" >
<option value="0"> --Select District--</option>
</html:select>

</td>
</tr>
<tr class="table_row">
<td>
<bean:message key="label.password" />
</td>
<td>
<html:text property="password">
</html:text>

</td>
</tr>

the Login values are dynamically loaded using ajax in district select box.



Related form bean is as LoginForm , in validate method

if(getPassword().equals(""))
{
errors.add(null,new ActionError("error.password.missing"));
//System.out.println("am h ere"+getMonth());
}

Its giving the error message properly.

But my old value in select box does not retained.

How to retain my old value in select box.


thanks
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Verify that in validate method are you getting value of district? if yes then you are resetting your form values back or your ajax code might resetting the value of district in your form.

LDR
 
Ranch Hand
Posts: 265
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Kavitha,

What scope are you setting for your action?

If it's request, Struts will create a new form bean when you're forwarded to the input page, and your values will be lost (since you only asked for them to be kept in the request).
 
kavitha vasu
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply.


Can you explain how can i populate values into select box from database while

form loading itself.


Currently am using ajax , I want to know how can i do this without using ajax


Thanks
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic