Skip to main content

Enums, JSP, setProperty, error, fail, not working (other similar keywords)

1 reply [Last post]
grpahicpoet
Offline
Joined: 2006-06-09

I assume that I'm missing something. The docs all seem clear that a String can be used in the "value" attribute of the standard action and will be coerced. This seems not to be working for me.

the class com.graphicpoet.web.gui.LayoutOrientation looks like:

package com.graphicpoet.web.gui;

public class LayoutOrientation {
protected LayoutDirection layoutDirection;

    public static enum LayoutDirection {
        vertical, horizontal;
    }

    protected void setLayoutDirection(LayoutDirection layoutDirection) {
this.layoutDirection = layoutDirection;
}
}

the offending jsp tag looks like:

When I call the page containing the above jsp snippet, I get:

HTTP Status 500 -

type Exception report

message

descriptionThe server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: org.apache.jasper.JasperException: org.apache.jasper.JasperException: PWC6338: Cannot convert "left" for the attribute horizontalOrigin of the bean com.graphicpoet.web.gui.LayoutOrientation$HorizontalOrigin

root cause

org.apache.jasper.JasperException: org.apache.jasper.JasperException: PWC6338: Cannot convert "left" for the attribute horizontalOrigin of the bean com.graphicpoet.web.gui.LayoutOrientation$HorizontalOrigin

root cause

org.apache.jasper.JasperException: PWC6338: Cannot convert "left" for the attribute horizontalOrigin of the bean com.graphicpoet.web.gui.LayoutOrientation$HorizontalOrigin

note The full stack traces of the exception and its root causes are available in the Sun Java System Application Server 9.1_02 logs.
Sun Java System Application Server 9.1_02

----

I'll be very appreciative to any and all who help. I expect that I have something turned off, because, for all of my reading, I don't know what else to do.

Thanks in advance

Message was edited by: grpahicpoet

Message was edited by: grpahicpoet

Message was edited by: grpahicpoet

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
grpahicpoet
Offline
Joined: 2006-06-09

I believed this to be a problem with my EL configuration, which I have since decided that it was not. Jsp is doing a simple, direct injection thing here, while I was expecting it to interpret the text in my attribute as a ValueExpression. This is what is to be expected with the useBean action. If a custom tag with a tag library descriptor had been used, then the parameter type for the setter could have been specified.

The solution is to wrap the string literal in a '${' and '}'. Which, for my situation would be
value="${'left'}"

Message was edited by: grpahicpoet