Hi, I think this is a very basic question. I am getting an error when I am loading RetrieveFormData.jsp here is my code. CreateForm.jsp <html> <head> <title>CREATING A JSP FORM</title> </head>
<tr> <td> <input type ="submit" value = "Submit"> </td> </tr> </table> </Form> </body> </html> RetrieveFormData.jsp <jsp:usebean id ="company" scope = "request" class = "shoppingcart.Company"/> jsp:setProperty name = "company" property = "*" /> <html> <head> <title> Retrieve form data </title> </head> <body> <B> Company: </b> <%= company.getCompany()%> <br> <B> Street : </b> <%= company.getStreet() %> <br> <B> State : </b> <%= company.getState() %> <br> <B> City : </b> <%= company.getCity() %> <br> <B> Zip : </b> <%= company.getZip() %> <br> </body> </html>
Company.java package shoppingcart; public class Company { private String company = null; private String street = null; private String city = null; private String state = null; private String zip = null;
public Company() { } // setters and getters for Company public String getCompany() { return company; } public void setCompany(String value) { company = value; } // setters and getters for street public String getStreet() { return street ; } public void setStreet(String value) { street = value; } // setters and getters for state public String getState() { return state; } public void setState(String value) { state = value; } // setters and getters for city public String getCity() { return city; } public void setCity(String value) { city = value; } // setters and getters for Zip public String getZip() { return zip; } public void setZip(String value) { zip = value; } }
on clicking the submit button I am getting the following error Location: /examples/jsp/RetrieveFormData.jsp Internal Servlet Error: org.apache.jasper.JasperException: Unable to compile class for JSPD:\jakarta-tomcat\work\localhost_8080%2Fexamples\_0002fjsp_0002fRetrieveFormData_0002ejspRetrieveFormData_jsp_1.java:61: Undefined variable or class name: company out.print( company.getCompany()); I have shoppingcart folder in D:/jakarta_tomcat/webapps/WEB_INF/ I have company.java and company.class are in this shopping cart folder. I have createform.jsp and retrieveFormData.jsp are in the D:/jakarta_tomcat/webapps/examples/JSP Please bare with my ignorance. I am having a hard time with directory structure. I really thank Javaranch for helping so many people like me. Thanks to all, Krupa
Roopa Bagur
Ranch Hand
Joined: Nov 03, 2000
Posts: 267
posted
0
Hi Krupa, It looks like it is syntax problem since it is failing at compile. You need a left angled bracket in the following line of your code..Add that & compile again. jsp:setProperty name = "company" property = "*" />
Originally posted by krupa devi: Hi, I think this is a very basic question. I am getting an error when I am loading RetrieveFormData.jsp here is my code. CreateForm.jsp <html> <head> <title>CREATING A JSP FORM</title> </head>
<tr> <td> <input type ="submit" value = "Submit"> </td> </tr> </table> </Form> </body> </html> RetrieveFormData.jsp <jsp:usebean id ="company" scope = "request" class = "shoppingcart.Company"/> jsp:setProperty name = "company" property = "*" /> <html> <head> <title> Retrieve form data </title> </head> <body> <B> Company: </b> <%= company.getCompany()%> <br> <B> Street : </b> <%= company.getStreet() %> <br> <B> State : </b> <%= company.getState() %> <br> <B> City : </b> <%= company.getCity() %> <br> <B> Zip : </b> <%= company.getZip() %> <br> </body> </html>
Company.java package shoppingcart; public class Company { private String company = null; private String street = null; private String city = null; private String state = null; private String zip = null;
public Company() { } // setters and getters for Company public String getCompany() { return company; } public void setCompany(String value) { company = value; } // setters and getters for street public String getStreet() { return street ; } public void setStreet(String value) { street = value; } // setters and getters for state public String getState() { return state; } public void setState(String value) { state = value; } // setters and getters for city public String getCity() { return city; } public void setCity(String value) { city = value; } // setters and getters for Zip public String getZip() { return zip; } public void setZip(String value) { zip = value; } }
on clicking the submit button I am getting the following error Location: /examples/jsp/RetrieveFormData.jsp Internal Servlet Error: org.apache.jasper.JasperException: Unable to compile class for JSPD:\jakarta-tomcat\work\localhost_8080%2Fexamples\_0002fjsp_0002fRetrieveFormData_0002ejspRetrieveFormData_jsp_1.java:61: Undefined variable or class name: company out.print( company.getCompany()); I have shoppingcart folder in D:/jakarta_tomcat/webapps/WEB_INF/ I have company.java and company.class are in this shopping cart folder. I have createform.jsp and retrieveFormData.jsp are in the D:/jakarta_tomcat/webapps/examples/JSP Please bare with my ignorance. I am having a hard time with directory structure. I really thank Javaranch for helping so many people like me. Thanks to all, Krupa