Home > Archive > Java Beans > July 2004 > Storing data with one JSP and retrieving it with another
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Storing data with one JSP and retrieving it with another
|
|
| Amy Johnson 2004-06-25, 7:22 pm |
| Does anybody have any advice on how to store form data in a bean when
the user clicks the submit button, then retrieve the data and display it
in an already open jsp?
Thanks
Amy
| |
| Paul Davis 2004-06-26, 4:00 am |
| I'll recommend three ways.
The first is to use the struts framework and let this be handled for you.
The second is to use a servlet to handle the form submission. The servlet
can store the bean as a request attribute, and dispatch to the jsp. The jsp
can then retrieve the bean using the <jsp:useBean...> tag. It can retrieve
with scriptlets as well but, thats bad form.
If you just want something quick and dirty have the post submit to a jsp
page. The jsp page can use a jsp:useBean tag and a jsp:setProperty tag to
populate the bean.
see this here: http://www.jsptut.com/Forms.jsp
To counter that tutorial page, I'll recommend that you use JSTL tags instead
of the scriptlets for the output.
Amy Johnson wrote:
> Does anybody have any advice on how to store form data in a bean when
> the user clicks the submit button, then retrieve the data and display it
> in an already open jsp?
>
> Thanks
>
> Amy
| |
| Dirk Michaelsen 2004-06-28, 3:56 am |
| Hi Paul,
>I'll recommend three ways.
here is the fourth quick and dirty way:
Use sesssion.setAttribute(...) and session.getAttribute(...) to pass
data between two JSPs or servlets. It's the easiest way and you don't
need any bean.
cu
Dirk
| |
| Amy Johnson 2004-07-09, 8:58 pm |
| Thanks for the help. I'll set it up and try it.
Amy
Paul Davis wrote:
> I'll recommend three ways.
> The first is to use the struts framework and let this be handled for you.
>
> The second is to use a servlet to handle the form submission. The servlet
> can store the bean as a request attribute, and dispatch to the jsp. The jsp
> can then retrieve the bean using the <jsp:useBean...> tag. It can retrieve
> with scriptlets as well but, thats bad form.
>
> If you just want something quick and dirty have the post submit to a jsp
> page. The jsp page can use a jsp:useBean tag and a jsp:setProperty tag to
> populate the bean.
> see this here: http://www.jsptut.com/Forms.jsp
> To counter that tutorial page, I'll recommend that you use JSTL tags instead
> of the scriptlets for the output.
>
>
>
> Amy Johnson wrote:
>
>
>
>
|
|
|
|
|