Jump to content

Passing Javabean from Servlet to JSP

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
reachpradeep

reachpradeep

    Learning Programmer

  • Members
  • PipPipPip
  • 41 posts
I'm missing something fundamentally simple I'm sure, but I want a servlet controller to create and populate a Javabean, then forward to JSP page for display via RequestDispatcher.forward (req, resp)

Then in the JSP, I
<jsp:useBean id="name" class="com.etc...." scope="request">

The result is my Javabean is created and populated in the servlet as I want, but then is re-created when it gets to the JSP. I'm looking for some method call or something to attach the javabean to the request object so it gets passed into the JSP without being recreated.

Seems pretty basic to me, but can't find references or searches to
help me out.

Thanks,

#2
rameshkumar

rameshkumar

    Newbie

  • Members
  • PipPip
  • 20 posts

reachpradeep said:

I'm missing something fundamentally simple I'm sure, but I want a servlet controller to create and populate a Javabean, then forward to JSP page for display via RequestDispatcher.forward (req, resp)

Then in the JSP, I
<jsp:useBean id="name" class="com.etc...." scope="request">

The result is my Javabean is created and populated in the servlet as I want, but then is re-created when it gets to the JSP. I'm looking for some method call or something to attach the javabean to the request object so it gets passed into the JSP without being recreated.

Seems pretty basic to me, but can't find references or searches to
help me out.

Thanks,
:)
Know if you forward to jsp cantainers pls right down to this method <jsp:useBean>
<scope="session">
either
<scope="forward">
main diffrence between session and forward it request to jsp caintenars and represents to next page