That worked!
Main Topics
Browse All TopicsHello,
This is a pretty easy question for anyone who knows the answer. Basically, I'm building an web page using JSP. An anchor is set at the top of the page and I need to change what that is pointing to (href) based on a variable at the bottom of the program. How do I use jsp to reference an anchor tag that's located elsewhere in the program?
Thanks!
John
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: gagaliyaPosted on 2004-11-19 at 10:13:48ID: 12628116
not clear what you mean exactly. but you cannot directly do it in 1 jsp using java as html are generated sequentially on serverside and once generated cannot be changed by serverside jsp. Two options
oading please wait.... %>
jsptwo.jsp ?variablet opass=<%=y our_variab le%>"; ;
ter("varia bletopass" )%>">ancho r or whatever </a> -
option 1) have two jsp, passing the variable from one to another using form. something like:
jspone:
<html><head></head><body>L
.....
<%String your_variable="somevalue";
<script type="text/javascript">
document.testform.action="
document.testform.submit()
</script>
<form method="get" id="testform">
........
</form>
</body></html>
jsptwo: this is your real jsp that is shown to the user
.......
<a href="<%=request.getParame
...........
--------------------------
option2) use javascript, set one of the javascript variable to a jsp/java variable at the bottom of your jsp. then you can use javascript to manipulate what the html is pointing to on the client side.
gaga