You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Michael James <st...@drexel.edu> on 2003/08/19 16:41:42 UTC

Parameter styles with multiple values

Hi,

	I'm trying to implement a parameter style that allows the user to 
select multiple items in a list.  The list is populated with data from 
a database.  I am subclassing VelocityParameterPresentationStyle to 
populate the Velocity context with the database's data.  So far, I can 
get the list box to appear with data in it and I can select multiple 
items in the list.  But when I click the Update button at the bottom of 
the customization portlet, I notice that only the first item of the 
selection gets sent to my parameter style when I try customizing my 
portlet again.

	The Velocity template that accompanies the parameter style generates a 
list of the format:

	<select name="listname" size="5" multiple="multiple">
		<option selected>value1</option>
		<option>value2</option>
		<option selected>value3</option>
		...
	</select>

	From what I understand, when a list with multiple selections (like the 
HTML above) is submitted in a form, the values are multiple values are 
comma-separated.  So for the list above, the submitted form would have 
the following line:

	listname=value1,value3

	My question is why does Jetspeed only return the first selected item 
instead of all of them in the parameter style's value attribute?  In 
particular, I am referring to the value parameter in the 
VelocityParameterPresentationStyle's buildNormalContext(rundata, name, 
value, parms, context) method.  Is there a way to get the data that 
gets submitted to the customizer portlet's form before it gets 
processed (and possibly altered) by Jetspeed?  Basically, I'm trying to 
get the same behavior as the ListBox parameter style, but the list's 
items must come from a database and not be manually typed into the 
registry.

	Any help or advice would be greatly appreciated.  Thanks in advance.

- Michael James


RE: Parameter styles with multiple values

Posted by Holger Dewes <h....@insiders.de>.
Hi Mark,

I finally found the time to test this. For me, it works, so thanks a
bunch!

Holger

-- 
Holger Dewes

