Re: problems nesting TileResults....

2008-05-13 Thread Darren James

Hi Antonio,

I got a 2.0.6 snapshot and the issue is fixed!  Thanks much for the 
tip.  Also noteworthy is that
now that I have actions that can forward to tiles which have nested 
within them actions that also
forward to tiles (whew), in order for action context to be available to 
JSP pages I had to follow
the steps to include the struts-cleanup filter in web.xml.  The docs on 
the struts2 site say that this
filter is solely for the purpose of sitemesh integration, but apparently 
it's beneficial to tiles

integration as well

thanks again,

- Darren.

Antonio Petrelli wrote:

2008/5/13 Darren James [EMAIL PROTECTED]:
  

i downloaded the 2.0.5 version of tiles, and i see the same issue
 seems to be a pretty severe limitation of tiles



It's not a limitation, it's a bug :-)
https://issues.apache.org/struts/browse/TILES-232

Try using the SVN version of Tiles (branch: TILES_2_0_X):
http://svn.apache.org/repos/asf/tiles/framework/branches/TILES_2_0_X/
Or you can use the 2.0.6 snapshots:
http://people.apache.org/repo/m2-snapshot-repository/org/apache/tiles/

Antonio

-
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: problems nesting TileResults....

2008-05-12 Thread Darren James

sorry

struts 2.0.11, and the tiles bundled with that version, which is tiles 2.0.4

thx,

- darren

Antonio Petrelli wrote:

Version of Struts and Tiles?

Antonio

2008/5/9 Darren James [EMAIL PROTECTED]:
  

Hello All,

I have a flow that is basically a toplevel struts2 action having a result of
type TilesResult.  That tile
result has as one if it's attributes another struts2 action that also has a
result of type TilesResult.
So my tiles.xml looks like this (I've changed names and attributes to try to
simplify the example
as much as possible)

  definition name=pageLevelTile extends=somePageLevelTemplate
  put-attribute name=header   value=/WEB-INF/tiles/pages/header.jsp
/
  put-attribute name=body value=/findTileBody.action /
  /definition


  definition name=moduleLevelTile extends=someModuleTemplate
   stuff
   /definition

---

So i have an action, call it showPage.action that forwards to pageLevelTile,
then
within pageLevelTile the body attribute invokes the action
findTileBody.action
that eventually forwards to the moduleLevelTile.

The issue with this is the browser only renders the moduleLevelTile (all the
surrounding page-level stuff gets wiped out for some reason), and I'm seeing
this
exception:

-
SEVERE: Servlet.service() for servlet default threw exception
java.io.IOException: Error including path
'/WEB-INF/tiles/templates/yuiDocTemplate.jsp'.
java.lang.IllegalStateException: Exception occurred when flushing data
  at
org.apache.tiles.servlet.context.ServletTilesRequestContext.forward(ServletTilesRequestContext.java:201)
  at
org.apache.tiles.servlet.context.ServletTilesRequestContext.dispatch(ServletTilesRequestContext.java:185)
  at
org.apache.tiles.context.TilesRequestContextWrapper.dispatch(TilesRequestContextWrapper.java:72)
  at
org.apache.struts2.tiles.StrutsTilesRequestContext.dispatch(StrutsTilesRequestContext.java:86)
  at
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:417)
  at
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:368)
  at
org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:104)
  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.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:170)
  at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
-

Any ideas?

thanks much,

- darren.





-
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]



Re: problems nesting TileResults....

2008-05-12 Thread Darren James

i downloaded the 2.0.5 version of tiles, and i see the same issue
seems to be a pretty severe limitation of tiles

- darren.

Antonio Petrelli wrote:

2008/5/12 Darren James [EMAIL PROTECTED]:
  

struts 2.0.11, and the tiles bundled with that version, which is tiles 2.0.4



Please try updating to Tiles 2.0.5:
http://tiles.apache.org/download.html

Antonio

-
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]



problems nesting TileResults....

2008-05-09 Thread Darren James

Hello All,

I have a flow that is basically a toplevel struts2 action having a 
result of type TilesResult.  That tile
result has as one if it's attributes another struts2 action that also 
has a result of type TilesResult.
So my tiles.xml looks like this (I've changed names and attributes to 
try to simplify the example

as much as possible)

   definition name=pageLevelTile extends=somePageLevelTemplate
   put-attribute name=header   
value=/WEB-INF/tiles/pages/header.jsp /

   put-attribute name=body value=/findTileBody.action /
   /definition


   definition name=moduleLevelTile extends=someModuleTemplate
    stuff
/definition

---

So i have an action, call it showPage.action that forwards to 
pageLevelTile, then
within pageLevelTile the body attribute invokes the action 
findTileBody.action

that eventually forwards to the moduleLevelTile.

The issue with this is the browser only renders the moduleLevelTile (all 
the
surrounding page-level stuff gets wiped out for some reason), and I'm 
seeing this

exception:

-
SEVERE: Servlet.service() for servlet default threw exception
java.io.IOException: Error including path 
'/WEB-INF/tiles/templates/yuiDocTemplate.jsp'. 
java.lang.IllegalStateException: Exception occurred when flushing data
   at 
org.apache.tiles.servlet.context.ServletTilesRequestContext.forward(ServletTilesRequestContext.java:201)
   at 
org.apache.tiles.servlet.context.ServletTilesRequestContext.dispatch(ServletTilesRequestContext.java:185)
   at 
org.apache.tiles.context.TilesRequestContextWrapper.dispatch(TilesRequestContextWrapper.java:72)
   at 
org.apache.struts2.tiles.StrutsTilesRequestContext.dispatch(StrutsTilesRequestContext.java:86)
   at 
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:417)
   at 
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:368)
   at 
org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:104)
   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.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:170)
   at 
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)

-

Any ideas?

thanks much,

- darren.





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



Re: About OGNL multi-threading contention

2008-04-24 Thread Darren James
actually struts is currently using ongl 2.6.11 correct? In fact the 
problem that you reference
here http://jira.opensymphony.com/browse/OGNL-141, seems to indicate it 
was the 2.6.11

version of the OGNL jar that introduced the problem. Can someone verify?

I would second the idea that this is a very important issue for my 
project.
Not sure if this is the appropriate forum to raise this issue, but I 
desperately need a patch.


Does anyone know if downgrading to OGNL-2.6.10 would solve the problem? 
Looking
at the sources the synchronization on the method object in the 
OgnlRuntime.invokeMethod

seems to be the only difference between the two versions...

thanks,

- darren

Telmo Costa wrote:


Hello,

We’ve been testing an application in a production environment and 
found a serious contention problem when the number of simultaneous 
requests grows. The problem seems to be related with the use of static 
synchronized blocks in OGNL code.


