• Post Reply Bookmark Topic Watch Topic
  • New Topic

Calling jsps  RSS feed

 
Paulo Aquino
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You see i have jsp file named cy-tables-pages.jsp. I want it to call itself using href:

<a href="cy-table-pages.jsp?currentPage=" + '<%=i%>' > <%=i%> </a>

i is defined as an integer of any number. I'm just calling a certain page number. The problem is when I execute this the page is prompting for a Download File Box asking me if I want to download cy-table-pages.jsp. Why is this so? How can I make my jsp accept the currentPage attribute?
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what webserver are you using?
 
Paulo Aquino
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomcat 4, any ideas?
[ June 11, 2004: Message edited by: Paulo Aquino ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66154
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do a View Source on the page containing your anchor tag. If the code you showed is really what you've got on the page, the tag will not be well-formed.
 
Paulo Aquino
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bear Bibeault:
Do a View Source on the page containing your anchor tag. If the code you showed is really what you've got on the page, the tag will not be well-formed.


so what should be the format? im confused on when to use ' ' and " "
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66154
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does it look like well-formed html? Is the URL valid?
[ June 11, 2004: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66154
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hint: since this is template text, why are you using the '+' operator at all?
 
Ivan Jouikov
Ranch Hand
Posts: 269
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<a href="cy-table-pages.jsp?currentPage=" + '<%=i%>' > <%=i%> </a>

should be

<a href="cy-table-pages.jsp?currentPage=<%=i%>"> <%=i%> </a>

what you're trying to do is add one string "cy-tables.." to another '<%=i%>'. But this won't happen because its a JSP file, and its statis content won't get parsed and evaluated as strings. Look at the source of produced HTML, and see all the mess you get.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66154
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, Ivan that was exactly my point. Looking at the rendered HTML would have shown Paulo that the URL was a mess. And my hint about using the '+' should have shown him where the problem lay. But I was trying to get him to work it out for himeself which would have taught him more than just giving him the answer.
 
Paulo Aquino
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thnaks guys for the help now i have another problem

whats wrong with my jsp page? the filename is cy-table-pages.jsp.





When I click on one of the hyper link, the download page is displayed. Why is this so? I find it weird and Im confused. Please help. All I want is to get the parameter that Im passing into it.



[ June 13, 2004: Message edited by: Paulo Aquino ]
[ June 13, 2004: Message edited by: Paulo Aquino ]
 
Paulo Aquino
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Paulo Aquino:
Thnaks guys for the help now i have another problem

whats wrong with my jsp page? the filename is cy-table-pages.jsp.





When I click on one of the hyper link, the download page is displayed. Why is this so? I find it weird and Im confused. Please help. All I want is to get the parameter that Im passing into it.



[ June 13, 2004: Message edited by: Paulo Aquino ]

[ June 13, 2004: Message edited by: Paulo Aquino ]



Hi guys any idea? What Am I missing here?
 
saravanan balu
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
one more clarification, might not be the answer for your problem, request.getParameter("something") will return a string, why do you wanna typecast again to String??
 
Paulo Aquino
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I already got it! This was the culprit.
<%@ page language="java" contentType="text/html'charset=UTF-8" %>
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!