Solved

a href link in JSP

Posted on 2007-11-29
7
23,218 Views
Last Modified: 2010-05-18
I'm just learning JSP and I have a simple problem, how can I create a link.
This is part of a left menu that is suppose to link to a different page.
<A HREF="<%= PMPage.jsp %>" style="text-decoration:none" class="A">PARK</a>
0
Comment
Question by:aentice
  • 3
  • 3
7 Comments
 
LVL 26

Expert Comment

by:mrcoffee365
ID: 20376979
Do you mean that you want the link to go to PMPage.jsp ?  Then it should be a normal url:

<A HREF="PMPage.jsp" style="text-decoration:none" class="A">PARK</a>

0
 

Author Comment

by:aentice
ID: 20377137
I had it initially that way, but doesn't work. If I try Park/PMPage.jsp
Here's how my folder looks like:
TESTWEB
   WebContent
     images
     Park
        PMpage.jsp
     Web-INF
        LeftMenu.jsp
        main.jsp
0
 
LVL 26

Expert Comment

by:mrcoffee365
ID: 20377279
Then it looks as if your URL is wrong.

where does your Web app start?  If it's the WebContent directory, then your url should be
/Park/PMpage.jsp -- notice that you're spelling it wrong, too, if the latest post is correct.  If the file is PMpage.jsp, then PMPage.jsp will not exist.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:aentice
ID: 20377336
I tried that too. When I add /Park/PMpage.jsp the link becomes Park/Park/PMPage.jsp instead to just one Park it becomes 2.
0
 

Author Comment

by:aentice
ID: 20377572
I tried one that worked, but it should not be done this way. I moved the page under WEB-INF and mixed it together with the other pages, it seems like it cannot find the Park folder and I'm not sure how the structure works.
0
 
LVL 26

Accepted Solution

by:
mrcoffee365 earned 500 total points
ID: 20379217
Okay -- the good news is that you now have a URL you can use to reference your JSP pages.

Now it sounds as if you need to figure out what your Web site structure is so that you can make URLs that refer to other files (not in WEB-INF).

Are you able to retrieve the files in your/Park/images directory?  If so, what do those URLs look like?

If href="/Park/PMPage.jsp" turns into "/Park/Park/PMPage.jsp" then there could be several things going on.

1) /Park is the location of your web app under http://mydomain.com, so that all of your webapp is http://mydomain.com/Park/something

2) You have a base directory declared in the HTML of your page, and that base directory is /Park.

Other things might cause what you're seeing, too , but these are the ones that occur to me.

If /Park is prefixed to all of your URLs, then did you try
href="/PMPage.jsp"
0
 
LVL 11

Expert Comment

by:Manish
ID: 20379787
check you context root in ear.
add context root to jsp path
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Short answer to this question: there is no effective WiFi manager in iOS devices as seen in Windows WiFi or Macbook OSx WiFi management, but this article will try and provide some amicable solutions to better suite your needs.
Is your company's data protection keeping pace with virtualization? Here are 7 dynamic ways to adapt to rapid breakthroughs in technology.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now