Mike Coburn wrote:
> I guess I ddd not ask my question very well
>
> 3 elements: one html page, jsp 1, and jsp 2.
> the variable has to make a stopover on jsp1 then be sent to jsp2
>
> my problem is the connection between jsp1 and jsp2.
>
> If I use jsp:forward there is no stopover on jsp1, it goes straight
 > from the html to the jsp2

Do you mean that your HTML page submits to JSP1, which returns a
response with a form or a link that invokes JSP 2? If so, you need
to add the parameter value received by JSP 1 in such a way that it
gets included in the request for JSP 2.

If JSP 1 returns a response with a form, use a hidden field:

   <form action="jsp2.jsp">
     <input type="hidden" name="someName"
       value="<%= request.getParameter("someName") %>">

If JSP 1 returns a response with a link, use a query string:

   <a href="jsp2.jsp?someName=<%= request.getParameter("someName") %>">
     Page 2</a>

If the parameter value can contain special characters, such as space,
you need to URL encode it as well:

   java.net.URLEncoder.encode(request.getParameter("someName"))

As an alternative to all of this, you may want to use the new JSP
Standard Tag Library (JSTL) instead. It include an action that takes
care of all the encoding needs for you:

   <a href="jsp2.jsp?someName=<c:url value="${param.someName}"/>">
     Page 2</a>

For details, see:

   <http://jakarta.apache.org/taglibs/doc/standard-doc/intro.html>

> Is it possible to use setParameter and getParameter without a bean?

I'm not sure what you mean by this. getParameter() is a method on the
request object. It has nothing to do with beans. Maybe you mean
<jsp:getProperty> and <jsp:setProperty>. If so, the answer is no.

Hans
--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com
JavaServer Pages        http://TheJSPBook.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to