> -----Original Message-----
> From: Mark Orciuch [mailto:mark_orciuch@ngsltd.com] 
> Sent: Thursday, August 21, 2003 6:08 AM
> To: Jetspeed Users List
> Subject: RE: Parameter styles with multiple values
> 
> 
> I have just corrected this issue. Please checkout Jetspeed 
> from CVS head and let me know if there's still a problem.
> 
> Best regards,
> 
> Mark C. Orciuch
> Next Generation Solutions, Ltd.
> e-Mail: mark_orciuch@ngsltd.com
> web: http://www.ngsltd.com
> 
> > -----Original Message-----
> > From: Holger Dewes [mailto:h.dewes@insiders.de]
> > Sent: Wednesday, August 20, 2003 2:28 AM
> > To: 'Jetspeed Users List'
> > Subject: RE: Parameter styles with multiple values
> >
> >
> > > -----Original Message-----
> > > From: Michael James [mailto:st962xmz@drexel.edu]
> > > Sent: Tuesday, August 19, 2003 4:42 PM
> > > To: jetspeed-user@jakarta.apache.org
> > > Subject: Parameter styles with multiple values
> > >
> > >
> > > Hi,
> > >
> > > 	I'm trying to implement a parameter style that allows
> > > the user to
> > > select multiple items in a list.  The list is populated with data 
> > > from a database.
> >
> > I have a similar problem and I've given up on it. But that doesn't 
> > mean that you shouldn't keep trying and tell me if you found a 
> > solution ;-) (But see below for more information.)
> >
> > > 	The Velocity template that accompanies the parameter
> > > style generates a
> > > list of the format:
> > >
> > > 	<select name="listname" size="5" multiple="multiple">
> > > 		<option selected>value1</option>
> > > 		<option>value2</option>
> > > 		<option selected>value3</option>
> > > 		...
> > > 	</select>
> > >
> > > 	From what I understand, when a list with multiple 
> selections (like 
> > > the HTML above) is submitted in a form, the values are multiple
> > > values are
> > > comma-separated.  So for the list above, the submitted form
> > > would have
> > > the following line:
> > >
> > > 	listname=value1,value3
> >
> > No, the request looks like this:
> >
> > listname=value1&listname=value3
> >
> > This is how multiple values are encoded. To read multiple 
> values from 
> > a request, you can do 
> rundata.getParameters().getStrings("listname"). 
> > This returns a String array of all values.
> > rundata.getParameters.getString("listname") only returns the first 
> > value of a multivalue parameter. If I understand correctly, this is 
> > how Jetspeed reads the parameters in 
> CustomizeAction.doUpdate() (where 
> > I think the customize requests are handled), at least in 
> b4, I don't 
> > know about the newest CVS version.
> >
> > So I think that at the moment, you cannot use dynamic 
> multiple values 
> > with parameter styles :-(
> >
> > Cheers
> > --
> > Holger Dewes
> >
> >
> > 
> 


RE: Parameter styles with multiple values

Posted by Mark Orciuch <ma...@ngsltd.com>.
I have just corrected this issue. Please checkout Jetspeed from CVS head and
let me know if there's still a problem.

Best regards,

Mark C. Orciuch
Next Generation Solutions, Ltd.
e-Mail: mark_orciuch@ngsltd.com
web: http://www.ngsltd.com

> -----Original Message-----
> From: Holger Dewes [mailto:h.dewes@insiders.de]
> Sent: Wednesday, August 20, 2003 2:28 AM
> To: 'Jetspeed Users List'
> Subject: RE: Parameter styles with multiple values
>
>
> > -----Original Message-----
> > From: Michael James [mailto:st962xmz@drexel.edu]
> > Sent: Tuesday, August 19, 2003 4:42 PM
> > To: jetspeed-user@jakarta.apache.org
> > Subject: Parameter styles with multiple values
> >
> >
> > Hi,
> >
> > 	I'm trying to implement a parameter style that allows
> > the user to
> > select multiple items in a list.  The list is populated with
> > data from
> > a database.
>
> I have a similar problem and I've given up on it. But that doesn't mean
> that you shouldn't keep trying and tell me if you found a solution ;-)
> (But see below for more information.)
>
> > 	The Velocity template that accompanies the parameter
> > style generates a
> > list of the format:
> >
> > 	<select name="listname" size="5" multiple="multiple">
> > 		<option selected>value1</option>
> > 		<option>value2</option>
> > 		<option selected>value3</option>
> > 		...
> > 	</select>
> >
> > 	From what I understand, when a list with multiple
> > selections (like the
> > HTML above) is submitted in a form, the values are multiple
> > values are
> > comma-separated.  So for the list above, the submitted form
> > would have
> > the following line:
> >
> > 	listname=value1,value3
>
> No, the request looks like this:
>
> listname=value1&listname=value3
>
> This is how multiple values are encoded. To read multiple values from a
> request, you can do rundata.getParameters().getStrings("listname"). This
> returns a String array of all values.
> rundata.getParameters.getString("listname") only returns the first value
> of a multivalue parameter. If I understand correctly, this is how
> Jetspeed reads the parameters in CustomizeAction.doUpdate() (where I
> think the customize requests are handled), at least in b4, I don't know
> about the newest CVS version.
>
> So I think that at the moment, you cannot use dynamic multiple values
> with parameter styles :-(
>
> Cheers
> --
> Holger Dewes
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org
>
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org


RE: Parameter styles with multiple values

Posted by Mark Orciuch <ma...@ngsltd.com>.
I have just corrected this issue. Please checkout Jetspeed from CVS head and
let me know if there's still a problem.

Best regards,

Mark C. Orciuch
Next Generation Solutions, Ltd.
e-Mail: mark_orciuch@ngsltd.com
web: http://www.ngsltd.com

> -----Original Message-----
> From: Holger Dewes [mailto:h.dewes@insiders.de]
> Sent: Wednesday, August 20, 2003 2:28 AM
> To: 'Jetspeed Users List'
> Subject: RE: Parameter styles with multiple values
>
>
> > -----Original Message-----
> > From: Michael James [mailto:st962xmz@drexel.edu]
> > Sent: Tuesday, August 19, 2003 4:42 PM
> > To: jetspeed-user@jakarta.apache.org
> > Subject: Parameter styles with multiple values
> >
> >
> > Hi,
> >
> > 	I'm trying to implement a parameter style that allows
> > the user to
> > select multiple items in a list.  The list is populated with
> > data from
> > a database.
>
> I have a similar problem and I've given up on it. But that doesn't mean
> that you shouldn't keep trying and tell me if you found a solution ;-)
> (But see below for more information.)
>
> > 	The Velocity template that accompanies the parameter
> > style generates a
> > list of the format:
> >
> > 	<select name="listname" size="5" multiple="multiple">
> > 		<option selected>value1</option>
> > 		<option>value2</option>
> > 		<option selected>value3</option>
> > 		...
> > 	</select>
> >
> > 	From what I understand, when a list with multiple
> > selections (like the
> > HTML above) is submitted in a form, the values are multiple
> > values are
> > comma-separated.  So for the list above, the submitted form
> > would have
> > the following line:
> >
> > 	listname=value1,value3
>
> No, the request looks like this:
>
> listname=value1&listname=value3
>
> This is how multiple values are encoded. To read multiple values from a
> request, you can do rundata.getParameters().getStrings("listname"). This
> returns a String array of all values.
> rundata.getParameters.getString("listname") only returns the first value
> of a multivalue parameter. If I understand correctly, this is how
> Jetspeed reads the parameters in CustomizeAction.doUpdate() (where I
> think the customize requests are handled), at least in b4, I don't know
> about the newest CVS version.
>
> So I think that at the moment, you cannot use dynamic multiple values
> with parameter styles :-(
>
> Cheers
> --
> Holger Dewes
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org
>
>
>
>



RE: Parameter styles with multiple values

Posted by Holger Dewes <h....@insiders.de>.
> -----Original Message-----
> From: Michael James [mailto:st962xmz@drexel.edu] 
> Sent: Tuesday, August 19, 2003 4:42 PM
> To: jetspeed-user@jakarta.apache.org
> Subject: Parameter styles with multiple values
> 
> 
> Hi,
> 
> 	I'm trying to implement a parameter style that allows 
> the user to 
> select multiple items in a list.  The list is populated with 
> data from 
> a database.

I have a similar problem and I've given up on it. But that doesn't mean
that you shouldn't keep trying and tell me if you found a solution ;-)
(But see below for more information.)
 
> 	The Velocity template that accompanies the parameter 
> style generates a 
> list of the format:
> 
> 	<select name="listname" size="5" multiple="multiple">
> 		<option selected>value1</option>
> 		<option>value2</option>
> 		<option selected>value3</option>
> 		...
> 	</select>
> 
> 	From what I understand, when a list with multiple 
> selections (like the 
> HTML above) is submitted in a form, the values are multiple 
> values are 
> comma-separated.  So for the list above, the submitted form 
> would have 
> the following line:
> 
> 	listname=value1,value3

No, the request looks like this:

listname=value1&listname=value3

This is how multiple values are encoded. To read multiple values from a
request, you can do rundata.getParameters().getStrings("listname"). This
returns a String array of all values.
rundata.getParameters.getString("listname") only returns the first value
of a multivalue parameter. If I understand correctly, this is how
Jetspeed reads the parameters in CustomizeAction.doUpdate() (where I
think the customize requests are handled), at least in b4, I don't know
about the newest CVS version.

So I think that at the moment, you cannot use dynamic multiple values
with parameter styles :-(

Cheers
-- 
Holger Dewes


RE: Parameter styles with multiple values

Posted by Holger Dewes <h....@insiders.de>.
> -----Original Message-----
> From: Michael James [mailto:st962xmz@drexel.edu] 
> Sent: Tuesday, August 19, 2003 4:42 PM
> To: jetspeed-user@jakarta.apache.org
> Subject: Parameter styles with multiple values
> 
> 
> Hi,
> 
> 	I'm trying to implement a parameter style that allows 
> the user to 
> select multiple items in a list.  The list is populated with 
> data from 
> a database.

I have a similar problem and I've given up on it. But that doesn't mean
that you shouldn't keep trying and tell me if you found a solution ;-)
(But see below for more information.)
 
> 	The Velocity template that accompanies the parameter 
> style generates a 
> list of the format:
> 
> 	<select name="listname" size="5" multiple="multiple">
> 		<option selected>value1</option>
> 		<option>value2</option>
> 		<option selected>value3</option>
> 		...
> 	</select>
> 
> 	From what I understand, when a list with multiple 
> selections (like the 
> HTML above) is submitted in a form, the values are multiple 
> values are 
> comma-separated.  So for the list above, the submitted form 
> would have 
> the following line:
> 
> 	listname=value1,value3

No, the request looks like this:

listname=value1&listname=value3

This is how multiple values are encoded. To read multiple values from a
request, you can do rundata.getParameters().getStrings("listname"). This
returns a String array of all values.
rundata.getParameters.getString("listname") only returns the first value
of a multivalue parameter. If I understand correctly, this is how
Jetspeed reads the parameters in CustomizeAction.doUpdate() (where I
think the customize requests are handled), at least in b4, I don't know
about the newest CVS version.

So I think that at the moment, you cannot use dynamic multiple values
with parameter styles :-(

Cheers
-- 
Holger Dewes


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org