• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem in relative path in jsp page

 
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am facing problem in defining relative path in jsp pages.

I include the pages using following code.



On my system using eclispe and tomcat 5.5 it is running fine and it is fetching the page.

But when i try to run it on server I mean server of some web hosting copnay I am getting the following error. I tried to correct it but it seems like that The web hosting server dont know the ../.. format.

the error log which i m getting is



My file structure is

WebContent-->tiles
--->pages-->JUnit---> .jsp files
Please help.
[ December 12, 2008: Message edited by: Himanshu Gupta ]
 
Himanshu Gupta
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can someone please help me in this context.
 
Ranch Hand
Posts: 826
Eclipse IDE Oracle Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I do not have much idea but the error says that the container cannot find the path you have specified.
Which is the context root of your application?
 
Himanshu Gupta
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think they have disabled ../.. because of security constraints as if they allow any one can write code to go to its parent directories and can get the details and can delete them or modify them if they have permission. But truly speaking I don't know what the actual thing is?

My pages are in different folders now to bypass this error I can put them all under web-inf but then it will become very hard to manage them.

Do we have some better options?
 
Himanshu Gupta
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sudipto Shekhar:
I do not have much idea but the error says that the container cannot find the path you have specified.
Which is the context root of your application?



The application is running fine in my system. The problem is coming that when the hosting machine sees ../.. it is not going to parent of parent directory. It is trying to use it as complete URL. You may see the error log.
 
sudipto shekhar
Ranch Hand
Posts: 826
Eclipse IDE Oracle Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you tried using tag files?
 
Himanshu Gupta
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not yet. I dont know any specific reason to use tag files as whatever I use I do have to provide the full path to the root folder.
 
sudipto shekhar
Ranch Hand
Posts: 826
Eclipse IDE Oracle Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator



Using standard actions and not directive.
And place the .tag file accordingly in the directory structure.


Hope this helps.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do not ever use page-relative addressing in JSPs. As you have seen, they are fragile and unreliable.

Use server-relative addressing as described in the JSP FAQ on resource URLs.
 
sudipto shekhar
Ranch Hand
Posts: 826
Eclipse IDE Oracle Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Will using the standard actions help in this condition Bear?
 
Himanshu Gupta
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Using this I am getting following error..




Error

 
Himanshu Gupta
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Using server relative URL is easy in terms of importing script files, css and images. It is also working fine in defining href of urls.

But I am not able to solve how to use it in <jsp:include> or <%@ include > .

Can someone help me.


I tried it with c import



the error being shown is




Also i dont understand that why error is shown twice? My tiles folder is in WebContent and it contains the file footer.jsp .
[ December 12, 2008: Message edited by: Himanshu Gupta ]
 
sudipto shekhar
Ranch Hand
Posts: 826
Eclipse IDE Oracle Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Himanshu Gupta:

But I am not able to solve how to use it in <jsp:include> or <%@ include > .

Can someone help me.




I can try.

Can you post your header.jsp code?

 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have to use valid syntax. Please see the JSP FAQ entry for explicit examples.
 
Himanshu Gupta
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can't we use <c:import> to import some page. I am always getting page not found error. Can someone help me that why this error is coming? The file is in the folder tiles which is located in WebContent.

Error log:




Even with the jsp:include I am getting same error.



Error Log:




But when I try this



It is working fine on my system but on webserver(Hosting server) It is not fetching the page and also not showing any error. Only contents are coming with no headers and footers.

I am not able to find that whats the problem? Can someone help me ?
[ December 15, 2008: Message edited by: Himanshu Gupta ]
 
Himanshu Gupta
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To add one more information that when i am viewed the page having following content




Then i am not getting anything. Its all blank.
 
Himanshu Gupta
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks everyone. The problem got solved as it was context path issue. When I was putting everything in the root folder it was not taking any context path. I made a folder and named it as project name and pasted all the project files there. It is working fine.

 
reply
    Bookmark Topic Watch Topic
  • New Topic