A
Asad
I have a jsp page which checks for an xml file. If it doesn't exist, I
show the users an empty form. However, if the xml file does exist, I
want to auto populate the data in the form using the XML form. The XML
file contains names of the form elements as well as their values.
Right now, all I am trying is that if I have
<%
File Name= new File("sample.xml");
if(!Name.exists())
{
%> sample.xml does not exist <%
}
else
{
%> sample.xml exists! <%
}
Document doc;
Element e;
e = doc.getElementById("t1");
String x;
x = e.getAttribute("name");
out.println (x);
%>
I am trying to create a document element (which should point to the
jsp file that this scriptlet above is embedded in). I am not doing
that anywhere I know; how do I do that is my question.
I have a form btw that has an element as follows:
First Name<input type="text" name="textboxFirstName" size="20"
id="t1">
But when I run this jsp I get this very much expected error:
form1_jsp.java:68: variable doc might not have been initialized
e = doc.getElementById("t1");
^
So how can I get a handle for my jsp file?
show the users an empty form. However, if the xml file does exist, I
want to auto populate the data in the form using the XML form. The XML
file contains names of the form elements as well as their values.
Right now, all I am trying is that if I have
<%
File Name= new File("sample.xml");
if(!Name.exists())
{
%> sample.xml does not exist <%
}
else
{
%> sample.xml exists! <%
}
Document doc;
Element e;
e = doc.getElementById("t1");
String x;
x = e.getAttribute("name");
out.println (x);
%>
I am trying to create a document element (which should point to the
jsp file that this scriptlet above is embedded in). I am not doing
that anywhere I know; how do I do that is my question.
I have a form btw that has an element as follows:
First Name<input type="text" name="textboxFirstName" size="20"
id="t1">
But when I run this jsp I get this very much expected error:
form1_jsp.java:68: variable doc might not have been initialized
e = doc.getElementById("t1");
^
So how can I get a handle for my jsp file?