dev@jsftemplating.java.net

Re: JSFTemplating: sun:addRemove tag help

From: Ken Paulsen <Ken.Paulsen_at_Sun.COM>
Date: Thu, 10 May 2007 11:31:02 -0700

Yes, that's the problem.  They're coming in as a String after your redirect.  When you construct your URL, you'll need to put them in the URL in a way you can retrieve it again, or as you mentioned, process it before the redirect and/or save in session.

Good luck!

Ken

Karam Singh Badesha wrote:
I think I know what else is going wrong. On the form page when the submit happens, I am redirecting to the output page. So I am passing these page session variables via parameters on the url. So after submit the url looks like:

http://localhost:8080/CADRe/customReportResult.jsf?userName=[Ljava.lang.String;@ea86ad&toolName=[Ljava.lang.Object;@12fdcd7&project=ROCK&feature=&platform=&build=&lavaRelease=11.00.00&db=production&startDate=&endDate=

So I think I would need to take care of the submit on the same page as I don't know if there is a way to pass these values to the next page without using session variables and even then I don't know if its possible to set them as array type.

Do you have any suggestions?

thanks
Karam

Ken Paulsen wrote On 05/10/07 09:20 AM,:

Hi Karam,

I'll look into this... in the mean time, try Object.class as the input value.

Thanks!

Ken

Karam Singh Badesha wrote:
Ken,
I think now I can get past that to the new problem. In my handler code where I can passing these values to, I have:

@Handler(id="getCustomQueryData",
    input={
        @HandlerInput(name="userName", type=String[].class),
        @HandlerInput(name="toolName", type=String[].class),
...

and I get the following exception:

[#|2007-05-10T08:18:53.890-0700|SEVERE|sun-appserver-pe9.0|javax.enterprise.system.container.web|_ThreadID=17;_ThreadName=httpWorkerThread-8080-3;_RequestID=0995ced6-225d-4639-aaba-96a64de1e457;|StandardWrapperValve[FacesServlet]: Servlet.service() for servlet FacesServlet threw exception
java.lang.IllegalArgumentException: Could not find type conversion for type "class [Ljava.lang.String;" (value = "[Ljava.lang.String;@7ac4c8"
        at com.sun.jsftemplating.util.TypeConverter.asType(TypeConverter.java:259)
        at com.sun.jsftemplating.layout.descriptors.handler.Handler.getInputValue(Handler.java:198)
        at com.sun.jsftemplating.layout.descriptors.handler.HandlerContextImpl.getInputValue(HandlerContextImpl.java:142)
        at com.sun.cadre.handlers.TableHandlers.fetchCustomQueryTableData(TableHandlers.java:212)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at com.sun.jsftemplating.layout.descriptors.handler.Handler.invoke(Handler.java:421)
        at com.sun.jsftemplating.layout.descriptors.LayoutElementBase.dispatchHandlers(LayoutElementBase.java:343)
        at com.sun.jsftemplating.layout.descriptors.LayoutElementBase.dispatchHandlers(LayoutElementBase.java:317)
        at com.sun.jsftemplating.layout.descriptors.LayoutComponent.beforeCreate(LayoutComponent.java:331)
        at com.sun.jsftemplating.layout.descriptors.LayoutComponent.getChild(LayoutComponent.java:270)
        at com.sun.jsftemplating.layout.LayoutViewHandler.buildUIComponentTree(LayoutViewHandler.java:379)
        at com.sun.jsftemplating.layout.LayoutViewHandler.createView(LayoutViewHandler.java:200)
        at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:218)
        at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:244)
        at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:113)
        at com.sun.faces.extensions.avatar.lifecycle.PartialTraversalLifecycle.execute(PartialTraversalLifecycle.java:80)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
        at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:278)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
        at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
        at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:239)
        at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
        at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
        at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
        at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
        at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
        at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
        at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)

-Karam

Ken Paulsen wrote On 05/10/07 12:05 AM,:

Hi Karam,

It appears to be a bug in Woodstock.  When the value you have bound to "selected" is null, it doesn't appear to be working (I didn't dive into the code to confirm this).

I found an easy work-a-round for you:

    <sun:addRemove id="toolName" items="$attribute{toolList}" selected="#{pageSession.toolName}" availableItemsLabel="Available:" selectedItemsLabel="Selected:" sorted="true" labelOnTop="true" rows="6">
        <!beforeCreate
            getSunOptions(labels={"a", "b", "c"}, values={"1", "2", "3"}, options=>$attribute{toolList});
            setPageSessionAttribute(key="toolName" value=[]);
        />
    </sun:addRemove>


Setting the pageSession to [] in the beforeCreate event solves the problem (this is an empty array).  Let me know if you still see a problem.  Feel free to file this issue against woodstock (https://woodstock.dev.java.net) if you'd like.

Ken Paulsen
https://jsftemplating.dev.java.net


Karam Singh Badesha wrote:
Anyone?

thanks
Karam

Karam Singh Badesha wrote On 05/09/07 02:23 PM,:

Hi,
I have the following:

<sun:addRemove
                id="toolName"
                items="$attribute{toolList}"
                selected="#{pageSession.toolName}"
                availableItemsLabel="Available:"
                selectedItemsLabel="Selected:"
                sorted="#{true}"
                labelOnTop="#{true}"
                rows="$int{6}"
                />

In my handler code, toolName is of type String[].  When I submit on this page, eventhough I haven't set this component as "required", it keeps coming back in "red" suggesting it is required.  So I am guessing maybe I am defining it wrong in the above code. Can someone let me know what do I need to change to get this to work.

What would be the correct code for:
selected="#{pageSession.toolName}"

thanks
Karam