Re: Question about Lookup dispatch action

2006-08-23 Thread mosho

Hey Scott

FINALLY! It works !!!
Including xml tag in my javascript is the solution for me.

THANKS !


Scott Van Wart-2 wrote:
> 
> mosho wrote:
>> Hi Scott,
>>
>> I  added a unspecified() method in my action class and it works now.
>> I am not able to understand though how it is working, unspecified() is
>> called when parameter name doesn;t exist, right?
>> I have a parameter name= navigation and its value is shown as
>> {submitText}.
>> But it calls unspecified  method, for that value as it would have done if
>> value is null. 
>> I am assuming it is calling unspecified() because  it is not able to find
>> the key name {submitText}
>>   
> I hope I read your reply correctly.
> 
> You should NEVER EVER see "{submitText}" when you're stepping through 
> Java, or in the log window, or in an exception stack trace!!!  The ONLY 
> place it should appear is in your JSP.  In ALL OTHER PLACES, you should 
> see the text that you put in your MessageResources.properties.  If 
> you're seeing "{submitText}" verbatim, then your JSP compiler is 
> ignoring EL, or it's not written correctly.  For this line in your JSP,
> 
>   hiddenField.value = "${submitText}";
> 
> Go ahead and request your page in your browser, then go to view source.  
> Scroll down to where this line should appear in the HTML, and make sure 
> it says something like,
> 
>   hiddenField.value = "Next";
> 
> instead.
> 
> Now there might be a workaround... I gave you the EL method because I 
> find it much cleaner than embedding XML-like tags in JavaScript, but the 
> following may also work in your JSP:
> 
> hiddenField.value = '';
> 
> This might work... I don't LIKE it, because it's an XML (tag library, 
> whatever) tag inside JavaScript inside HTML in a JSP... but oh well.  
> Note the quotes -- the outermost are single quotes, the innermost are 
> double quotes.  Double check them even if you copied/pasted them just to 
> get into the habit.
> 
> If you were using {submitText} in your post as a placeholder for the 
> actual text that should appear to the browser, my apologies, though I 
> hope you understand what I was getting at :).
> 
> If this WAS the case, since you're not using EL, feel free to remove the 
> lines I gave you in an earlier post,
> 
>   
> 
>   
> 
> As you don't need them.
> 
> - Scott
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Question-about-Lookup-dispatch-action-tf2124092.html#a5953411
Sent from the Struts - User forum at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Question about Lookup dispatch action

2006-08-23 Thread Scott Van Wart

mosho wrote:

Hi Scott,

I  added a unspecified() method in my action class and it works now.
I am not able to understand though how it is working, unspecified() is
called when parameter name doesn;t exist, right?
I have a parameter name= navigation and its value is shown as {submitText}.
But it calls unspecified  method, for that value as it would have done if
value is null. 
I am assuming it is calling unspecified() because  it is not able to find

the key name {submitText}
  

I hope I read your reply correctly.

You should NEVER EVER see "{submitText}" when you're stepping through 
Java, or in the log window, or in an exception stack trace!!!  The ONLY 
place it should appear is in your JSP.  In ALL OTHER PLACES, you should 
see the text that you put in your MessageResources.properties.  If 
you're seeing "{submitText}" verbatim, then your JSP compiler is 
ignoring EL, or it's not written correctly.  For this line in your JSP,


 hiddenField.value = "${submitText}";

Go ahead and request your page in your browser, then go to view source.  
Scroll down to where this line should appear in the HTML, and make sure 
it says something like,


 hiddenField.value = "Next";

instead.

Now there might be a workaround... I gave you the EL method because I 
find it much cleaner than embedding XML-like tags in JavaScript, but the 
following may also work in your JSP:


hiddenField.value = '';

This might work... I don't LIKE it, because it's an XML (tag library, 
whatever) tag inside JavaScript inside HTML in a JSP... but oh well.  
Note the quotes -- the outermost are single quotes, the innermost are 
double quotes.  Double check them even if you copied/pasted them just to 
get into the habit.


If you were using {submitText} in your post as a placeholder for the 
actual text that should appear to the browser, my apologies, though I 
hope you understand what I was getting at :).


If this WAS the case, since you're not using EL, feel free to remove the 
lines I gave you in an earlier post,


 
   
 

As you don't need them.

- Scott


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Question about Lookup dispatch action

2006-08-23 Thread Michael Jouravlev

On 8/23/06, mosho <[EMAIL PROTECTED]> wrote:

I am assuming it is calling unspecified() because  it is not able to find
the key name {submitText}


Instead of assuming you can verify it. If you are using Firefox,
LiveHTTPHeaders is invaluable plugin for HTTP traffic sniffing.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Question about Lookup dispatch action

2006-08-23 Thread Wendy Smoak

On 8/23/06, mosho <[EMAIL PROTECTED]> wrote:


I  added a unspecified() method in my action class and it works now.
I am not able to understand though how it is working, unspecified() is
called when parameter name doesn;t exist, right?
I have a parameter name= navigation and its value is shown as {submitText}.
But it calls unspecified  method, for that value as it would have done if
value is null.
I am assuming it is calling unspecified() because  it is not able to find
the key name {submitText}

Any idea?


Can you post the Javascript again?  The most recent version I see
above never submits the form.  It's not enough to name the method
'onClickSubmit' -- you actually have to call submit() somewhere, and I
don't see that happening.

--
Wendy

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Question about Lookup dispatch action

2006-08-23 Thread mosho

Hi Scott,

I  added a unspecified() method in my action class and it works now.
I am not able to understand though how it is working, unspecified() is
called when parameter name doesn;t exist, right?
I have a parameter name= navigation and its value is shown as {submitText}.
But it calls unspecified  method, for that value as it would have done if
value is null. 
I am assuming it is calling unspecified() because  it is not able to find
the key name {submitText}

Any idea?

Thanks, you have been very helpful.


Scott Van Wart-2 wrote:
> 
> mosho wrote:
>> Yes, that's exactly the way it works.
>> My navigation with lookupDispatchAction works perfectly. The problem
>> arises
>> when I have another to link instead of button to submit the form, how do
>> I
>> pass navigation parameter value then?
>> The javascript with hidden field doesn't solve the problem.
>>   
> Is the hidden field within the  (here)  tags?
> 
> - Scott
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Question-about-Lookup-dispatch-action-tf2124092.html#a5951171
Sent from the Struts - User forum at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Question about Lookup dispatch action

2006-08-23 Thread Scott Van Wart

mosho wrote:

Yes, that's exactly the way it works.
My navigation with lookupDispatchAction works perfectly. The problem arises
when I have another to link instead of button to submit the form, how do I
pass navigation parameter value then?
The javascript with hidden field doesn't solve the problem.
  

Is the hidden field within the  (here)  tags?

- Scott

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Question about Lookup dispatch action

2006-08-23 Thread mosho


Yes, that's exactly the way it works.
My navigation with lookupDispatchAction works perfectly. The problem arises
when I have another to link instead of button to submit the form, how do I
pass navigation parameter value then?
The javascript with hidden field doesn't solve the problem.

Thanks!


Scott Van Wart-2 wrote:
> 
> mosho wrote:
>> Request[/planName] does not contain handler parameter named navigation
>>   
> 
> In your struts-config.xml, are you including 'parameter="navigation"' in 
> your action mapping?  A la:
> 
>name="planNameForm" parameter="navigation">
>  ...
>   
> 
> The parameter gives you a place to pass additional data to your action.  
> In the case of LookupDispatchAction, it uses it to find out which 
> request parameter (in this case, "navigation") it should look at to 
> determine which method to call in your subclass.  So your form will 
> submit, and be stuff like:
> 
>   navigation=Next%20Record
> 
> It looks messy, but that's OK.  The framework takes it and translates it 
> back into "Next Record".  Now in your subclass, you override 
> getKeyMethodMap() right?  And somewhere in there, you have something like,
> 
>   map.put( "navigation.next.record", "next" );
> 
> Where "next" corresponds to the public ActionForward next( 
> ActionMapping...) method you have defined in your subclass.
> 
> And in your MessageResources.properties (or whatever the file's called 
> in your web app), you have:
> 
>   navigation.next.record=Next Record
> 
> See how everything links together?  Now the button text you choose is 
> likely different, but this flexibility is the reason you NEVER refer to 
> the button by its text.  Let Struts do that internally, only your users 
> should see it.  Just thought I'd give you a little background so you 
> know what you're getting into; anyone correct me if I'm wrong :)
> 
> Oh one last thing.  Make sure you're NOT overriding execute() in your 
> subclass.  It's fine for regular Action-derived classes, but you're 
> using LookupDispatchAction, which needs to run its own implementation of 
> execute().
> 
> - Scott
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Question-about-Lookup-dispatch-action-tf2124092.html#a5945508
Sent from the Struts - User forum at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Question about Lookup dispatch action

2006-08-22 Thread Scott Van Wart

mosho wrote:

Request[/planName] does not contain handler parameter named navigation
  


In your struts-config.xml, are you including 'parameter="navigation"' in 
your action mapping?  A la:


 name="planNameForm" parameter="navigation">

...
 

The parameter gives you a place to pass additional data to your action.  
In the case of LookupDispatchAction, it uses it to find out which 
request parameter (in this case, "navigation") it should look at to 
determine which method to call in your subclass.  So your form will 
submit, and be stuff like:


 navigation=Next%20Record

