RE: request.getContextPath();
PostGraduate is still in development, WEB-INF is mapped from the IDE. Anyway, tried the request.getContextPath() on other pages with forms, works well. -Original Message- From: Navjot Singh [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2003 6:31 PM To: Struts Users Mailing List Subject: RE: request.getContextPath(); but this your contextPath. so, request returns that string that you set. Is PostGraduate.war your file name? or in server.xml you have set contextPath=/PostGraduate. navjot |-Original Message- |From: Mohd Amin Mohd Din [mailto:[EMAIL PROTECTED] |Sent: Friday, September 05, 2003 1:44 PM |To: [EMAIL PROTECTED] |Subject: request.getContextPath(); | | |Hi, | |Having a wired problem here. On some of my pages, the |request.getContextPath() works great, but on other pages, it doesn't |seem to work, it only gets the webapp. Eg. |page is in |http://192.168.1.111:8080/PostGraduate/admission/application/listProfil e |Setup |http://192.168.1.111:8080/PostGraduatte/admission/application/listProf i |leSetup i'm only receiving a PostGraduate/ when I do a |request.getContextPath(); | | |Thanks in advance |Amin | | - 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]
request.getContextPath();
Hi, Having a wired problem here. On some of my pages, the request.getContextPath() works great, but on other pages, it doesn't seem to work, it only gets the webapp. Eg. page is in http://192.168.1.111:8080/PostGraduate/admission/application/listProfile Setup http://192.168.1.111:8080/PostGraduatte/admission/application/listProfi leSetup i'm only receiving a PostGraduate/ when I do a request.getContextPath(); Thanks in advance Amin
RE: request.getContextPath();
but this your contextPath. so, request returns that string that you set. Is PostGraduate.war your file name? or in server.xml you have set contextPath=/PostGraduate. navjot |-Original Message- |From: Mohd Amin Mohd Din [mailto:[EMAIL PROTECTED] |Sent: Friday, September 05, 2003 1:44 PM |To: [EMAIL PROTECTED] |Subject: request.getContextPath(); | | |Hi, | |Having a wired problem here. On some of my pages, the |request.getContextPath() works great, but on other pages, it doesn't |seem to work, it only gets the webapp. Eg. |page is in |http://192.168.1.111:8080/PostGraduate/admission/application/listProfile |Setup |http://192.168.1.111:8080/PostGraduatte/admission/application/listProfi |leSetup i'm only receiving a PostGraduate/ when I do a |request.getContextPath(); | | |Thanks in advance |Amin | | - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: request.getContextPath() and Tiles
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]
request.getContextPath() and Tiles
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]
Re: request.getContextPath() and Tiles
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
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
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]
Problem with request.getContextPath
Hi, I have a strange problem with using the follwoing.. bean:page id=req property=request/ bean:define id=path name=req property=contextPath/ in a jsp page to get the contextpath. So that i can do this bean:write name=path/ It is working fine in tomcat3.2 but is giving the following exception in REsin and in Tomcat4.0 javax.servlet.jsp.JspException: No getter method for property contextPath of bean req at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:517) at org.apache.struts.taglib.bean.DefineTag.doStartTag(DefineTag.java:200) at _index__jsp._jspService(/iPort/index.jsp:30) etc Can anyone guide as to where the problem is. If it is still occuring I may have to revert back to java scriplet %=request.getContextPath()% and make my jsp ugly !! Merrill