Hii.
Thanks for ur advise...
I am also appending below my source file emp.jsp which displays the
names all the employees in the database and lists them as html links.
When a user clicks on anyone of the employee, the name of the employee
is to pass to the details.jsp page. But when i do
request.getParameter("empname") in the details.jsp page, i am getting
the value as null. I am not able to figure out why? I think therez some
logical error in the emp.jsp file, it wud be grateful if u cud check the
javascipt portion of the page.
(I am not very much conversant with javascript..so plz excuse)
thanks
Jayman
==============emp.jsp=====================
<%@ page language="java" import="java.sql.*"
errorPage="errorpage.jsp" %>
<html>
<head><title>Employee Database</title>
<script language="JavaScript">
<!--
function submitForm(String name)
{
document.form.empname.value = name;
document.form.submit();
)
//-->
</script>
</head>
<body>
<jsp:useBean id="db" scope="request" class="emp.DbBean" />
<jsp:setProperty name="db" property="*" />
<h3>The Employees in the Database are as follows :- </h3><br>
<%
ResultSet rs = null;
String sql = "SELECT ename FROM emp";
try
{
db.connect();
}
catch(ClassNotFoundException e)
{ throw new ServletException("Database Drivers NOT AVAILABLE", e); }
catch(SQLException e)
{ throw new ServletException("Database URL is WRONG", e); }
catch(IOException e)
{ throw new ServletException("Cannot read DbBean.properties", e); }
try
{
rs = db.execSQL(sql);
%>
<form name="form" method="post" action="details.jsp">
<input type = "hidden" name="empname">
<ol>
<%
while(rs.next())
{
%><li><a href="details.jsp" onClick()=submitForm(<%=
rs.getString(1)
%>)>
<%= rs.getString(1) %> </a><%
}
%>
</ol>
</form>
<%
rs.close();
db.close();
}
catch(SQLException e)
{ throw new ServletException("Database URL is WRONG", e); }
%>
</body>
</html>
sun_king wrote:
>
> your html page:
>
> javascript function:
>
> function submitForm(){
> document.form1.item1.value = "whatever";
> document.form1.submit();
> )
>
> <form name="form1" method="post" action="answer.jsp">
> <input type = "hidden" name="item1">
> <input type="text" name="item2">
> <a href="answer.jsp" onClick="submitForm()" >i wanna see the results</a>
>
> </form>
>
> Jayman Dalal wrote:
>
> > Dear friends,
> >
> > Hi.
> > I have a html page containing few links, all poiniting to same dynamic
> > jsp page. Depending on which link does the user click, i have to pass
> > parameters to the jsp page and the page will be generated then. Can
> > anyone tell me how do i pass parameters to a jsp page thru a html link.
> >
> > Thanks.
> > Jayman
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Talk to your friends online with Yahoo! Messenger.
> > http://im.yahoo.com
> >
> > ===========================================================================
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> > http://java.sun.com/products/jsp/faq.html
> > http://www.esperanto.org.nz/jsp/jspfaq.html
> > http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> > http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets