[S2] Freemarker Configuration?

2007-09-21 Thread Kenton

If I want to configure Freemarker within Struts 2, how do I access the
FreemarkerManager instance? Ideally, I would do this one time on startup to
set global settings for my application.

I see there are some settings that can be configured via
freemarker.properties, but other options can not.
-- 
View this message in context: 
http://www.nabble.com/-S2--Freemarker-Configuration--tf4499866.html#a12833400
Sent from the Struts - User mailing list archive at Nabble.com.


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



[S2] Minor Documentation Issue

2007-09-21 Thread Kenton

At: http://struts.apache.org/2.x/docs/url.html

it says url attribute "id" is deprecated in favor of "var". However, var
doesn't work and id does (Struts 2.0.9). I assume this is a documentation
error. Can I fix this somehow? Or I will just ignore.
-- 
View this message in context: 
http://www.nabble.com/-S2--Minor-Documentation-Issue-tf4498570.html#a12829780
Sent from the Struts - User mailing list archive at Nabble.com.


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



Configure Default Object Wrapper?

2007-09-14 Thread Kenton

I'm want to configure Freemarker to support direct property access without
requiring geetter methods.

Someone on the Freemarker list 
http://www.nabble.com/FreeMarker-EL-And-Object-Member-Variables--tf4433530.html
said :


you have to tell your app to use BeansWrapper as opposed to the
> default object wrapper

How do I do that? What is the default object wrapper in Struts? Maybe I can
configure that?
-- 
View this message in context: 
http://www.nabble.com/Configure-Default-Object-Wrapper--tf4445284.html#a12683726
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: How do I set MIME type with FreeMarker Templates?

2007-09-14 Thread Kenton

I found the solution. For anyone finding this thread through a search engine,
just do this in struts.xml:



application/xhtml+xml
/page.ftl



I also tried  entries in web.xml but those didn't seem to do
anything.

I don't believe Struts supports a mechanism to specify a global default
other than text/html or to support XHTML MIME type for browsers that support
it but HTML for browsers that don't (IE).


Kenton wrote:
> 
> With .jsp files, I can do:
> <%@ page contentType="application/xhtml+xml;charset=ISO-8859-1" %>
> With .jspx files, I can do:
> 
> 
> What is the equivalent with FreeMarker (.FTL) templates?
> 
> Or for the ultimate, could I set a global MIME type for all freemarker/jsp
> files of "application/xhtml+xml" for browsers that indicate that that they
> can accept that, and fallback to "text/html" for browsers that can't (IE).
> 

-- 
View this message in context: 
http://www.nabble.com/How-do-I-set-MIME-type-with-FreeMarker-Templates--tf4424108.html#a12682231
Sent from the Struts - User mailing list archive at Nabble.com.


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



How do I set MIME type with FreeMarker Templates?

2007-09-11 Thread Kenton

With .jsp files, I can do:
<%@ page contentType="application/xhtml+xml;charset=ISO-8859-1" %>
With .jspx files, I can do:


What is the equivalent with FreeMarker (.FTL) templates?

Or for the ultimate, could I set a global MIME type for all freemarker/jsp
files of "application/xhtml+xml" for browsers that indicate that that they
can accept that, and fallback to "text/html" for browsers that can't (IE).
-- 
View this message in context: 
http://www.nabble.com/How-do-I-set-MIME-type-with-FreeMarker-Templates--tf4424108.html#a12619799
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Simple Question about FreeMarker + Struts 2

2007-09-11 Thread Kenton

I identified the issue and this isn't related to NULL references. To
summarize:

This syntax will work with a getter method OR directly with the raw member
variable if the getter method isn't present: <@s.property
value="myActionProperty.subProperty" />

This syntax requires a getter method and won't work directly with a member
variable: ${myActionProperty.subProperty}


I prefer to avoid littering my code with unnecessary boilerplate
getter/setter methods and only define getters/setters when they actually do
something that is non-trivial. But at least this makes sense.

Thank you very much for the helpful replies!


Zarar Siddiqi wrote:
> 
> Freemarker considers null references errors.  When
> myActionProperty.subProperty is referenced in the Struts tag, it is
> printed regardless of its value.  However, when Freemarker encounters
> ${myActionProperty.subProperty}, it will give you an error if
> subProperty is null.  When trying to print Freemarker variables using
> the $ or # syntax, you should probably do an if check like this:
> 
> <# if myActionProperty.subProperty?exists>
>   ${myActionProperty.subProperty}
> 
> 
> I know, it's a bit of a pain.
> 
> Zarar Siddiqi
> 

