Application Resources and TextTool

2005-02-09 Thread Markos Charatzas
Hi all,

I get this weird bug(?) with TextTool.
On my struts-config.xml I declare the following message resource

message-resources parameter=DestinationsResources key=destinations /

then in my template I use the textool to retrieve a value from that resource

$text.get('title.img', 'destinations')

and I get a ClassCastException with the following stack trace,

java.lang.ClassCastException
 at org.apache.velocity.tools.struts.StrutsUtils.getMessageResources(Unknown 
Source)
 at org.apache.velocity.tools.struts.MessageResourcesTool.getResources(Unknown 
Source)
 at org.apache.velocity.tools.struts.MessageTool.get(Unknown Source)
 at org.apache.velocity.tools.struts.MessageTool.get(Unknown Source)



changed the key of the message resource to destination (notice the 's' 
missing)

using the new key value... and it works :/

thats using velocity-tools-1.1

I also have other resources that use the same notation, 
message-resources parameter=IndexResources key=index /

and cause me no problems.

Thanks in advance,
Markos Charatzas

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



Charset (Struts and Velocity)

2005-02-09 Thread Markos Charatzas
Hi there,

Although,

1. I have defined the charset in struts-config.xml like the following
controller contentType=text/html; charset=ISO-8859-7/
2. In velocity properties I have set both 
input.encoding=ISO-8859-7
output.encoding=ISO-8859-7
3. my html templates have the content type set properly
4. my resource files are in the corrent content type

I still get question marks (?) displayed back to the browser when displaying 
anything that comes from an ApplicationResource file :(

Thanks in advance.
Markos Charatzas

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



VelocityViewServlet Differences with VelocityServlet

2005-02-09 Thread Steve O'Hara

I've taken the advice offered by everyone to switch to using the
VelocityViewServlet but I've got a strange error occurring which didn't
happen with VelocityServlet (or if it did, it was caught).

When I log out from my application I clear the session object by doing a
session().invalidate()
Now, when the template for the logout screen is merged by Velocity. I get
the following error;

java.lang.IllegalStateException: getAttribute: Session already invalidated

I can't understand this, I don't refer to the session object in my template
so why is the VelocityViewServlet checking the session object?  Also, why
doesn't it catch this error gracefully?

Steve




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



Re: VelocityViewServlet Differences with VelocityServlet

2005-02-09 Thread Nathan Bubna
hmm.  i've not had problems with invalidated sessions before.  can you
give us some of that stack trace?  i wanna see where this is
happening.

On Wed, 9 Feb 2005 11:11:38 -, Steve O'Hara
[EMAIL PROTECTED] wrote:
 
 I've taken the advice offered by everyone to switch to using the
 VelocityViewServlet but I've got a strange error occurring which didn't
 happen with VelocityServlet (or if it did, it was caught).
 
 When I log out from my application I clear the session object by doing a
 session().invalidate()
 Now, when the template for the logout screen is merged by Velocity. I get
 the following error;
 
 java.lang.IllegalStateException: getAttribute: Session already invalidated
 
 I can't understand this, I don't refer to the session object in my template
 so why is the VelocityViewServlet checking the session object?  Also, why
 doesn't it catch this error gracefully?
 
 Steve
 
 -
 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: Application Resources and TextTool

2005-02-09 Thread Nathan Bubna
the relevant code (in veltools 1.1's StrutsUtils) is doing the following:

resources = (MessageResources) request.getAttribute(bundle +
moduleConfig.getPrefix());

if (resources == null) {
resources = (MessageResources) app.getAttribute(bundle +
moduleConfig.getPrefix());
}

this seems to indicate that there is something in either your request
attributes or servlet context attributes under the key destinationsX
(where X is your module config prefix) that is not a MessageResources
object.  i'm not sure how this would happen, but it is.  for tracking
the problem down, you might first try retrieving that object yourself
and finding out what it is.  you might also grep your app to find any
other place that an object would end up in your request or servlet
context attributes with that same key, because something is probably
doing so and thus replacing the MessageResources object that should be
there.


On Wed, 9 Feb 2005 12:26:05 +0200, Markos Charatzas [EMAIL PROTECTED] wrote:
 Hi all,
 
 I get this weird bug(?) with TextTool.
 On my struts-config.xml I declare the following message resource
 
 message-resources parameter=DestinationsResources key=destinations /
 
 then in my template I use the textool to retrieve a value from that resource
 
 $text.get('title.img', 'destinations')
 
 and I get a ClassCastException with the following stack trace,
 
 java.lang.ClassCastException
  at org.apache.velocity.tools.struts.StrutsUtils.getMessageResources(Unknown
 Source)
  at org.apache.velocity.tools.struts.MessageResourcesTool.getResources(Unknown
 Source)
  at org.apache.velocity.tools.struts.MessageTool.get(Unknown Source)
  at org.apache.velocity.tools.struts.MessageTool.get(Unknown Source)
 
 
 
 changed the key of the message resource to destination (notice the 's'
 missing)
 
 using the new key value... and it works :/
 
 thats using velocity-tools-1.1
 
 I also have other resources that use the same notation,
 message-resources parameter=IndexResources key=index /
 
 and cause me no problems.
 
 Thanks in advance,
 Markos Charatzas
 
 -
 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: velocity and JET (java emitter templates)

2005-02-09 Thread Shinobu Kawai
Hi Mike,

 Hi Does anyone have any any experience working with both of these template
 technologies?
 
 I'm evaluating both and trying to get a feel for what they can and can't
 do, so far
 I'm getting the impression that velocity provides a more flexible solution
 but wondering
 
 whats your experiences out there might have been with both.

Sorry, I don't know anything about JET, but I was wondering if you
could share with us what you have found about the two.  Maybe we can
add a new page under Comparisons.  :)

Best regards,
-- Shinobu

--
Shinobu Kawai Yoshida [EMAIL PROTECTED]

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



Re: Charset (Struts and Velocity)

2005-02-09 Thread Shinobu Kawai
Hi Markos,

 Although,
 
 1. I have defined the charset in struts-config.xml like the following
 controller contentType=text/html; charset=ISO-8859-7/
 2. In velocity properties I have set both
 input.encoding=ISO-8859-7
 output.encoding=ISO-8859-7

#*
Actually, the output.encoding doesn't matter unless you're using
VelocityServlet or Anakia.  ;)
   
