Switch to full style
What's behind JSP & Servlets
Post a reply

jsp include directive not working

Sun Jan 09, 2011 2:28 pm

hi....any one help regarding this code...
i used <%@include file=" "%> directive code..the code is executing well...but this include code nt working i.e it is nt executing..but simple code with include working well
plz plz any one provide me the solution very soon


Code:
<%@ page import="java.sql.*" %>
<%@ 
page import="java.io.*" %>
<
body bgcolor=568945>
<
center><span style="background-color:green;font-size:45;border-style:solid;">Virtual Medical Home</h1></span></center>
<%!
 
String funame,query;
String fpwd;
 
Connection con;
 
Statement st;
 
ResultSet rs;
%>
<%
        
funame=request.getParameter("uname");
        
fpwd=request.getParameter("pwd");
                
    
        try
            {
                Class.
forName("sun.jdbc.odbc.JdbcOdbcDriver");
                
con=DriverManager.getConnection("Jdbc:Odbc:vmh");
                
st=con.createStatement();
                
query="select * from login where uid='"+funame+"' and pwd='"+fpwd+"' ";
                
rs=st.executeQuery(query);
        

                if(
rs.next())
               {
String role=rs.getString(3);

%>
                    
                    <
h1>WelCome <font face="Comic Sans MS" color=purple><%=rs.getString(1)%></font></h1>
<%
session.setAttribute("funame"funame);
session.setAttribute("role"role);
%>
<%
if(
funame.equals("patient"))
{
%>
<%@include 
file="patientpage.html"%>
<%
}
else if(
funame.equals("admin"))
{

%>
<%@include 
file="adminpage.html"%>
<%
}
%>

<%
                }
                else
                {
        
                    %>
                    <
h1><%=funame%> Invalid User</h1>
                   <%
                }
        } 
    catch(
Exception e)
              {
               
out.println(e);
            }%>

</
body



Last edited by saics on Sun Jan 09, 2011 4:47 pm, edited 1 time in total.

Re: jsp include directive not working

Sun Jan 09, 2011 3:52 pm

how not working ??? <%@include %> should be working !? are u sure of the file path.

Re: jsp include directive not working

Sun Jan 09, 2011 4:46 pm

ya sure the file path is correcet...
and i test a simple code with <%@include...%> it is working fine

Re: jsp include directive not working

Mon Jan 10, 2011 2:16 pm

plz...any body will help????

Re: jsp include directive not working

Mon Jan 10, 2011 10:56 pm

hey brother ,
i don't see your problem clearly , <%@include not working with u ?

Re: jsp include directive not working

Tue Jan 11, 2011 1:35 pm

sry brother first i write code with <%@ incllude... code it is jst skip the out put containing include file
And then i replace the <%@ ... code vth actual html file code also it shows the same out put
Is there any logical or syntatical errors in this code??

Re: jsp include directive not working

Tue Jan 11, 2011 2:27 pm

just use .
Code:
<%@include file="yourfile.jsp" %>


Re: jsp include directive not working

Thu Jan 13, 2011 2:54 pm

that means...cann't we use HTML(static) files in <%@include....?

Re: jsp include directive not working

Thu Jan 13, 2011 4:20 pm

good question ... i think yes, you can but i can't remember.

Post a reply
  Related Posts  to : jsp include directive not working
 PHP Include     -  
 Require vs Include in php     -  
 Using include() Within a Loop     -  
 Using include function     -  
 get include path     -  
 javap is not working     -  
 SSI.php on other websites, Not working     -  
 Working on hotel class     -  
 ScrollableTable is not working in the firefox     -  
 video conference is nt working     -  

Topic Tags

Servlets/JSP