I’ve found a related issue in OGNL 
(http://jira.opensymphony.com/browse/OGNL-141) that is already fixed 
in version 2.7.2. But, another related issue 
(http://jira.opensymphony.com/browse/OGNL-10) is still open, although 
it already has a patch.


Does anyone know when Struts2 team is upgrading the OGNL version? 
Currently struts2 uses OGNL version 2.6.10.


This is a very important issue for my project, as it receives millions 
of requests per day.


Greetings,

/Telmo Costa/

cid:image001.jpg@01C7FEB5.16BC8DE0

EF - Tecnologias de Software, S.A.

Portugal



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



Re: freemaker model population

2008-02-28 Thread Darren James
Sorry for the confusing question.  I tried this again and it seemed to 
work fine
(i.e. accessing objects that are not on the top of the value stack via 
ognl expressions

via the ${foo} syntax in freemarker templates)

However, I did find a couple of places where I had to use the struts 
property tag

instead. For example

s:set name=foo value=bar.baz/

I could not use ${#foo}, I had to use s:property value=#foo/.

Are there any other gotchas with ${} vs. s:property value=/

thanks peeps,

- darren.


Darren James wrote:

Hi all,

I'm fairly new to freemarker, and just started using in in the context 
of a struts2

component tag.  I was noticing that it seems like you can do this

 ${foo.bar}

anywhere in the template (vs. using the s.property tag), *but* only when
the top object on the value stack is the object with property foo.
so my question is, how does struts populate freemarker's model, 
and is there

a way to make ${foo.bar} be evaluated in the context of any object on the
value stack.

thanks,

- darren.

-
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]



freemaker model population

2008-02-27 Thread Darren James

Hi all,

I'm fairly new to freemarker, and just started using in in the context 
of a struts2

component tag.  I was noticing that it seems like you can do this

 ${foo.bar}

anywhere in the template (vs. using the s.property tag), *but* only when
the top object on the value stack is the object with property foo. 

so my question is, how does struts populate freemarker's model, and 
is there

a way to make ${foo.bar} be evaluated in the context of any object on the
value stack.

thanks,

- darren.

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



Re: tag writers resources?

2008-01-28 Thread Darren James

Hi Joachim,

This gives me something to start with.   Time to dig into the struts2
source code to help me grok the sample you've provided.

thanks,

- Darren.

Joachim Ansorg wrote:


Hi Darren,
writing a simple Struts2 tag is not that difficult. But getting 
started is.

The documentation of the tag api is not very good, imho. The best start
is in my opinion to get the Struts2 sources and read the source code of
the existing struts2 tags.

I'm posting a simple example with this mail so it's in the archives for
anybody. A tag writers guide would be a very useful resource for S2 users.

For a S2 body you basically need:

-A JSP tag implementation. e.g.:

public class NameValueTag extends AbstractUITag{
private String editMode;

public Component getBean(ValueStack valueStack, HttpServletRequest
httpServletRequest, HttpServletResponse httpServletResponse) {
return new NameValue(valueStack, httpServletRequest,
httpServletResponse);
}

protected void populateParams() {
super.populateParams();
((NameValue) component).setEditMode(editMode);
}

public String isEditMode() {
return editMode;
}

public void setEditMode(String editMode) {
this.editMode = editMode;
}
}

-A Struts2 component which is used by Struts. The JSP tags sets the
attributed on the component. The annotations are later used for
automatic .tld generation. I'm using Maven for that.

@StrutsTag(name = nameValue, description = Inserts a formatted
name-value html code construct., tldTagClass =
gr.ksi.tags.ksiplugin.views.jsp.NameValueTag)
public class NameValue extends ClosingUIBean {
private String editMode;

public NameValue(ValueStack valueStack, HttpServletRequest
httpServletRequest, HttpServletResponse httpServletResponse) {
super(valueStack, httpServletRequest, httpServletResponse);
}

public String getDefaultOpenTemplate() {
return ksinamevalue;
}

protected String getDefaultTemplate() {
return ksinamevalue-end;
}

@StrutsTagAttribute(description = Set to true to display edit boxes
instead of text labels., required = false, type = Boolean)
public void setEditMode(String editMode) {
this.editMode = editMode;
}

public String isEditMode() {
return editMode;
}

protected void evaluateExtraParams() {
if (editMode != null) {
addParameter(editMode, findValue(editMode, Boolean.class));
}
}
}

And you need Freemarker templates which render the html. Have a look at
the getDefaultTemplate() and getDefaultOpenTemplate() methods above.
These point to the corresponding freemarker templates.
The open template in this example is:

[#ftl]
[#if parameters.editMode?exists  parameters.editMode == true]
div class=name_value_edit
span class=name
[#if parameters.label?exists] [EMAIL PROTECTED]
value=parameters.label /] [/#if]
/span
span class=value
[#else]
div class=name_value
span class=name
[#if parameters.label?exists] [EMAIL PROTECTED]
value=parameters.label /] [/#if]
/span
span class=value
[/#if]

The closing template is just:
[#ftl]
/ul

The rendered body is put in between.

These examples are a full implementation of a S2 tag.
If you want to place custom actions before and after the body rendering
I think overriding ClosingUIBean.start and ClosingUIBean.end (don't
remember the right name atm).

Hope that helps,
Joachim
 Hi All,

 Does anyone (know of/have any) resources that cover writing a tag?
 I want to write a struts2 body tag that sets some applications specific
 state before it emits it's body, and clears the state once the body has
 been emitted.  Any tag-writers guides out there???

-
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: [struts] tag writers resources?

2008-01-28 Thread Darren James

Hi Dale,

Yes, i'm familiar with writing JSP tags, although it's been quite
some time since i've done so.  It took me about 1/2 an hour to
dust off the cobwebs and write a JSP tag extending BodyTagSupport
that did what I wanted it to do.

What I was more interested in is some guidelines similar to what Joachim
posted in writing a struts2 tag.  And by that I mean one of those generic,
technology independent beasts that can be used in Freemarker and Velocity
as well as JSP.

thanks,

- Darren.

Dale Newfield wrote:


Joachim Ansorg wrote:
 writing a simple Struts2 tag is not that difficult.

A Tag is simply a java interface:
http://java.sun.com/javaee/5/docs/api/javax/servlet/jsp/tagext/Tag.html

The life cycle of a tag is discussed in that javadoc.

There are a number of classes that make implementing your own pretty
straight forward.  You'll probably be interested in BodyTagSupport.

-Dale

-
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]



tag writers resources?

2008-01-24 Thread Darren James

Hi All,

Does anyone (know of/have any) resources that cover writing a tag?
I want to write a struts2 body tag that sets some applications specific
state before it emits it's body, and clears the state once the body has
been emitted.  Any tag-writers guides out there???


thanks in advance,

- darren.

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



Re: including the output of an action execution in a servlet response.

2008-01-23 Thread Darren James
I finally found the answer for any that are interested.  servlet filters 
apparently don't
trigger (by default) on forwarded and included requests.  I had to 
change my filter url

mapping in web.xml to make the struts2 filter fire

from:

   filter-mapping
   filter-namestruts2/filter-name
   url-pattern/*/url-pattern
   /filter-mapping

to:

   filter-mapping
   filter-namestruts2/filter-name
   url-pattern/*/url-pattern
   dispatcherREQUEST/dispatcher
   dispatcherFORWARD/dispatcher
   dispatcherINCLUDE/dispatcher
   /filter-mapping


cheers,

- darren.


Darren James wrote:

Hi all,

I have a servlet that I want to include the result of a struts2 action 
in the

response. I have a method that's called from my servlet's doGet method,
which does something along the lines of

   .
   RequestDispatcher requestDisp = 
getServletContext().getRequestDispatcher(/somepackage/ExampleAction.action); 


   requestDisp.include(request, response);
   .


When I invoke the action directly from the browser (i.e. 
http://myhost/somePackage/ExampleAction.action ), it works
just fine.  When trying to invoke the action out of the servlet with 
RequestDispatcher.include(), I get a message in

the response where the output should be that reads

The requested resource (/somePackage/ExampleAction.action) is not 
available.


I can't find what's generating this message, and it's not clear to me 
why my action isn't being invoked.
I'm fairly certain I'm doing something stupid, but it's not obvious to 
me yet.  Any ideas?


thanks in advance,

- Darren.

-
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]



including the output of an action execution in a servlet response.

2008-01-22 Thread Darren James

Hi all,

I have a servlet that I want to include the result of a struts2 action 
in the

response. I have a method that's called from my servlet's doGet method,
which does something along the lines of

   .
   RequestDispatcher requestDisp = 
getServletContext().getRequestDispatcher(/somepackage/ExampleAction.action);

   requestDisp.include(request, response);
   .


When I invoke the action directly from the browser (i.e. 
http://myhost/somePackage/ExampleAction.action ), it works
just fine.  When trying to invoke the action out of the servlet with 
RequestDispatcher.include(), I get a message in

the response where the output should be that reads

The requested resource (/somePackage/ExampleAction.action) is not 
available.


I can't find what's generating this message, and it's not clear to me 
why my action isn't being invoked.
I'm fairly certain I'm doing something stupid, but it's not obvious to 
me yet.  Any ideas?


thanks in advance,

- Darren.

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



question about interceptors

2008-01-15 Thread Darren James

Hi all,

I'm new to struts2 and have some questions about configuring Interceptors.

If your action does not define an interceptor does it get the default 
one (i.e. defaultStack)?


e.g.
   action name=MyAction class=   // does this action get 
the struts2 default interceptor stack

   result/myAction.jsjp/result
   /action

also, if your action *does* define an interceptor, does that augment the 
default one or override it?


e.g.
   action name=MyAction class=...
   interceptor-ref name=myinterceptor/  // do i get 
defaultStack, or did i just override it?

   result/myAction.jsp/result
   /action


thanks,

- darren.


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



i want to use the source luke.

2008-01-15 Thread Darren James


I recently downloaded the 2.0.11 distribution, and was able to find the 
sources to
all of the java classes under the org.apache.struts2.*.  However, i 
did not see
the source for any of the com.opensymphony.xwork2.* classes.  Is the 
source

for these classes available?

thanks in advance,

- darren.

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