http://jakarta.apache.org/velocity/developer-guide.html#Velocity%20Configuration%20Keys%20and%20Values
*#

 3. my html templates have the content type set properly
 4. my resource files are in the corrent content type

Please refresh my memory.  Was there a way to specify content type
in resource files?  I thought they were just PropertyResourceBundle
files.

 I still get question marks (?) displayed back to the browser when displaying
 anything that comes from an ApplicationResource file :(

Question marks usually means that the charset converter couldn't find
the suitable character for the conversion.  If you spit out some log
from java, is it encoded properly, or do you get question marks there,
too?

Best regards,
-- Shinobu

--
Shinobu Kawai Yoshida [EMAIL PROTECTED]

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



Re: velocity and JET (java emitter templates)

2005-02-09 Thread Mike J Boyersmith
Sorry, I don't know anything about JET, but I was wondering if you
could share with us what you have found about the two. 
Shinobu Kawai Yoshida [EMAIL PROTECTED]


Sure thing, What I have found is that JET or Java Emitter Templates is an 
Eclipse technology www.eclipse.org and part of EMF (though I'm sure it 
could have been made a separate plugin). 
Similar to Velocity, JET takes templates, script and data objects and 
merges the three to create a final output.
JET uses a JSP like scripting language. JET also allows full translation 
from templates to resulting output
or you can compile your templates to java classes, and simply invoke the 
java class. 

If your interested in this I have found two really good tutorials on the 
technology which can be found at:

http://www.eclipse.org/articles/Article-JET/jet_tutorial1.html
and
http://www.eclipse.org/articles/Article-JET2/jet_tutorial2.html

I haven't really come to any conclusions other than JET is built into 
eclipse and supports eclipse projects. The few tests I have
ran with JET have been very favorable, I didn't run into any problems with 
what I Was trying to do. 

Performance wise I have no ideas how the two compare, though the compile 
to class feature might be nice. 

ALSO I thought I'd mention that while I was researching JET I ran into 
another new technology that is for reporting 
that is being worked on called BIRT (B.I.R.T.). Business Intelligence and 
Reporting Tools,  take a look at 

http://www.eclipse.org/birt/

Though thats about the extent of my knowledge at this point on it.