File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

use hidden parameters?

 
Colin Pace
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 134
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Colin Pace
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 134
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 341
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree to maintain these hidden fields in session.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic