MIDRANGE dot COM Mailing List Archive



Home » JAVA400-L » August 2002

RE: HttpSession - problem



fixed

Art,

Jsp1 invokes the controller.servlet by using a form 'submit', triggered
by a button.  Here's the code:

JSP1:
...
<SCRIPT LANGUAGE="JavaScript"
src="/FreightQuotations/javascript/openWindows.js"></SCRIPT>
<SCRIPT LANGUAGE="Javascript"
src="/FreightQuotations/javascript/actions.js"></SCRIPT>
...
<FORM name="FormFQ" action="FQController" method=POST onSubmit="return
testaction(action)">
<INPUT type=hidden name="screen" value="S1">
<INPUT type=hidden name="action" value="">
...
<INPUT type="button" style="font-size: 10px" tabindex="5" name="bList"
value=" List " onClick="setaction(this.form, this)">
...

JAVASCRIPT ACTIONS.JS
function testaction(paction)
{
   if (paction.value == "")
   {
      alert("Please select an action-button below");
      return false;
   }
   return true;
}

function setaction(form, button)
{
   // if (button.name == "bList")    {form.action.value = " List "}
   // if (button.name == "bAdd")     {form.action.value = "Create"}
   // if (button.name == "bDelete")  {form.action.value = "Delete"}
   // if (button.name == "bUpdate")  {form.action.value = "Update"}
   // if (button.name == "bConfirm") {form.action.value = "Confirm"}
   // if (button.name == "bCopy")    {form.action.value = " Copy "}
   form.action.value = button.value;
   form.submit();
}

If course I do not ask you "how to change the . forward( ) to a
sendRedirect( )" !
What I want to know is how to decide
- when to use .forward()
- when to use .sendRedirect()
I can't imagine that one has to code .forward(), test it and when it
doesn't work, change his code to .sendRedirect()

As explained in previous mail, one of the reasons was a security issue
while another reason was that the 2 (hidden)fields, used in JSP1 doesn't
exist when launching controller.servlet directly.


Patrick Goovaerts
pgoovaerts@pandora.be
TEL: 0032-3-6472715
GSM:0498610325



-----Oorspronkelijk bericht-----
Van: java400-l-admin@midrange.com [mailto:java400-l-admin@midrange.com]
Namens Art Smet
Verzonden: woensdag 7 augustus 2002 17:12
Aan: java400-l@midrange.com
Onderwerp: RE: HttpSession - problem







>>When it works with: Html ==> Loginid ==> jsp1 ==> controller.servlet
>>==> jsp1 or jsp2 .... which api does jsp1 use to call
>>controller.servlet?

There is more than one way for jsp1 to invoke the controller.servlet
class, you did not say how your code (jsp1) does it.

>>Also, did you try the earlier suggestion of using sendRedirect( ) api
>>instead of .forward( )  to see if that helped at all?
 how do one decide which to choose: .forward() or sendRedirect() ?

Your earlier note said .forward( ) to the controller servlet failed.  If
you try sendRedirect( ) to the controller servlet and it happens to
work, your decision is made.  Or are you really asking how to change the
. forward( ) to a sendRedirect( )?



|---------+---------------------------->
|         |           P.               |
|         |           Goovaerts@Clipper|
|         |           .Be              |
|         |           Sent by: java400-|
|         |           l-admin@midrange.|
|         |           com              |
|         |                            |
|         |                            |
|         |           08/07/02 02:47 AM|
|         |           Please respond to|
|         |           java400-l        |
|         |                            |
|---------+---------------------------->

>-----------------------------------------------------------------------
------------------------------------------------|
  |
|
  |       To:       java400-l@midrange.com
|
  |       cc:
|
  |       Subject:  RE: HttpSession - problem
|
  |
|
  |
|

>-----------------------------------------------------------------------
------------------------------------------------|



This is a multipart message in MIME format.
--
[ Picked text/plain from multipart/alternative ]
Art,

It seems to be a problem with
 (1) security (found out using sendRedirect())
 (2) session-vars which doesn't exist when controller.servlet is called
directly

>>When it works with: Html ==> Loginid ==> jsp1 ==> controller.servlet
>>==> jsp1 or jsp2 .... which api does jsp1 use to call
>>controller.servlet? Also, did you try the earlier suggestion of using
>>sendRedirect( ) api instead of .forward( )  to see if that helped at
>>all?

how do one decide which to choose: .forward() or sendRedirect() ?


Patrick Goovaerts
WebMaster
Clipper Support nv
TEL : 0032 (0)3 5453991
GSM: 0498 610 325
WEB: www.conti7.be _______________________________________________
This is the Java Programming on and around the iSeries / AS400
(JAVA400-L) mailing list To post a message email: JAVA400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/java400-l
or email: JAVA400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.




_______________________________________________
This is the Java Programming on and around the iSeries / AS400
(JAVA400-L) mailing list To post a message email: JAVA400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/java400-l
or email: JAVA400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.








Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot COM and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact