Re: request.getContextPath() and Tiles

2002-12-18 Thread Susan Bradeen
snip
 
  using the requestURI='request.getContextPath().concat(/showlist.do)'
  gets me closer, but still not quite there.
 
 
 I can get around this by hard coding myModule into the path, such as 
...
 
 requestURI='request.getContextPath().concat(/myModule/showlist.do)'
 
 and the links are built properly, but I'd rather not do this. If there 
was
 a way to dynamically
 retrieve the application module prefix, I could get around hard coding.
 

I have resolved the hard coding of the module path by doing the 
following ...

In the action, set the module-relative path in a request attribute:

public ActionForward execute(...) throws Exception {
...
/*Build a module-relative path that Display tags can use for html:link 
href= parameter.*/
ModuleConfig mc = (ModuleConfig) 
request.getAttribute(Globals.MODULE_KEY);
request.setAttribute(linkPath, 
request.getContextPath().concat(mc.getPrefix()));
return mapping.findForward(success);

}

then in the JSP retrieve the path attribute and add on the action ...

requestURI='%=((String)request.getAttribute(linkPath)).concat(/showlist.do)%'


There is probably a better way to do this, but this seems to work.

Susan Bradeen

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




Re: request.getContextPath() and Tiles

2002-12-17 Thread Cedric Dumoulin

 What URL do you use to call the page or action in which you do the 
request.getContextPage() ?

  Cedric

Susan Bradeen wrote:

This is exactly what I am trying to do ...

http://www.mail-archive.com/struts-user@jakarta.apache.org/msg37691.html

I would like to set 
requestURI='request.getContextPath().concat(/something.do)'
however, my request.getContextPath() is not including my module in that 
path. 

For example, I am getting ...
   http://localhost/myWebApp/myAction.do
instead of ...
   http://localhost/myWebApp/myModule/myAction.do

Tiles is working perfectly for all Action links (html:link 
page=/myAction.do), 
but for two html:link href=... links I am trying to set up, I can't 
get the correct path. 

All suggestions are greatly appreciated.

Thanks,
Susan Bradeen

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


 



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




Re: request.getContextPath() and Tiles

2002-12-17 Thread Susan Bradeen
Hi Cedric,

Currently, I am using an html:link from a simple navigation bar JSP tile 
to get to this page.
 
   snip from navbar.jsp
   tdhtml:link page=/showlist.dobean:message key=main.list//html:link/td
   /snip

which correctly becomes:
   snip
   tda href=/myWebApp/myModule/showlist.doView List/a/td
   /snip

Without Tiles my display tag was:
   snip from showList.jsp
   display:table name=myform property=myList pagesize=15 
requestURI=showlist.do
   /snip

which creates a link of:
   snip
   a href=showrequests.do?page=22/a
   /snip

and with Tiles, this gives me the URL of:
http://localhost/myWebApp/myModule/tiles/layout/showlist.do?page=2;

using the requestURI='request.getContextPath().concat(/showlist.do)' 
gets me closer, but still not quite there.

Tiles definitions 

definition name=.showList  extends=.navbarBase
put name=title value=View List/
put name=content value=/myModule/showList.jsp/
/definition

definition name=.navbarBase path=/myModule/tiles/layouts/navbarBase.jsp
put name=title value=${title}/
put name=header value=/myModule/tiles/header.jsp/
put name=navbar value=/myModule/tiles/navbar.jsp/
put name=content value=${content}/
put name=footer value=/myModule/tiles/footer.jsp/
/definition

Action definition -

action
path=/showlist
type=com.my.company.actions.ShowListAction
name=myform
scope=request
validate=false
forward name=success path=.showList/
/action

This is more information than you asked for, but hope it helps. Thanks for 
your response.

Susan Bradeen

On 12/17/2002 12:30:51 PM Cedric Dumoulin wrote:

 What URL do you use to call the page or action in which you do the
 request.getContextPage() ?
 
 Cedric
 
 Susan Bradeen wrote:
 
 This is exactly what I am trying to do ...
 
 
http://www.mail-archive.com/struts-user@jakarta.apache.org/msg37691.html
 
 I would like to set
 requestURI='request.getContextPath().concat(/something.do)'
 however, my request.getContextPath() is not including my module in 
that
 path.
 
 For example, I am getting ...
 http://localhost/myWebApp/myAction.do
  instead of ...
 http://localhost/myWebApp/myModule/myAction.do
 
 Tiles is working perfectly for all Action links (html:link
 page=/myAction.do),
 but for two html:link href=... links I am trying to set up, I can't
 get the correct path.
 
 All suggestions are greatly appreciated.
 
 Thanks,
 Susan Bradeen
 
 --
 To unsubscribe, e-mail: 
mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: 
mailto:[EMAIL PROTECTED]
 
 
 
 
 
 
 --
 To unsubscribe, e-mail: 
mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: 
mailto:[EMAIL PROTECTED]
 

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




Re: request.getContextPath() and Tiles

2002-12-17 Thread Susan Bradeen
Please see below ...

On 12/17/2002 02:12:23 PM Susan Bradeen wrote:

 Hi Cedric,
 
 Currently, I am using an html:link from a simple navigation bar JSP 
tile
 to get to this page.
 
 snip from navbar.jsp
 tdhtml:link page=/showlist.dobean:message 
 key=main.list//html:link/td
 /snip
 
 which correctly becomes:
 snip
 tda href=/myWebApp/myModule/showlist.doView List/a/td
 /snip
 
 Without Tiles my display tag was:
 snip from showList.jsp
 display:table name=myform property=myList pagesize=15 
 requestURI=showlist.do
 /snip
 
 which creates a link of:
 snip
 a href=showrequests.do?page=22/a
 /snip
 
 and with Tiles, this gives me the URL of:
 http://localhost/myWebApp/myModule/tiles/layout/showlist.do?page=2;

which needs to be http://localhost/myWebApp/myModule/showlist.do?page=2;
in order to work.

 
 using the requestURI='request.getContextPath().concat(/showlist.do)'
 gets me closer, but still not quite there.


I can get around this by hard coding myModule into the path, such as ...

requestURI='request.getContextPath().concat(/myModule/showlist.do)'

and the links are built properly, but I'd rather not do this. If there was 
a way to dynamically
retrieve the application module prefix, I could get around hard coding.

 Any html:link using a page= attribute creates a Tiles link/Action path 
correctly 
and works great. Unfortunately, the Display tag library makes use of 
href= attribute.

Thanks again for your help.
Susan Bradeen

 
 Tiles definitions 
 
 definition name=.showList  extends=.navbarBase
 put name=title value=View List/
 put name=content value=/myModule/showList.jsp/
 /definition
 
 definition name=.navbarBase 
path=/myModule/tiles/layouts/navbarBase.jsp
 put name=title value=${title}/
 put name=header value=/myModule/tiles/header.jsp/
 put name=navbar value=/myModule/tiles/navbar.jsp/
 put name=content value=${content}/
 put name=footer value=/myModule/tiles/footer.jsp/
 /definition
 
 Action definition -
 
 action
 path=/showlist
 type=com.my.company.actions.ShowListAction
 name=myform
 scope=request
 validate=false
 forward name=success path=.showList/
 /action
 
 This is more information than you asked for, but hope it helps. Thanks 
for
 your response.
 
 Susan Bradeen
 
 On 12/17/2002 12:30:51 PM Cedric Dumoulin wrote:
 
  What URL do you use to call the page or action in which you do the
  request.getContextPage() ?
 
  Cedric
 
  Susan Bradeen wrote:
 
  This is exactly what I am trying to do ...
  
 
 
http://www.mail-archive.com/struts-user@jakarta.apache.org/msg37691.html
  
  I would like to set
  requestURI='request.getContextPath().concat(/something.do)'
  however, my request.getContextPath() is not including my module in
 that
  path.
  
  For example, I am getting ...
  http://localhost/myWebApp/myAction.do
   instead of ...
  http://localhost/myWebApp/myModule/myAction.do
  
  Tiles is working perfectly for all Action links (html:link
  page=/myAction.do),
  but for two html:link href=... links I am trying to set up, I 
can't
  get the correct path.
  
  All suggestions are greatly appreciated.
  
  Thanks,
  Susan Bradeen
  
  --
  To unsubscribe, e-mail:
 mailto:[EMAIL PROTECTED]
  For additional commands, e-mail:
 mailto:[EMAIL PROTECTED]
  
  
  
  
 
 
  --
  To unsubscribe, e-mail:
 mailto:[EMAIL PROTECTED]
  For additional commands, e-mail:
 mailto:[EMAIL PROTECTED]
 
 
 --
 To unsubscribe, e-mail: 
mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: 
mailto:[EMAIL PROTECTED]
 

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