-- 
View this message in context: 
http://www.nabble.com/Simple-Question-about-FreeMarker-%2B-Struts-2-tf4394620.html#a12619549
Sent from the Struts - User mailing list archive at Nabble.com.


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



application/xhtml+xml MIME Type?

2007-09-07 Thread Kenton

How do I specify a contentType of "application/xhtml+xml" when I'm using
freemarker templates?

With .jspx files, I can do:

With .jsp files, I can do:
<%@ page contentType="application/xhtml+xml;charset=ISO-8859-1" %>

Or better yet, is there any way to configure the Struts servlet with a
global default MIME type for all freemarker/jsp templates?

Or for the ultimate, could I set a MIME type of "application/xhtml+xml" for
browsers that indicate that that they can accept that, and fallback to
"text/html" for browsers that can't (IE).
-- 
View this message in context: 
http://www.nabble.com/application-xhtml%2Bxml-MIME-Type--tf4404426.html#a12565294
Sent from the Struts - User mailing list archive at Nabble.com.


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



Simple Question about FreeMarker + Struts 2

2007-09-06 Thread Kenton

I'm a newbie trying learn how to use FreeMarker for Struts result pages.

This code works: <@s.property value="myActionProperty.subProperty" />
This code triggers a FreeMarker error (expression undefined):
${myActionProperty.subProperty}

Obviously, I'm missing something very simple. But what is it?

Is there any way to dump the tree of EL variables so that I can undertand
better?

Is there any good documentation on using FreeMarker in Struts? I can find
great documentation on FreeMarker by itself and Struts by itself, but I
can't find any docs or tutorials on using the two together. Any suggestions?
-- 
View this message in context: 
http://www.nabble.com/Simple-Question-about-FreeMarker-%2B-Struts-2-tf4394620.html#a12531237
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Simple Struts 2.0.x tag question. "/>

2007-09-06 Thread Kenton

Thanks for the reply, Laurie! This suggestion of yours works perfectly!
(Although, I had to change var="url" to id="url")


 ${url}  

Your other suggestion doesn't work. I'd like to know why this doesn't work,
as this was what I first tried (I mentioned this in my original post, btw)

 ${item.imageURL} 

Results in this exception (Glassfish v2 RC, Struts 2.0.9, JDK 1.6.02,
Windows XP):

java.io.IOException: Stream closed
at
org.apache.jasper.runtime.JspWriterImpl.ensureOpen(JspWriterImpl.java:257)
at
org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:161)
at org.apache.jasper.runtime.JspWriterImpl.flush(JspWriterImpl.java:219)
at
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:985)
at
org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:671)
at
org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:119)
at
org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:178)
at
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:348)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:253)
at
org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50)
at
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:504)
at
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at 
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:270)
at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
at
com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:339)
at
com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:261)
at
com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:212)
at
com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:361)
at 
com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
at
com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)

Could you explain why the EL triggers this exception? Is that a bug or am I
doing something wrong?

Also, what is the ${myObj.property} and %{myObj.property} EL syntax called?
Where can I read documentation on it?


Laurie Harper wrote:
> 
> ${item.imageURL} 
> 
>
> ${url} 
> 

-- 
View this message in context: 
http://www.nabble.com/Simple-Struts-2.0.x-tag-question.-%3Cimg-src%3D%22%3Cs%3Aproperty-value%3Ditem.imageURL%22-%3E%22-%3E-tf4388166.html#a12525398
Sent from the Struts - User mailing list archive at Nabble.com.


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



Simple Struts 2.0.x tag question. "/>

2007-09-05 Thread Kenton

I have a .jspx file in my Struts 2.0.x app.

This doesn't work: 
I get this error (both editor and at runtime): The value of attribute "src"
associated with an element type "null" must not contain the '<' character.  
(The above should regular non-escaped HTML, in case the formatting of this
message isn't correct)

This works, but seems like a very ugly workaround: <img
src="images/"/>
(The above should show "&" entity notation in case the formatting of this
message isn't correct)

This: 
Gets this error: java.io.IOException: Stream closed

This: 
Gets this error: PWC6317: The attributes for a standard action or an
uninterpreted tag cannot be deferred expressions

What is the best way to do this?
-- 
View this message in context: 
http://www.nabble.com/Simple-Struts-2.0.x-tag-question.-%3Cimg-src%3D%22%3Cs%3Aproperty-value%3Ditem.imageURL%22-%3E%22-%3E-tf4388166.html#a12511140
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: xhtml problem

2007-09-05 Thread Kenton

Old thread... However, I believe I'm doing exactly what you are saying:
Struts 2.0.x + XHTML + .jspx file with a  embedded inside a 
element. This is working perfectly. No errors in my editor (NetBeans 5.5.1)
or in the runtime (Glassfish v2). Here is a simple example:


 
http://java.sun.com/JSP/Page"; version="2.1"
xmlns:s="/struts-tags"
xmlns="http://www.w3.org/1999/xhtml";>



http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"; />

http://www.w3.org/1999/xhtml";>

Some Page


// <![CDATA[
// 
// ]]>



This is a test page


Message: 





Found



Not Found












Ray Clough wrote:
> 
> I produce all my jsp pages is xml format - ie. as 'jspx' jsp-documents.  I
> find a serious drawback to the struts tags, and I'm wondering if anyone
> has a suggestion.  The xhtml does not allow element content within other
> elements; for example the  tag cannot contain a  tag.  Lots of
> examples in the struts documentation use this, which is not a problem for
> regular html, but is a big show stopper in xml.  The tags do allow jsp-el,
> but not other elements.
> 
> Any suggestions?
> - Ray Clough
> 

-- 
View this message in context: 
http://www.nabble.com/xhtml-problem-tf3848996.html#a12510895
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: [S2] Do AJAX features work?

2007-07-03 Thread Kenton

This is perfect.

I've investigated the Yui library and it looks perfect. It has all the
functionality I need, the documentation is great, and the examples work
perfectly. I haven't had time to integrate with Struts and use the mentioned
plugin, but that's definitely on my list.

That's also great news about Struts 2.1.

Thank you Musachy. I'm very happy. Issue resolved.


Musachy Barroso wrote:
> 
> On 2.0 you would be stuck with Dojo(which seems to be the source of your
> problems), for 2.1 Dojo will be on it's own plugin so you won't have to
> carry it around. As for using other libraries, you just need to stay away
> from the ajax theme, and include  the javascript files in your app. Some
> work is going on the YUI plugin, but there are only 2 tags, and it is
> quite
> new :)
> 
> http://cwiki.apache.org/S2PLUGINS/yui-plugin.html
> 
> musachy
> 
> On 7/2/07, Kenton <[EMAIL PROTECTED]> wrote:
>>
>>
>> Struts: 2.0.8
>> Browser: Firefox 2.0.0.4
>> App Server: Glassfish v2 beta 2
>> OS: Windows XP SP2
>>
>> I'm trying to add some simple AJAX functionality to my Struts 2
>> application.
>>
>> I've copy/pasted a few snippets from the Struts 2 documentation. I've
>> tried
>> several variations on this:
>>
>> 
>> Test
>>
>> 
>> 
>>
>> 
>> This is a test page
>>
>> 
>> 
>> > theme="ajax" targets="div1" label="Submit
>> Button"/>
>>
>> Submit
>> form
>> 
>> 
>> 
>>
>> When I try this, I see the following in my browser:
>>
>> DEBUG:  dojo.widget.Parse: error:TypeError: impl is not a constructor
>> DEBUG:  dojo.widget.Parse: error:TypeError: impl is not a constructor
>>
>> I also see this in the Firefox JavaScript error console:
>>
>> Error: uncaught exception: [Exception... "Object cannot be created in
>> this
>> context"  code: "9" nsresult: "0x80530009
>> (NS_ERROR_DOM_NOT_SUPPORTED_ERR)"
>> location: "http://localhost:8080/vgstats/struts/dojo/src/browser_debug.js
>> Line: 168"]
>>
>> Anyone have any ideas?
>>
>> Also, I've tried to get some static web apps working with Dojo in hopes
>> that
>> I could better understand the Dojo library and possibly debug this. I've
>> tried both the 0.4.3 and 0.9M2 releases and have had a variety of
>> problems
>> with both. Also, the online demos are broken and the documentation is
>> exceptionally poor (grammar errors, many omissions, unprofessional
>> writing).
>>
>> Can I use any of Struts 2 AJAX features with a JavaScript library other
>> than
>> Dojo? I have used Prototype/Scriptaculous in the past and it was
>> extremely
>> easy. I'd also be happy with YUI or any other alternative.
>>
>> --
>> View this message in context:
>> http://www.nabble.com/-S2--Do-AJAX-features-work--tf4013653.html#a11398152
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> 
> -- 
> "Hey you! Would you help me to carry the stone?" Pink Floyd
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--Do-AJAX-features-work--tf4013653.html#a11416630
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: [S2] Do AJAX features work?

2007-07-03 Thread Kenton

Of course, I am using the embedded version of Dojo that is served by the
Struts servlet. I didn't modify that.

I was using Dojo downloads in a separate experiment, where I was trying to
get Dojo to work with some static web pages, so that I could understand the
Dojo library and debug the issue.

I tried adding the div tag, but that didn't help. I'm getting the mentioned
errors when I simply load the page. I'm not even to the point of debugging
the the actual AJAX button/link themselves.


Jeromy Evans - Blue Sky Minds wrote:
> 
> 
>>  
> The submit won't work because "div1" doesn't exist.  The  should 
> work though.
> 
> I don't recognise the error messages you're getting.  If you're 
> installed an copy of Dojo, remove it and use the version shipped within 
> struts.  You can't use the struts tags with dojo 0.9.
> The basic examples on the wiki all still work in IE and FF, I tried them 
> all again just recently.
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--Do-AJAX-features-work--tf4013653.html#a11416558
Sent from the Struts - User mailing list archive at Nabble.com.


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



[S2] Do AJAX features work?

2007-07-02 Thread Kenton

Struts: 2.0.8
Browser: Firefox 2.0.0.4
App Server: Glassfish v2 beta 2
OS: Windows XP SP2

I'm trying to add some simple AJAX functionality to my Struts 2 application.

I've copy/pasted a few snippets from the Struts 2 documentation. I've tried
several variations on this:


Test





This is a test page





Submit form




When I try this, I see the following in my browser: 

DEBUG:  dojo.widget.Parse: error:TypeError: impl is not a constructor
DEBUG:  dojo.widget.Parse: error:TypeError: impl is not a constructor

I also see this in the Firefox JavaScript error console:

Error: uncaught exception: [Exception... "Object cannot be created in this
context"  code: "9" nsresult: "0x80530009 (NS_ERROR_DOM_NOT_SUPPORTED_ERR)" 
location: "http://localhost:8080/vgstats/struts/dojo/src/browser_debug.js
Line: 168"]

Anyone have any ideas?

Also, I've tried to get some static web apps working with Dojo in hopes that
I could better understand the Dojo library and possibly debug this. I've
tried both the 0.4.3 and 0.9M2 releases and have had a variety of problems
with both. Also, the online demos are broken and the documentation is
exceptionally poor (grammar errors, many omissions, unprofessional writing).

Can I use any of Struts 2 AJAX features with a JavaScript library other than
Dojo? I have used Prototype/Scriptaculous in the past and it was extremely
easy. I'd also be happy with YUI or any other alternative.

-- 
View this message in context: 
http://www.nabble.com/-S2--Do-AJAX-features-work--tf4013653.html#a11398152
Sent from the Struts - User mailing list archive at Nabble.com.


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



[S1] Properties Argument Question

2007-06-14 Thread Kenton

I'm preparing my Struts app for Internationalization and am moving all
strings to .properties files.

How do I do this:

"/>

Obviously, that doesn't work, but you can probably see what I want to do.
How do I do that?
-- 
View this message in context: 
http://www.nabble.com/-S1--Properties-Argument-Question-tf3923275.html#a11125388
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Requests from a Struts Newbie

2007-05-15 Thread Kenton

Wow, thanks! My apologies, I should have figured that out before posting. But
it works great! Thanks! Nabble is great as well. I couldn't be happier.


Wendy Smoak-3 wrote:
> 
> No, that's XWork 2 code, right where it should be.
> 


Wendy Smoak-3 wrote:
> 
> That's easy... Nabble!  Here's the user list:
> http://www.nabble.com/Struts---User-f206.html
> 

-- 
View this message in context: 
http://www.nabble.com/Requests-from-a-Struts-Newbie-tf3756215.html#a10635400
Sent from the Struts - User mailing list archive at Nabble.com.


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