aspose file tools*
The moose likes Struts and the fly likes Struts <html:text ... issue. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts <html:text ... issue." Watch "Struts <html:text ... issue." New topic
Author

Struts <html:text ... issue.

Deepak Lal
Ranch Hand

Joined: Jul 01, 2008
Posts: 507

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


When The Going Gets Tougher,The Tougher gets Going
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30762
    
156

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Deepak Lal
Ranch Hand

Joined: Jul 01, 2008
Posts: 507


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

Joined: Jul 01, 2008
Posts: 507

Hi Jeanne,
Could you please help me out with snippet of code which does that.?
Deepak Lal
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30762
    
156

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

Joined: Jul 01, 2008
Posts: 507

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

Joined: Jul 01, 2008
Posts: 507

Hi,
COuld you please help me on this
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30762
    
156

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

Joined: Jul 01, 2008
Posts: 507

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts <html:text ... issue.