• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

adding data in database through a form

 
Greenhorn
Posts: 15
Hibernate Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a table employee . I want the user to enter information in the form and it must be stored in the database.But the code below throws an exception.Could anyone tell me what is missing?

Thanks.

addEmp.jsp



MyPage.jsp


exception:
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would highly recommend against this approach. The SQL JSTL tags are meant for quick proof-of-concepts or prototypes and not for production code. The first thing I would do is to move any processing to a servlet which can then delegate model operations to model classes.
 
Archi Sharma
Greenhorn
Posts: 15
Hibernate Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am restricted to using only JSP, struts2 and hibernate. That's why I don't have any servlets.
Is there any other way to do this without using servlets?
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The struts equivalent of a servlet is and action (at least in structs 1, I think). I'll move this to the Struts forum for further discussion.

Regardless of the framework, you should never do model operations in the views.
 
Archi Sharma
Greenhorn
Posts: 15
Hibernate Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok . Thanks for your help!!
 
Archi Sharma
Greenhorn
Posts: 15
Hibernate Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to enter questions into a table using a form. Make_test is the form JSP. addQues is the JSP which sends data to the table.After submitting the data in the form, an exception is generated.
Please tell me what is wrong or missing.
Thanks

Make_Test.jsp



addQues.jsp



Stack Trace of Exception

 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think this is as straightforward a error as one can get:


I believe this is because you are still referencing JSTL tags in your code.
If you want to use Struts to accomplish your task, your best bet is to learn how to use Struts properly, then apply that knowledge to your task. The Struts documentation has a page with a number of tutorials. I seem to remember the CRUD tutorial being valuable for a beginner.
Of course, we welcome any questions or problems you have along the way!
 
Archi Sharma
Greenhorn
Posts: 15
Hibernate Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok. Thanks for your help. I will learn more about struts and then proceed further.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic