Cyrille GACHOT wrote:
Le mer 04/08/2004 à 10:53, Raphaël Luta a écrit :
Cyrille GACHOT wrote:

In fact, I don't precisely know how to do what I want to obtain, and
that was the goal of my question. I'm sorry if I can't explain myself
clearly.
What I want is to obtain something similar to the WeatherPortlet, but
with JSP. In weatherPortlet, there is a parameter (Weather Location) in the
customization part that contain several fields (City, Country, ...).
What I want is something similar (much more complicated in fact), by the
simplest way.
I use a JSP template for my parameter, and I don't know where and how to
retrieve the information the user will type in the fields.


I hope this is clear enough...

Thanks to try helping me, I'm really lost with this part.


Let's see: WeatherPortlet uses the default customizer that does not implement
any complex server-side validation of input.
If you're comfortable with this limitation, you can use the JSPParamaterPresentationStyle inyour portlet xreg to have the customizer
import your JSP templates to provide custom UI for a specific parameter.


If you have more complex server-side validation needs you'll need to
define your own customier code:
- define a CustomizerJSP portlet (it seems that we never created it in the
default Jetspeed build, it should be there). Simply copy the
CustomizerVelocity to CustomizerJSP and change its base class to JSPPortlet
instead of VelocityPortlet.
- define your portlet in the registry to a have CustomizerJSP as parent
instead of JSP.
- now whenever you click customize on this portlet, the method buildCustomizeContent() is called on your portlet action so that you do whatever you need to prepare for cxustomization. Then set the template to use for
customization with setTemplate().
- set an action in the tempate to a custom customization action that'll handle
all the server-side validation, you can use the default customizer action
as a template for your action (org.apache.jetspeed.modules.actions.CustomizeAction)



Actually, looking at the code there, there's probably an opportunity for us to improve reuse of this code... I'll do some updates this week-end.



Thanks, it's much more clear to me now. I think I'll have to use the second solution. I tried the first solution for a simple case previously but never made it work. Just to know in case I need it later : How can I retrieve the information the user has typed in my custom UI for one parameter? It's not clear to me and every things I tried have failed.


If you use the default customizer, you can't since everything is handled by the customizer portlet. If you use a custom customizer, you're in regular portlet territory, so either you define an explicit action uin your customizer template and this action will be invoked when you submit your customization form or you use your default portlet action and use a event to submit your form. If you use the second option, be aware that you won't automatically leave the customize mode until execute the "controls.EndCustomze" action.

Have a look at "org.apache.jetspeed.modules.actions.portlets.CustomizeAction"
source and the following templates:
WEB-INF/templates/vm/portlets/html/customize-portlet.vm
WEB-INF/templates/vm/portlets/html/customize-update-save-row.vm

to see how the customization flow is handled in the default customizer.

--
Raphaël Luta - [EMAIL PROTECTED]
Apache Jetspeed - Enterprise Portal in Java
http://portals.apache.org/

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



Reply via email to