Dynamic Form help

2003-08-14 Thread David Erickson
I'm developing some administrative functions for our web app, currently im
working on a page where it will list all the permissions available with a
checkbox by each, and the ones the current user has will be checked.

I'm trying to decide the best way to go about it, becaues the permissions
are pulled from a database and so they could change everytime the page is
loaded, and obviously every user will have different permissions which need
to be checked.

It shouldnt be a problem to iterate through a list of permissions, but the
question I have is when I go to submit a the form to modify the users
permissions, the names of each checkbox (permission) will change, so how
would I develop a form to handle that?  And is there an easy way to populate
all the checkboxes when the page loads?

I'm using JSP's to handle it.. would love to use struts html:XXX tags if
possible.

Reccomendations welcome =)
Thanks


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Dynamic Form help

2003-08-14 Thread David Erickson
I guess conceptually I'm just not understanding how this can work.
For presentation what I would ideally like is:

[X]Permission NamePermission Description
[   ]Permission NamePermission Description

Where each permission name is unique, the checkbox could be turned on or off
depending on a variable linked to the permission name, and also a permission
description.

So on the display page there would need to be some kind of iterator that
iterates through the list of permissions, creating a checkbox with the
parameter being the permission name and its value being on or off, the
permissions name in a text field, and also a permission description text
field.

I have classes built that represent a permission and a user, and classes
extending vector that hold a list of users and permissions.  The user class
can retrieve a list of the permissions it has.  The permissions class can
goto the database and make a vector containing permission elements to
represent all the permissions that are capable on the server.

Anyway I guess I am having a really hard time designing the form in such a
way that something can be iterateable in it, probably the permission name,
but also be able to get/store the permission name, description, and if the
user has it or not.

Sorry if im not more clear... been sitting here for around 3 hours trying to
figure out how to even start attacking this and ive read a lot but am
drawing a blank.

Thanks a ton in advance..
-David


- Original Message - 
From: Mark Lowe [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Wednesday, August 13, 2003 12:54 PM
Subject: Re: Dynamic Form help


 You use indexed property.

 html:text property=permission indexed=true /

 This stuff i quite well documented, what isn't well documented is how
 to dynamically change the length of an indexed property. I've been
 using ArrayList for this..

 form-property name=permission type=java.util.ArrayList /

 You'll need to scope you form to session, as you get null pointers all
 over the show.

 ArrayList myList = new ArrayList();

 while(myObject.hasMoreStuff()) {
 myList.add(myObject.next())'
 }

 theForm.set(permission, myList);

 //also put the arraylist in an available context.

 request.setAttribute(permissions, myList.toArray());

 //jsp

 logic:iterate id=perm name=permissions
 html:text name=perm property=deleteUser indexed=true /
 /logic:iterate

 I'm still working on how to store the properties in the form when the
 size of the form property is changed. But I think this approach with
 solve what you're doing.

 Cheers Mark

 On Wednesday, August 13, 2003, at 07:22 PM, David Erickson wrote:

  I'm developing some administrative functions for our web app,
  currently im
  working on a page where it will list all the permissions available
  with a
  checkbox by each, and the ones the current user has will be checked.
 
  I'm trying to decide the best way to go about it, becaues the
  permissions
  are pulled from a database and so they could change everytime the page
  is
  loaded, and obviously every user will have different permissions which
  need
  to be checked.
 
  It shouldnt be a problem to iterate through a list of permissions, but
  the
  question I have is when I go to submit a the form to modify the users
  permissions, the names of each checkbox (permission) will change, so
  how
  would I develop a form to handle that?  And is there an easy way to
  populate
  all the checkboxes when the page loads?
 
  I'm using JSP's to handle it.. would love to use struts html:XXX
  tags if
  possible.
 
  Reccomendations welcome =)
  Thanks
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Dynamic Form help

2003-08-14 Thread Mark Lowe
You use indexed property.

html:text property=permission indexed=true /

This stuff i quite well documented, what isn't well documented is how 
to dynamically change the length of an indexed property. I've been 
using ArrayList for this..

form-property name=permission type=java.util.ArrayList /

You'll need to scope you form to session, as you get null pointers all 
over the show.

ArrayList myList = new ArrayList();

while(myObject.hasMoreStuff()) {
myList.add(myObject.next())'
}
theForm.set(permission, myList);

//also put the arraylist in an available context.

request.setAttribute(permissions, myList.toArray());

//jsp

logic:iterate id=perm name=permissions
html:text name=perm property=deleteUser indexed=true /
/logic:iterate
I'm still working on how to store the properties in the form when the 
size of the form property is changed. But I think this approach with 
solve what you're doing.

Cheers Mark

On Wednesday, August 13, 2003, at 07:22 PM, David Erickson wrote:

I'm developing some administrative functions for our web app, 
currently im
working on a page where it will list all the permissions available 
with a
checkbox by each, and the ones the current user has will be checked.

I'm trying to decide the best way to go about it, becaues the 
permissions
are pulled from a database and so they could change everytime the page 
is
loaded, and obviously every user will have different permissions which 
need
to be checked.

It shouldnt be a problem to iterate through a list of permissions, but 
the
question I have is when I go to submit a the form to modify the users
permissions, the names of each checkbox (permission) will change, so 
how
would I develop a form to handle that?  And is there an easy way to 
populate
all the checkboxes when the page loads?

I'm using JSP's to handle it.. would love to use struts html:XXX 
tags if
possible.

Reccomendations welcome =)
Thanks
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]