aspose file tools*
The moose likes Struts and the fly likes use hidden parameters? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "use hidden parameters?" Watch "use hidden parameters?" New topic
Author

use hidden parameters?

Colin Pace
Greenhorn

Joined: Sep 25, 2003
Posts: 9
in struts actionforms are used to store the data submitted from a form to the Action. If there are other data in the action form which need to be passed but are not part of the form, hidden parameters have to be used?

I have used hidden parameters, however I feel this is a bit inefficient especially when a number of data has to be passed from one JSP to another. Sometimes you also need that the data be available to JSP further steps ahead than the next link, thus more hidden parameters have to be included in other JSPs.

In normal JSP procedure a session bean would be used with the business object needed - I feel this is more efficient - however the MVC model of structs would then be useless if action forms are not used.

Any views?
Shankar Narayana
Ranch Hand

Joined: Jan 08, 2003
Posts: 134
Hi Colin,

What you can do is create a BaseActionForm class which contains all the hidden parameters of all the jsps, and the subclasses implement the individual behaviour. Your all other ActionForm classes should extend this BaseActionForm class.


"Failure is not when you fall down; its only when you fail to get up again."
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
in struts actionforms are used to store the data submitted from a form to the Action. If there are other data in the action form which need to be passed but are not part of the form, hidden parameters have to be used?


In jsp file : If hiiden field is not part of form , it's can't pass.

example : Hidden field MUST part of form, so can pass into request...



So, if you want to use hidden field , you MUST define hidden field in form.


SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
Colin Pace
Greenhorn

Joined: Sep 25, 2003
Posts: 9
I agree that by creating a base action form to group the common properties is elegant, however it doesn't solve my problem. Hidden parameters have to be used anyway - making the JSP page full of such tags, since that's the only way to pass the data through to the following JSPs.

In my opinion the concept of having a session bean with the business object used by a set of JSPs is more elegant and neat ... having said this Struts offer various other advantages but on this aspect I feels it does not help to keep your JSPs neat.
Colin Pace
Greenhorn

Joined: Sep 25, 2003
Posts: 9
In jsp file : If hiiden field is not part of form , it's can't pass.


Yes I agree, the hidden parameters must be part of the form. But that's not my concern.

The problem is that one MUST uses hidden parameters to pass data from one page to another but which is not available as form elements.

This makes it less neat than when we used to use a session bean with a business object in it.
Shankar Narayana
Ranch Hand

Joined: Jan 08, 2003
Posts: 134
I have used hidden parameters, however I feel this is a bit inefficient especially when a number of data has to be passed from one JSP to another. Sometimes you also need that the data be available to JSP further steps ahead than the next link, thus more hidden parameters have to be included in other JSPs.


When you create the BaseActionForm with the common parameters, put this ActionForm in Session and use it instead of adding more hidden parameters to other jsps. Anyway if i am not very clear with the answer, can you elaborate your question.
Surasak Leenapongpanit
Ranch Hand

Joined: May 10, 2002
Posts: 341
I agree to maintain these hidden fields in session.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: use hidden parameters?