Solved

a href link in JSP

Posted on 2007-11-29
7
24,183 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 27

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 27

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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 27

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Had a business requirement to store the mobile number in an environmental variable. This is just a quick article on how this was done.
Check out this step-by-step guide for asking an anonymous question on Experts Exchange.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Suggested Courses

738 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