• 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 <html:text ... issue.

 
Ranch Hand
Posts: 603
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm a new bie to Struts 1.x version.
I have an issue with <html:text .... > element as shown below



I submit the form and when i retrieve in the action class. I'm getting as null.




Please help me out with this ranchers.

Thanks and Regards,
Deepak Lal
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Deepak,
Disabled fields are not submitted from the browser to the server. This means that request.getParameter() doesn't have access to the field, let alone Struts. One solution is to use JavaScript to copy the value to a hidden field which is submitted.
 
Deepak Lal
Ranch Hand
Posts: 603
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Jeanne Boyarsky wrote:

Deepak,
Disabled fields are not submitted from the browser to the server. This means that request.getParameter() doesn't have access to the field, let alone Struts. One solution is to use JavaScript to copy the value to a hidden field which is submitted.




Hi Jeanne,
Thanks for the inputs,can you help me out with the snippet of code for setting the value to hidden form field when submit is called

Please find my code below



Please need your help with this.
 
Deepak Lal
Ranch Hand
Posts: 603
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jeanne,
Could you please help me out with snippet of code which does that.?
Deepak Lal
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Deepak Lal wrote:Hi Jeanne,
Could you please help me out with snippet of code which does that.?
Deepak Lal


I could, but you'll learn more by writing it yourself. Let's start with the pieces:
1) Do you know how to create a hidden field?
2) Do you know how to create a JavaScript function?
3) Do you know how to execute a JavaScript function on submit?
4) Do you know how to access the value of a field?

Post back what you have if you get stuck and then someone can help.
 
Deepak Lal
Ranch Hand
Posts: 603
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi jeanne,
Please correct me If im wrong in the below



Please help me out with this....

Thanks and Regards,
Deepak Lal
 
Deepak Lal
Ranch Hand
Posts: 603
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
COuld you please help me on this
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Deepak,
First of all - be patient. It's best to allow up to 24 hours for a reply. Some people check the forums once a day.

Now on to your question. Remember that Struts generates HTML code. So there is nothing special about the JavaScript with respect to Struts. You just get the value of each element:
 
Deepak Lal
Ranch Hand
Posts: 603
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jeanne,
Please correct if im wrong.
As you have told earlier in reply to post


Jeanne wrote::
Disabled fields are not submitted from the browser to the server. This means that request.getParameter() doesn't have access to the field, let alone Struts. One solution is to use JavaScript to copy the value to a hidden field which is submitted.



Since you are talking about copying the actual value to a hidden field,the below which you have suggested should be reversed...Please advice on this and please let me know if my understanding is correct or wrong.


Is the below correct


Thanks and Regardds
Deepak Lal
 
30 seconds to difuse a loaf of bread ... here, use this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic