RE: pass complex object to custom tag
> -Original Message- > From: Erik Price [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 30, 2003 5:19 PM > To: Tomcat Users List > Subject: Re: pass complex object to custom tag > > > > > Tim Moore wrote: > > >>I have a class I've written and I'd love to find a way to > >>pass it to a > >>custom tag for processing. This would separate the display > >>logic from > >>the business logic. > >> > >> > >> > >> > > > > > > This didn't work? Just make your tag handler have a method like > > setSrc(UserBean src) and that should work fine. > > > > I have written everything according to the spec and now I am running > into some kind of a JavaBeans problem. If anyone can help me > that'd be > great. > > 1. The servlet has stored a UserBean into the session with > the key "user". 2. The JSP pulls the UserBean from the > session like this: > > class="com.ptc.budgetease.beans.UserBean"/> > > 3. My new custom tag tries to refer to the bean in one of its > attributes: > > property="mainPageBudgetRequestList" > />" > /> > (it is all on one line in the app, I broke it up for email) Yeah, you can't nest a tag in the attribute of another tag like that. It's not recognized as a rtexprvalue. You'll have to do this: -- Tim Moore / Blackboard Inc. / Software Engineer 1899 L Street, NW / 5th Floor / Washington, DC 20036 Phone 202-463-4860 ext. 258 / Fax 202-463-4863 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: pass complex object to custom tag
After experimentation, I guess you can't use the tag as an attribute of a custom tag, although you can use a JSP expression to achieve the same effect. So, it works, just not the way that I originally tried to do it. Erik Erik Price wrote: Tim Moore wrote: I have a class I've written and I'd love to find a way to pass it to a custom tag for processing. This would separate the display logic from the business logic. This didn't work? Just make your tag handler have a method like setSrc(UserBean src) and that should work fine. I have written everything according to the spec and now I am running into some kind of a JavaBeans problem. If anyone can help me that'd be great. 1. The servlet has stored a UserBean into the session with the key "user". 2. The JSP pulls the UserBean from the session like this: 3. My new custom tag tries to refer to the bean in one of its attributes: property="mainPageBudgetRequestList" />" /> (it is all on one line in the app, I broke it up for email) The error I get when I go to the JSP (after passing through the servlet that stores the UserBean in the session) is: org.apache.jasper.compiler.ParseException: /main.jsp(47,70) Attribute user has no value at org.apache.jasper.compiler.JspReader.parseAttributeValue(JspReader.java:563) at org.apache.jasper.compiler.JspReader.parseTagAttributes(JspReader.java:681) Erik - 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]
Re: pass complex object to custom tag
Tim Moore wrote: I have a class I've written and I'd love to find a way to pass it to a custom tag for processing. This would separate the display logic from the business logic. This didn't work? Just make your tag handler have a method like setSrc(UserBean src) and that should work fine. I have written everything according to the spec and now I am running into some kind of a JavaBeans problem. If anyone can help me that'd be great. 1. The servlet has stored a UserBean into the session with the key "user". 2. The JSP pulls the UserBean from the session like this: 3. My new custom tag tries to refer to the bean in one of its attributes: property="mainPageBudgetRequestList" />" /> (it is all on one line in the app, I broke it up for email) The error I get when I go to the JSP (after passing through the servlet that stores the UserBean in the session) is: org.apache.jasper.compiler.ParseException: /main.jsp(47,70) Attribute user has no value at org.apache.jasper.compiler.JspReader.parseAttributeValue(JspReader.java:563) at org.apache.jasper.compiler.JspReader.parseTagAttributes(JspReader.java:681) Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: pass complex object to custom tag
> -Original Message- > From: Felipe Schnack [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 30, 2003 3:34 PM > To: Tomcat Users List > Subject: RE: pass complex object to custom tag > > > The tag shouldn't have rtexexpr set to true in its TLD too? > (specifically for "src" attribute, of course) Oh yeah, that too :-) -- Tim Moore / Blackboard Inc. / Software Engineer 1899 L Street, NW / 5th Floor / Washington, DC 20036 Phone 202-463-4860 ext. 258 / Fax 202-463-4863 > > On Thu, 2003-01-30 at 18:31, Tim Moore wrote: > > > > > -Original Message- > > > From: Erik Price [mailto:[EMAIL PROTECTED]] > > > Sent: Thursday, January 30, 2003 3:22 PM > > > To: Tomcat Users List > > > Subject: pass complex object to custom tag > > > > > > > > > Is there a way to pass something other than a string to a > custom tag > > > through the attributes? > > > > > > I have a class I've written and I'd love to find a way to > > > pass it to a > > > custom tag for processing. This would separate the display > > > logic from > > > the business logic. > > > > > > > > > > > > > > > > This didn't work? Just make your tag handler have a method like > > setSrc(UserBean src) and that should work fine. > > > > -- > > Tim Moore / Blackboard Inc. / Software Engineer > > 1899 L Street, NW / 5th Floor / Washington, DC 20036 > > Phone 202-463-4860 ext. 258 / Fax 202-463-4863 > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- > > Felipe Schnack > Analista de Sistemas > [EMAIL PROTECTED] > Cel.: (51)91287530 > Linux Counter #281893 > > Centro Universitário Ritter dos Reis > http://www.ritterdosreis.br > [EMAIL PROTECTED] > > Fone/Fax.: (51)32303341 > > > - > 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]
Re: pass complex object to custom tag
Tim Moore wrote: -Original Message- From: Erik Price [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 30, 2003 3:22 PM To: Tomcat Users List Subject: pass complex object to custom tag Is there a way to pass something other than a string to a custom tag through the attributes? I have a class I've written and I'd love to find a way to pass it to a custom tag for processing. This would separate the display logic from the business logic. This didn't work? Just make your tag handler have a method like setSrc(UserBean src) and that should work fine. Oh, my mistake then -- I was reading examples of custom tags and they all seemed to use strings, so I assumed that you had to parse the strings to make anything more complicated than a string (such as a serialized object or something). I guess that's only if you don't use a JSP exprssion (you hard code an attribute value). Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: pass complex object to custom tag
You could pass the object name, property name, and scope to the tag, then use reflection to do it - the commons-beanutils stuff makes this painless. It is really simple and prowerful, honest! >>> [EMAIL PROTECTED] 01/30/03 13:26 PM >>> Is there a way to pass something other than a string to a custom tag through the attributes? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: pass complex object to custom tag
The tag shouldn't have rtexexpr set to true in its TLD too? (specifically for "src" attribute, of course) On Thu, 2003-01-30 at 18:31, Tim Moore wrote: > > > -Original Message- > > From: Erik Price [mailto:[EMAIL PROTECTED]] > > Sent: Thursday, January 30, 2003 3:22 PM > > To: Tomcat Users List > > Subject: pass complex object to custom tag > > > > > > Is there a way to pass something other than a string to a custom tag > > through the attributes? > > > > I have a class I've written and I'd love to find a way to > > pass it to a > > custom tag for processing. This would separate the display > > logic from > > the business logic. > > > > > > > > > > This didn't work? Just make your tag handler have a method like > setSrc(UserBean src) and that should work fine. > > -- > Tim Moore / Blackboard Inc. / Software Engineer > 1899 L Street, NW / 5th Floor / Washington, DC 20036 > Phone 202-463-4860 ext. 258 / Fax 202-463-4863 > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: pass complex object to custom tag
> -Original Message- > From: Erik Price [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 30, 2003 3:22 PM > To: Tomcat Users List > Subject: pass complex object to custom tag > > > Is there a way to pass something other than a string to a custom tag > through the attributes? > > I have a class I've written and I'd love to find a way to > pass it to a > custom tag for processing. This would separate the display > logic from > the business logic. > > > > This didn't work? Just make your tag handler have a method like setSrc(UserBean src) and that should work fine. -- Tim Moore / Blackboard Inc. / Software Engineer 1899 L Street, NW / 5th Floor / Washington, DC 20036 Phone 202-463-4860 ext. 258 / Fax 202-463-4863 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]