You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Thomas Hamacher <th...@qualiads.de> on 2005/11/10 16:48:38 UTC

Struts and displaytag

Hi,

as we had a few display:*-tag questions in here in the last days I wonder if 
anyone found a solution to this problem:

I´m using the display:* together with Struts 1.2.7 and this works quite good 
so far. But I´m experiencing the following problem now:

I´m using a wrapper/decorator to create an image together with a link. But in 
my wrapper-method I can only create a link like this:

return "<a href=\"/context/html/myPage.do\" ...... />

Unfortunately the reference to "myPage" is not relative, so I have to use a 
path. As I don´t want to hardcode this path in my wrapper-class, but use it 
through my struts-config I´d like to use the relevant struts-tag. In this 
case this would be <html:rewrite action="/myPage" /> which returns me the 
correct path regarding the contextURL etc. Unfortunately this <html:rewrite> 
will not be executed if I simply return the struts-tags in my wrapper-class. 
Is there a solution to this problem?

Same thing to this display:*-tag
<display:column valign="top" property="name" ..... 
href="/context/html/myPage.do" />

The href="..." should be replaced by <html:rewrite>. But the struts-tags are 
not allowed within the <display:table>. Does this have anything todo with EL? 
Does anyone has an example for this?

Thank you very much for your help
Thomas



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


AW: Struts and displaytag

Posted by Martin Kindler <ki...@arcor.de>.
Thomas,

in my decorators I typically take the current context path from the
PageContext like this:

	PageContext pc = getPageContext();
	HttpServletRequest request = (HttpServletRequest)pc.getRequest();
	String contextPath = request.getContextPath();

Martin

> -----Ursprüngliche Nachricht-----
> Von: Thomas Hamacher [mailto:tha@qualiads.de] 
> Gesendet: Donnerstag, 10. November 2005 16:49
> An: Struts Users Mailing List
> Betreff: Struts <html:rewrite> and displaytag
> 
> 
> Hi,
> 
> as we had a few display:*-tag questions in here in the last 
> days I wonder if 
> anyone found a solution to this problem:
> 
> I´m using the display:* together with Struts 1.2.7 and this 
> works quite good 
> so far. But I´m experiencing the following problem now:
> 
> I´m using a wrapper/decorator to create an image together 
> with a link. But in 
> my wrapper-method I can only create a link like this:
> 
> return "<a href=\"/context/html/myPage.do\" ...... />
> 
> Unfortunately the reference to "myPage" is not relative, so I 
> have to use a 
> path. As I don´t want to hardcode this path in my 
> wrapper-class, but use it 
> through my struts-config I´d like to use the relevant 
> struts-tag. In this 
> case this would be <html:rewrite action="/myPage" /> which 
> returns me the 
> correct path regarding the contextURL etc. Unfortunately this 
> <html:rewrite> 
> will not be executed if I simply return the struts-tags in my 
> wrapper-class. 
> Is there a solution to this problem?
> 
> Same thing to this display:*-tag
> <display:column valign="top" property="name" ..... 
> href="/context/html/myPage.do" />
> 
> The href="..." should be replaced by <html:rewrite>. But the 
> struts-tags are 
> not allowed within the <display:table>. Does this have 
> anything todo with EL? 
> Does anyone has an example for this?
> 
> Thank you very much for your help
> Thomas
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org