Antonio,
This is a rehash of a reply to a similar question as a month ago:
> There isn't a lot to do really. You process the servlet call as you wish,
> perhaps going to a database or whatever using JDBC, and then decide how to
> respond. Since we're using the 0.91 spec with WebSphere, I'll provide
> code examples for
> 0.91.
>
> Once you have decided how to respond, perhaps created a Bean, you can set
> any <BEAN> data in your JSP with a setAttribute call:
>
> for example:
>
> ((HttpServiceRequest)req).setAttribute("results", resultObject);
>
(Note: WebSphere uses HttpServiceRequest instead HttpServletRequest)
> Then you invoke the JSP file:
>
> ((HttpServiceResponse)resp).callPage("myData.jsp", req);
>
(Note: WebSphere uses HttpServiceResponse instead HttpServletResponse)
> The JSP file will have a <BEAN> tag in it referencing the results object,
>
> something like:
>
> <BEAN NAME="results" TYPE="com.mycompany.mypackage.MyObject"
> introspect="no"
> create="no" scope="request"></BEAN>
>
> and then you simply process the results within the JSP with code that
> might
> look like this:
>
> <%
> // Iterate through data
> int endPos = results.getSize();
> for (int i=1; i <= endPos; i++) {
> %>
>
> <p><%= results.getData(i) %>
>
> <%
> };
> %>
>
> And that's about it.
>
> Of course you can decide to call any JSP file you wish. Or you might just
> redirect to a page using
>
> resp.sendRedirect("mywebpage.html");
>
> One thing to remember is that you can't change the target frame/window of
> your servlet call. The target= in your HREF or Form action statement
> cannot
> be modified in your servlet.
>
> Anyway, I hope this helps. I rarely call a JSP directly given I usually
> need to populate it with a Bean I create on the fly.
>
> Cheers,
>
> Dan
>
> --
> Daniel Kirkdorffer
> Sr. Consultant, Syllogistics LLC
> Web: http://www.syllogistics.com/
> Email: [EMAIL PROTECTED]
>
>
> ----------
> From: Rey Antonio[SMTP:[EMAIL PROTECTED]]
> Reply To: [EMAIL PROTECTED]
> Sent: Friday, March 12, 1999 9:20 AM
> To: [EMAIL PROTECTED]
> Subject: Model 2
>
> Hi.
> I am trying to implement a servlet that calls a jsp file with a bean as a
> parameter,
> but I don't know exactly how to do it. Any help would be wellcome,
> thanks in advance,
>
> Antonio.
>
> ==========================================================================
> =
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> of the message "signoff JSP-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".