RE: setting server side parm in Javascript?

2002-03-18 Thread Juan Alvarado \(Struts List\)

Theron:

You might be able to accomplish what you need by doing the following:

Place a transparent 1 by 1 pixel image on your page somewhere.

When ever an event occurs that you want tab 4 to be reloaded, call a
javascript function that will reset the img src value of your image with the
proper action you need for that event. In the call you will need to pass the
parameters you need to the action in order to properly reload tab 4 with the
correct data. I don't remember the exact syntax to do this, but I'm sure it
won't be that hard for you to look it up.

What will happen is that you won't be submitting the form, but will actually
be calling the action by resetting the img src of your hidden image. One
thing also, you will need to pass a random number every time you reset the
img src to avoid caching issues.

I've tried this before with succesfully, although not for the type of
application you're working on.

Let me know how you make out.


**
Juan Alvarado
Internet Developer -- Manduca Management
(786)552-0504
[EMAIL PROTECTED]
AOL Instant Messenger: [EMAIL PROTECTED]

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Sunday, March 10, 2002 5:33 PM
To: Struts Users Mailing List
Subject: setting server side parm in Javascript?



Hi Folks:

I'm doing a mimic-JTabbedPane approach.   I have a screen with 5 tabs.I
am using 1 form object and 5 action mappings...

On tab 4, I'd like to detect changes made to a field on tab 1. I notice
I can change the field on tab 1 but tab 4 does not know about until the
form is submitted.I can't submit the form...

I'd like to have a Javascript handler that implements the onchange() and
somehow sets a session attribute or some kind of trigger that tells tab 4
to "reload" itself when this field on tab 1 has changed.I notice if I
change these values, the form object will not get the new values until you
hit submit.Having the javascript function call submit is not an option
either...   Any ideas on how best to do this??

If I could access my form-bean directly within the Javascript method, that
would be an option to (as I could call the set method on the form object)
but I am not sure if the javascript can access the form object directly and
call a set method?

thanks,
Theron


--
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]>




RE: Found Solution to setting server side parm in Javascript BUT....

2002-03-11 Thread theron . kousek


thanks Robert:

I don't feel so bad.I was stuck for 3 hours on this doggone dilema (not
to mention a little bit of cussing) and tried quite a few things prior to
my final solution of the intermediate JSP to set the property...I did
not think that setting a form object's values from html/javascript was
going to be *this* difficult.If there was a way to force a form
object's values to be loaded without having to do a submit in javascript,
my problem would have been solved.This was one of those things where I
thought it would take me 5-10 minutes to do and ended up being 3 hours.
Adding the "intermediate" JSP seemed to be a "hack" at first but based on
what you just told me, I guess it's a normal thing  :-)It works now and
it works beautifully but it sure is alot harder to do then when the screen
was in a JTabbedPane using Swing  :-)

thanks,
Theron



   
 
Robert Nocera  
 
 <[EMAIL PROTECTED]>  
 
 cc:   
 
03/11/02 Subject: RE: Found Solution to setting 
server side parm in 
11:16 AM Javascript BUT
 
Please 
 
respond to 
 
Struts Users   
 
Mailing List   
 
   
 
   
 



Theron,

There isn't an easier way because a FormBean is a server-side object.
You might think that your html page has access to it, but it's only
because of the sleight of hand involved in JSP programming.  Since a JSP
is actually a servlet, it is only sending HTML to a browser so your
browser knows nothing of these objects.

Robert Nocera
New England Open Solutions
www.neosllc.com
"You supply the vision, we'll do the rest."


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Sunday, March 10, 2002 7:21 PM
To: Struts Users Mailing List
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Found Solution to setting server side parm in Javascript
BUT


After spending 2 hours trying to find a solution to this, I found one by
trial and error...
BUT THERE HAS GOT TO BE A BETTER WAY  :-)

Here's what I did but I can't believe it's "this" difficult to do...

Here's my checkfield property that needs to "force a form value to be
updated":

 
  
 

Here's the javascript function:

 function setCurrProductType(inProductType) {
  alert("Setting curr product type to: " + inProductType);
  window.location="SetProperty.jsp?enteredPt="+inProductType;
 }


and here's the SetProperty.jsp
-
<%@ taglib uri="/struts-bean" prefix="bean" %>




<%
 //
 // If they changed the product type on the first page, set it
 // here in the form object...
 //
 String sCurrProductType=request.getParameter("enteredPt");
 psInfo.setCurrProductType(sCurrProductType);
 System.out.println("Current Product Type = " +
psInfo.getCurrProductType()
  + " current page = " + psInfo.getCurrpage());
 psForm.setPsdProductType(psInfo.getCurrProductType());
%>




So in essence, the "forward" tag simply causes control to come back to
the
page I was on...   But in-between, I was able to set a form bean
propertyAgain my problem is the form bean property is not
updated
until you hit the submit button...   In this case, I don't want a submit
to
occur when you change the contents of the dropdown.   Only the property
for
that drop down should change...   After adding this, when I click to go
to
the 4th tab, the action now sees the newly changed value

It works BUT I have to believe there's a better way!!!I open to any
suggestions...





    theron.kousek

    @webmd.net   To: Struts Users Mailing
List

<[EMAIL PROTECTED]>
03/10/02 

RE: Found Solution to setting server side parm in Javascript BUT....

2002-03-11 Thread Robert Nocera

Theron,

There isn't an easier way because a FormBean is a server-side object.
You might think that your html page has access to it, but it's only
because of the sleight of hand involved in JSP programming.  Since a JSP
is actually a servlet, it is only sending HTML to a browser so your
browser knows nothing of these objects.

Robert Nocera
New England Open Solutions
www.neosllc.com
"You supply the vision, we'll do the rest."
 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, March 10, 2002 7:21 PM
To: Struts Users Mailing List
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Found Solution to setting server side parm in Javascript
BUT


After spending 2 hours trying to find a solution to this, I found one by
trial and error...
BUT THERE HAS GOT TO BE A BETTER WAY  :-)

Here's what I did but I can't believe it's "this" difficult to do...

Here's my checkfield property that needs to "force a form value to be
updated":

 
  
 

Here's the javascript function:

 function setCurrProductType(inProductType) {
  alert("Setting curr product type to: " + inProductType);
  window.location="SetProperty.jsp?enteredPt="+inProductType;
 }


and here's the SetProperty.jsp
-
<%@ taglib uri="/struts-bean" prefix="bean" %>




<%
 //
 // If they changed the product type on the first page, set it
 // here in the form object...
 //
 String sCurrProductType=request.getParameter("enteredPt");
 psInfo.setCurrProductType(sCurrProductType);
 System.out.println("Current Product Type = " +
psInfo.getCurrProductType()
  + " current page = " + psInfo.getCurrpage());
 psForm.setPsdProductType(psInfo.getCurrProductType());
%>




So in essence, the "forward" tag simply causes control to come back to
the
page I was on...   But in-between, I was able to set a form bean
propertyAgain my problem is the form bean property is not
updated
until you hit the submit button...   In this case, I don't want a submit
to
occur when you change the contents of the dropdown.   Only the property
for
that drop down should change...   After adding this, when I click to go
to
the 4th tab, the action now sees the newly changed value

It works BUT I have to believe there's a better way!!!I open to any
suggestions...



 

theron.kousek

@webmd.net   To: Struts Users Mailing
List              
 
<[EMAIL PROTECTED]>   
03/10/02 cc:

02:32 PM Subject: setting server
side parm in Javascript?   
Please

respond to

Struts Users

Mailing List

 

 





Hi Folks:

I'm doing a mimic-JTabbedPane approach.   I have a screen with 5 tabs.
I
am using 1 form object and 5 action mappings...

On tab 4, I'd like to detect changes made to a field on tab 1. I
notice
I can change the field on tab 1 but tab 4 does not know about until the
form is submitted.I can't submit the form...

I'd like to have a Javascript handler that implements the onchange() and
somehow sets a session attribute or some kind of trigger that tells tab
4
to "reload" itself when this field on tab 1 has changed.I notice if
I
change these values, the form object will not get the new values until
you
hit submit.Having the javascript function call submit is not an
option
either...   Any ideas on how best to do this??

