joel
Dan Alford wrote:
Joel, Try explicitly casting the object.
String [] sArray = (String[]) <jpath:value-of select='searchType' />;
If that doesnt work, you will probably need to find a cocoon expert
Dan Joel McConaughy wrote:
If I use the following statement:
String [] sArray = <jpath:value-of select='searchType' />;
I get the following compile-time error:
Type mismatch: cannot convert from Object to String[]
Any other ideas? Thanks for the quick response!
joel
Dan Alford wrote:
I'm not a cocoon expert but the Class type of your first object is an array of Strings. The [L prefix tells you that you have an array of objects. Perhaps your jpath expression is returning more than one String result?
Joel McConaughy wrote:
I'm getting a funny looking class returned from a jpath expression. Here is a small code example displays the class name for two strings, one created with a jpath expression and the other a static value. Notice the the class type from the jpath expression looks funny. Am I doing something wrong? Thanks.
Joel
<xsp:logic>
// create an Object from jpath expression; should be String class per javadocs
Object o = <jpath:value-of select='searchType' />;
String oClass = o.getClass().getName();
// create an Object from static String
Object oo = "Test 123";
String ooClass = oo.getClass().getName();
</xsp:logic> <!-- display each class name -->
<oClass><xsp:expr>oClass</xsp:expr></oClass>
<ooClass><xsp:expr>ooClass</xsp:expr></ooClass>
Returns the following:
<oClass>[Ljava.lang.String;</oClass> <ooClass>java.lang.String</ooClass>
--------------------------------------------------------------------- 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]
--------------------------------------------------------------------- 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]