It looks messy, but that's OK.  The framework takes it and translates it 
back into "Next Record".  Now in your subclass, you override 
getKeyMethodMap() right?  And somewhere in there, you have something like,


 map.put( "navigation.next.record", "next" );

Where "next" corresponds to the public ActionForward next( 
ActionMapping...) method you have defined in your subclass.


And in your MessageResources.properties (or whatever the file's called 
in your web app), you have:


 navigation.next.record=Next Record

See how everything links together?  Now the button text you choose is 
likely different, but this flexibility is the reason you NEVER refer to 
the button by its text.  Let Struts do that internally, only your users 
should see it.  Just thought I'd give you a little background so you 
know what you're getting into; anyone correct me if I'm wrong :)


Oh one last thing.  Make sure you're NOT overriding execute() in your 
subclass.  It's fine for regular Action-derived classes, but you're 
using LookupDispatchAction, which needs to run its own implementation of 
execute().


- Scott


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Question about Lookup dispatch action

2006-08-22 Thread mosho

Thanks for your help guyz. It doesn't seem to work.
The value of submitText is not  passed to the  hidden.value 
The form gets submitted but gives an error 
Request[/planName] does not contain handler parameter named navigation

I am pasting my code below. 

 

  

  

  

function onClickSubmit() {
  var hiddenField = document.getElementById( "hiddenNavigation" );
  hiddenField.disabled = false;
  hiddenField.value =  "${submitText}";
  alert(hiddenField.value);
  document.planNameForm.submit();
}

   



Thanks again!


Puneet Lakhina wrote:
> 
>>
>> The "return false;" would have to go LAST, otherwise onClickSubmit()
>> wouldn't get called.
> 
> 
> Yup..sorry.. my wrong..
> 
> -- 
> Puneet
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Question-about-Lookup-dispatch-action-tf2124092.html#a5937309
Sent from the Struts - User forum at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Question about Lookup dispatch action

2006-08-20 Thread Puneet Lakhina


The "return false;" would have to go LAST, otherwise onClickSubmit()
wouldn't get called.



Yup..sorry.. my wrong..

--
Puneet


Re: Question about Lookup dispatch action

2006-08-19 Thread Scott Van Wart

Puneet Lakhina wrote:


OK One more thing, if you need to call this javascript method even 
from ur

submit button, to set the property value then you can do


/>

Notice the  return false there.

In case of a link simply do



I hope this was what you wanted.


The "return false;" would have to go LAST, otherwise onClickSubmit() 
wouldn't get called.


And as he's using LookupDispatchAction, the value="submitText" would 
have to be removed and replaced with a child tag "key="submit.text" />" instead.


So it might look like:


 


- Scott

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Question about Lookup dispatch action

2006-08-19 Thread Puneet Lakhina

On 8/19/06, Scott Van Wart <[EMAIL PROTECTED]> wrote:


mosho wrote:
> Hi Scott,
>
> It doesn't seem to work.
>
> My submit buttons look like this:
> 
>   
>    
>
> Now, if I have a link, how can I set the property navigation for it.
> "  onClickSubmit()  pic.gif   "
>

Well first you should probably get rid of 'value="Previous"', since you
should be (and are) setting the button text using .

I didn't consider you were using regular buttons as well.  In this case,
the hidden field is going to be sent, and might muck up
LookupDispatchAction when the user clicks a regular button.  So what you
might need to do is something like this:

  

I can't guarantee having the "disabled" there will work, but it should
prevent the web browser from sending an extra (blank) "navigation"
property and possibly causing the bean helpers to discard the REAL
"navigation" value (when a button is clicked).  Then in your JSP:

  

  

  

function onClickSubmit() {
  var hiddenField = document.getElementById( "hiddenNavigation" );
  hiddenField.disabled = false;
  hiddenField.value = "${submitText}";
  document.navigationForm.submit();
}

  

Have fun,
  Scott



OK One more thing, if you need to call this javascript method even from ur
submit button, to set the property value then you can do



Notice the  return false there.

In case of a link simply do



I hope this was what you wanted.



--
Puneet


Re: Question about Lookup dispatch action

2006-08-18 Thread Scott Van Wart

mosho wrote:

Hi Scott,

It doesn't seem to work.

My submit buttons look like this:

  
   

Now, if I have a link, how can I set the property navigation for it.
"  onClickSubmit()  pic.gif   "
  


Well first you should probably get rid of 'value="Previous"', since you 
should be (and are) setting the button text using .


I didn't consider you were using regular buttons as well.  In this case, 
the hidden field is going to be sent, and might muck up 
LookupDispatchAction when the user clicks a regular button.  So what you 
might need to do is something like this:


 disabled>


I can't guarantee having the "disabled" there will work, but it should 
prevent the web browser from sending an extra (blank) "navigation" 
property and possibly causing the bean helpers to discard the REAL 
"navigation" value (when a button is clicked).  Then in your JSP:


 
   
 

 

   function onClickSubmit() {
 var hiddenField = document.getElementById( "hiddenNavigation" );
 hiddenField.disabled = false;
 hiddenField.value = "${submitText}";
 document.navigationForm.submit();
   }

 

Have fun,
 Scott

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Question about Lookup dispatch action

2006-08-18 Thread mosho

Hi Scott,

It doesn't seem to work.

My submit buttons look like this:

  
   

Now, if I have a link, how can I set the property navigation for it.
"  onClickSubmit()  pic.gif   "




Scott Van Wart-2 wrote:
> 
> Christopher Goldman wrote:
>> On Thu, 2006-08-17 at 14:26 -0700, mosho wrote:
>>   
>>> Hi All,
>>>
>>> I have multiple buttons on my form and I am using LookUpDistpatchAction
>>> to
>>> submit the form depending on which button is clicked.
>>>
>>> I have another requirement now, I have multiple images that are going to
>>> be
>>> links. I need to submit the form using onclick.
>>>
>>> So in my javascript, I will have to submit the form. How can I change/
>>> set
>>> the  value for my parameter?
>>>
>>> It is giving me error:
>>> Request[/selectLocation] does not contain handler parameter named
>>> navigation
>>>
>>> Thanks for your help,
>>> 
>>
>> In your onclick handler for the images, change the (presumably) hidden
>> form input field value:
>>
>>   document.forms["form-name"].elements["navigation"].value = "new-value"
>>
>> Then, submit the form.
>>
>> This is in Firefox.  Looks like it works for IE as well.
>>
>> Not really a Struts question -- just straight Javascript...
>>   
> Doesn't he need to match up the message resource values, like if he had,
> 
>   protected Map getKeyMethodMap() {
> Map map = new TreeMap();
> map.put( "form.create", "create" );
> return map;
>   }
> 
> Then it would take a little trickery in the JSP to get the right values 
> in the Javascript:
> 
> 
>   
> 
> 
> So the web browser passes the correct value, and the lookup map will work:
> 
> function onClickCreate() {
>   document.someForm.action.value = "${createLabel}";
>   document.someForm.submit();
> }
> 
> That should do it I think...
> 
> - Scott
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Question-about-Lookup-dispatch-action-tf2124092.html#a5876941
Sent from the Struts - User forum at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Question about Lookup dispatch action

2006-08-17 Thread Scott Van Wart

Christopher Goldman wrote:

On Thu, 2006-08-17 at 14:26 -0700, mosho wrote:
  

Hi All,

I have multiple buttons on my form and I am using LookUpDistpatchAction to
submit the form depending on which button is clicked.

I have another requirement now, I have multiple images that are going to be
links. I need to submit the form using onclick.

So in my javascript, I will have to submit the form. How can I change/ set
the  value for my parameter?

It is giving me error:
Request[/selectLocation] does not contain handler parameter named navigation

Thanks for your help,



In your onclick handler for the images, change the (presumably) hidden
form input field value:

  document.forms["form-name"].elements["navigation"].value = "new-value"

Then, submit the form.

This is in Firefox.  Looks like it works for IE as well.

Not really a Struts question -- just straight Javascript...
  

Doesn't he need to match up the message resource values, like if he had,

 protected Map getKeyMethodMap() {
   Map map = new TreeMap();
   map.put( "form.create", "create" );
   return map;
 }

Then it would take a little trickery in the JSP to get the right values 
in the Javascript:



 


So the web browser passes the correct value, and the lookup map will work:

function onClickCreate() {
 document.someForm.action.value = "${createLabel}";
 document.someForm.submit();
}

That should do it I think...

- Scott


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Question about Lookup dispatch action

2006-08-17 Thread Christopher Goldman
On Thu, 2006-08-17 at 14:26 -0700, mosho wrote:
> Hi All,
> 
> I have multiple buttons on my form and I am using LookUpDistpatchAction to
> submit the form depending on which button is clicked.
> 
> I have another requirement now, I have multiple images that are going to be
> links. I need to submit the form using onclick.
> 
> So in my javascript, I will have to submit the form. How can I change/ set
> the  value for my parameter?
> 
> It is giving me error:
> Request[/selectLocation] does not contain handler parameter named navigation
> 
> Thanks for your help,

In your onclick handler for the images, change the (presumably) hidden
form input field value:

  document.forms["form-name"].elements["navigation"].value = "new-value"

Then, submit the form.

This is in Firefox.  Looks like it works for IE as well.

Not really a Struts question -- just straight Javascript...

Chris

-- 
Christopher D. Goldman
[EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]