If I could access my form-bean directly within the Javascript method,
that
would be an option to (as I could call the set method on the form
object)
but I am not sure if the javascript can access the form object directly
and
call a set method?

thanks,
Theron


--
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]>




Found Solution to setting server side parm in Javascript BUT....

2002-03-10 Thread theron . kousek


After spending 2 hours trying to find a solution to this, I found one by
trial and error...
BUT THERE HAS GOT TO BE A BETTER WAY  :-)

Here's what I did but I can't believe it's "this" difficult to do...

Here's my checkfield property that needs to "force a form value to be
updated":

 
  
 

Here's the javascript function:

 function setCurrProductType(inProductType) {
  alert("Setting curr product type to: " + inProductType);
  window.location="SetProperty.jsp?enteredPt="+inProductType;
 }


and here's the SetProperty.jsp
-
<%@ taglib uri="/struts-bean" prefix="bean" %>




<%
 //
 // If they changed the product type on the first page, set it
 // here in the form object...
 //
 String sCurrProductType=request.getParameter("enteredPt");
 psInfo.setCurrProductType(sCurrProductType);
 System.out.println("Current Product Type = " +
psInfo.getCurrProductType()
  + " current page = " + psInfo.getCurrpage());
 psForm.setPsdProductType(psInfo.getCurrProductType());
%>




So in essence, the "forward" tag simply causes control to come back to the
page I was on...   But in-between, I was able to set a form bean
propertyAgain my problem is the form bean property is not updated
until you hit the submit button...   In this case, I don't want a submit to
occur when you change the contents of the dropdown.   Only the property for
that drop down should change...   After adding this, when I click to go to
the 4th tab, the action now sees the newly changed value

It works BUT I have to believe there's a better way!!!I open to any
suggestions...



   
 
theron.kousek  
 
@webmd.net   To: Struts Users Mailing List 
 
 <[EMAIL PROTECTED]>  
 
            03/10/02     cc:   
 
02:32 PM Subject: setting server side parm in 
Javascript?   
Please 
 
respond to 
 
Struts Users   
 
Mailing List   
 
   
 
   
 




Hi Folks:

I'm doing a mimic-JTabbedPane approach.   I have a screen with 5 tabs.I
am using 1 form object and 5 action mappings...

On tab 4, I'd like to detect changes made to a field on tab 1. I notice
I can change the field on tab 1 but tab 4 does not know about until the
form is submitted.I can't submit the form...

I'd like to have a Javascript handler that implements the onchange() and
somehow sets a session attribute or some kind of trigger that tells tab 4
to "reload" itself when this field on tab 1 has changed.I notice if I
change these values, the form object will not get the new values until you
hit submit.Having the javascript function call submit is not an option
either...   Any ideas on how best to do this??

If I could access my form-bean directly within the Javascript method, that
would be an option to (as I could call the set method on the form object)
but I am not sure if the javascript can access the form object directly and
call a set method?

thanks,
Theron


--
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]>




setting server side parm in Javascript?

2002-03-10 Thread theron . kousek


Hi Folks:

I'm doing a mimic-JTabbedPane approach.   I have a screen with 5 tabs.I
am using 1 form object and 5 action mappings...

On tab 4, I'd like to detect changes made to a field on tab 1. I notice
I can change the field on tab 1 but tab 4 does not know about until the
form is submitted.I can't submit the form...

I'd like to have a Javascript handler that implements the onchange() and
somehow sets a session attribute or some kind of trigger that tells tab 4
to "reload" itself when this field on tab 1 has changed.I notice if I
change these values, the form object will not get the new values until you
hit submit.Having the javascript function call submit is not an option
either...   Any ideas on how best to do this??

If I could access my form-bean directly within the Javascript method, that
would be an option to (as I could call the set method on the form object)
but I am not sure if the javascript can access the form object directly and
call a set method?

thanks,
Theron


--
To unsubscribe, e-mail:   
For additional commands, e-mail: