File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Help with hidden field Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Help with hidden field" Watch "Help with hidden field" New topic

Help with hidden field

rahul vasishta

Joined: Sep 22, 2009
Posts: 7
Hi all,

How to set the value of hidden field from Action class? I have JSP and Action class defined for the JSP Page. I havent defined the Form class for it.
Is it possible to set value for hidden filed and retrieve it on submit without having Form class defined for JSP Page?

Ankit Garg

Joined: Aug 03, 2008
Posts: 9465

without having Form class defined for JSP Page

This is a little confusing. In struts form classes are defined for Actions not JSP pages. There's a html:hidden tag which can be easily used for your requirement...

[After reading David's reply, I think I misunderstood the question , but I beat David by 10 seconds ]

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
David Newton

Joined: Sep 29, 2008
Posts: 12617

You can always get values directly from the request, but... I'm not so sure that I would.
I agree. Here's the link:
subject: Help with hidden field
It's not a secret anymore!