• 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

Struts form problem

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

I am new to Struts 2 and I have some problems.
One very annoying problem is that the form which presents a bean is not saved.
I have followed some tutorials on the web but I cannot do this. If I specify every field as a property(getter/setter) in my action it works. But in this way I generate a lot of code when the other solutin is very handy.

In my JSP page, I have a form with the fields setted as selectedCompany.companyName etc. All work very fine when it comes to show the information from the database. But when I try to save the form nothing happens.

And in AdministrationViewAction I have a bean selectedCompany of type Company with the setter and getter associated.

My question is: are there other configurations which should be made in order to work?

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

Please check your private messages for a message regarding an important administrative matter.
 
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you post some of the tags you're using in your JSP to creat the fields and the variable declartions and thier getters and setters for these fields.
 
Liviu Mitrofan
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I think I have localized the problem.
I have a form which contains, based on an if-else condition, a list and and edit. The list contains a list of companies in a table mode. When a user selects a company(row) and press Edit button, the entire form is refreshed and the edit mode instead of list mode is showed.
All this selection is amde base on a hidden field selectedCompanyId which in its setter method sets also the selectedCompany bean which is a Company object.

All works nice untill the edit form.
I think the edit form's fields try to find an selectedCompany, they didn't find anything, the information is lost. After that the selectedCompanyId comes into place, it sets also the selectedCompany bean but the information is not collected anymore.

the code looks like:
JSP:



AdministrationCompanies action class contains



is there a possibility to get some fields from the value stack in some order?

Thank you
 
So you made a portal in time and started grabbing people. This tiny ad thinks that's rude:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic