I am trying to make a form using html and JSP, get the data and save them in an XML file. I use also Tomcat 1.6 as server. For generating the XML I am using the XStream library.
I have a Customer.java class with get and set methods for a message and an email. Then I have a GenerateXml.java file which creates a Customer object, get the data and add them in an XML file:

Customer customer = new Customer();
XStream xs = new XStream();
try {
FileOutputStream fs = new
xs.toXML(customer, fs);
} catch (FileNotFoundException e1) {

Then I have a createForm.html file which creates a form and call the SaveData.jsp, which is:

<jsp:directive.page import="xmlParsing.Customer"/>
<jsp:useBean id="customer" class="xmlParsing.Customer" scope="session"/>
<jsp:setProperty name="customer" property="*"/>
<jsp:directive.page import="xmlParsing.GenerateXml"/>
<jsp:useBean id="xml" class="xmlParsing.GenerateXml" scope="session"/>
<jsp:setProperty name="xml" property="*"/>
You entered
Message: <%= customer.getMessage() %>
Email: <%= customer.getEmail() %>
<%= xml.setXml() %>
</body> </html>

The problem is that when I am trying to run the program I get an error :
"org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 15 in the jsp file: /SaveData.jsp The method print(boolean) in the type JspWriter is not applicable for the arguments (void) .... Stacktrace: org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92) org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330) org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439) org.apache.jasper.compiler.Compiler.compile(Compiler.java:349) org.apache.jasper.compiler.Compiler.compile(Compiler.java:327) org.apache.jasper.compiler.Compiler.compile(Compiler.java:314) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) "

Does anyone know what is wrong with it?


Ok I fixed it!!
It should be <% xml.setXml(); %> instead of <%= xml.setXml() %>.


Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.