• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP  RSS feed

 
Amarnath Reddy
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello! sir
I have a basic dought i.e. can we use forward tag to forward control html and Image Files of extension .gif,.mpg etc.
I had been tryied for the bellow code for several days to get it work but i could not.I have 3 files HTML file called Forward.html, JSP file Forward.jsp,and one.gif.If user dosenot enter in the text filed of HTML and submit the same to JSP it should give a HYPERLINK and When some thing filled in the input filed and submit the same to JSP it should froward the control to some other page, here Image1.html.so can u make the correct please.
.................................................................
Forward.html
*************
<FORM name="f" action= "Forward.jsp" >
name:<INPUT TYPE="text" NAME="n1"><br>
<INPUT TYPE="button" name="sub" value="sub" onClick="submit_form()">
<input type='submit' value="submit" >
.................................................................
Forward.jsp
***********
<%! String s=null; %>
<%
s=request.getParameter("n1");
if(s!=null)
{
%>
<jsp:forward page="/Image1.html"/>
<%}
else
{
%>
<a href="http://localhost:8080/Forward.html">back</a>
<%
}
%>
.................................................................
Image1.html
***********
<img src="/one.gif">
.................................................................
 
mohana konakanchi
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I took a pain to test your code.. nothing wrong. everything working fine.
I changes the below line
<a href="http://localhost:8080/Forward.html">back</a>
as <a href="Forward.html">back</a>
Since It is working for me, I could not able to tell you exactly at which phase your getting problem.
try once again with these points in mind.
All HTML files whould have HTML... It means
since JSP file also become a HTML just before displaying
You must add you JSP code under HTML..tags only.
I just this could be the problem
Mohana

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!