Right Ozgur, once again Ive misunderstand the question. Glad I don't work in
support, it would be a disaster.
So we are talking about including a servlet (or JSP) from the same servlet
container.
In that case, ignore my response, thats for getting content outside of your
servlet container.
Take a look at the ServletInvokerPortlet
----- Original Message -----
From: "Ozgur Balsoy" <[EMAIL PROTECTED]>
To: "'Jetspeed Users List'" <[EMAIL PROTECTED]>
Sent: Saturday, February 02, 2002 9:33 AM
Subject: RE: Q:Servlets and Database search in Jetspeed
> Actually, it is quite simple to keep the page within the portlet. Just
> put the Jetspeed's path to the action field of the form. However, this
> prevents you to link your form's action to another servlet. That is you
> have to print out your form with your servlet and you have to process
> the response with the very same servlet. I paste a small example to
> illustrate the idea and this works fine.
>
> The reason for this method is that Jetspeed is run by a central servlet
> which is called 'jetspeed' in jetspeed/WEB-INF/web.xml and mapped to the
> Java class org.apache.turbine.Turbine. This servlet retrieves the
> request and response objects, initializes a new similar object called
> rundata and and fills it with request, response, user profiler, etc and
> forwards it to all the portlets.
>
> When you set the action field to the main portal path, this Turbine
> servlet acts like a mother servlet and passes your request and response
> object to your child servlet.
>
> Ozgur
>
> --------------FormTest.java-----------------
> import javax.servlet.*;
> import javax.servlet.http.*;
> import java.io.*;
> import java.util.*;
>
> public class FormTest extends HttpServlet {
> private static final String CONTENT_TYPE = "text/html";
> //Process the HTTP Get request
> public void doGet(HttpServletRequest request, HttpServletResponse
> response) throws ServletException, IOException {
> response.setContentType(CONTENT_TYPE);
> PrintWriter out = response.getWriter();
>
> String path = request.getContextPath() +
> request.getServletPath();
>
> out.println("<html><head><title>FormTest</title></head><body>");
>
> if( request.getParameter("x_login") == null ) {
> out.println("<form method=\"post\" action=\"" + path +
> "\">");
> out.println("<p>Username:<input type=\"text\"
> name=\"x_username\" size=\"20\"><br>");
> out.println("Password:<input type=\"password\"
> name=\"x_password\" size=\"20\"><br>");
> out.println("<input type=\"submit\" name=\"x_login\"
> value=\"Login\"></p></form>");
> } else {
> out.println("<p>You have logged in as ");
> out.println( request.getParameter("x_username") );
> out.println("<br>and your password is ");
> out.println( request.getParameter("x_password") );
>
> out.println("<a href=\"" + path + "\">Click here for the
> form</a>");
> }
> out.println("</body></html>");
>
> }
> //Process the HTTP Post request
> public void doPost(HttpServletRequest request, HttpServletResponse
> response) throws ServletException, IOException {
> doGet( request, response );
> }
> }
>
> -----Original Message-----
> From: David Sean Taylor [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, February 02, 2002 12:27 AM
> To: Jetspeed Users List
> Subject: Re: Q:Servlets and Database search in Jetspeed
>
>
> ----- Original Message -----
> From: "Irene Huang" <[EMAIL PROTECTED]>
> To: "Jetspeed user" <[EMAIL PROTECTED]>
> Sent: Friday, February 01, 2002 4:39 PM
> Subject: Q:Servlets and Database search in Jetspeed
>
>
> > Dear all,
> >
> > If I have a JSP portlet, and I have a form:
> >
> > <form method=get
> action="http://localhost:8080/examples/servlet/Dtest">
> >
> > Q:
> > after click submit, i will go to the servlet page.
> > Is there a way i can display the result in the same page (without
> going to
> > the servlet page)?
> > Or what's the "exact link path" that I could add to the servlet page
> so
> that
> > user can click back to go to the starting page?
> >
>
> Im not sure if I understand the question, but I think you are trying to
> always keep the servlet in the portlet window as you navigate thru the
> servlet.
>
> If so, you may need to somehow track the state of your session between
> your
> portlet and the servlet it is 'hosting'.
> One simple way is to write the state into a query param or directly into
> the
> HTML(into an INPUT)
> A more complex way would be to completely proxy the whole session....
> Also, you will also need to rewrite your links (something like in the
> WebPagePortlet, but you want to rewrite back to Jetspeed)
>
> > Q:
> > If I want to add a portlet for user to do database search, what is the
> > best/easist way to do it? any advice?
> >
>
> You can use whatever you like to access the database in Java (JDBC comes
> to
> mind...), callout to any methods.
> Don't recommend putting db code in the portlet, abstract it out, layer
> your
> data access.
> Take a look at Torque
> http://jakarta.apache.org/turbine/torque/index.html
>
> >
> >
> > Thank you for help!!
> >
> > Irene
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> >
> >
>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>