aspose file tools*
The moose likes Servlets and the fly likes Values from bean to a servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Values from bean to a servlet" Watch "Values from bean to a servlet" New topic
Author

Values from bean to a servlet

aliya sharma
Ranch Hand

Joined: Aug 11, 2004
Posts: 48
Hello I'm new to J2EE. I have a table called boxcontents that has 2 fields(part_no, content). I'm trying to search by part_no using MVC. I have 1 html page where user enters the part_no. Servlet then reads this part_no and forwrds it to java bean which performs a lookup based on the part_no. Servlet then reads the result and forwards it to a jsp that displays it. My problem is: i'm able to send the Parameter via servlet to java bean by:

this is my javabean

How do i read this result into a servlet and forward it to a JSP?. I would really appreciate it if anyone can point me to a right direction. THanks a lot.
aliya sharma
Ranch Hand

Joined: Aug 11, 2004
Posts: 48
this is my whole code:
servlet code:

bean code (class called BoxContent.java):


JSP code:


COuld someone please tell me what im doing wrong or point me to the right direction. THanks
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
any exception or error you are gettin??
Rahul kapoor
Greenhorn

Joined: Sep 21, 2004
Posts: 16
Apparently your problem lies in the following code.

You have initialised BoxContent but not storing the results of findByPart(..) in box.

use box = BoxContent.findByPart(part_no);

and check.


BoxContent box = new BoxContent();BoxContent.findByPart(part_no);req.setAttribute("result", box);
aliya sharma
Ranch Hand

Joined: Aug 11, 2004
Posts: 48
Hello,
i changed my controller code as:

Its still not working. WHen i enter a value in my html page and hit submit. It gives me a

Any ideas or leads...As, this is my first MVC project, i would appreciate any help. THanks
Senthil B Kumar
Ranch Hand

Joined: Feb 09, 2004
Posts: 140
Has your Controller Servlet been registered in you Server through a web descriptor (web.xml). I guess its not been registred.


Work like you don't need the money. Love like you've never been hated. Dance like nobody's watching. Sing like nobody's listening. Live like it's Heaven on Earth.
Currently I Reside Here WEBlog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Values from bean to a servlet