Re: How can I set the defualt selection?

2003-07-08 Thread Adam Hardy
You don't need to submit a form (HTTP PUT) to get a request object. You 
can do an HTTP GET, with no form submit in HTML client-side, by clicking 
on the URL, but to the servlet container and struts this is irrelevant. 
The request object will be created for a GET just as for a PUT.

And struts will also create a form bean for you depending entirely on 
your action mapping in struts-config, regardless of whether you did a 
GET or a PUT.

GET and PUT are just HTTP internet transfer protocol formats. I believe 
a GET has only got a HTTP header, whereas PUT has a body too, which 
means you can send more bytes in your parameters. (GET parameters are on 
the query string, PUT params are the form fields).

Adam

leonZ wrote:
But how do you set the defualt option without submit the form?
action.execute() need the HttpServletRequest object, and this object is got
from a submitting of a form in jsp.
Maybe I am wrong, could give me a valid code segment example?
Adam Hardy [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Struts will automatically mark the selected option when the value of the
select box field/property in the actionform is set.
So if you want to set one option as default in a blank form, set the
actionform property to the value of the option you want. Preferably in
the action.execute() so you don't muddle your jsp unnecessarily.
Adam

Caroline Jen wrote:

I have similar questions.  What is the syntax of the
html:option tag?
Just take the example given by you, are the codes
shown below correct?  Will the default selection
shown?
html:select property=select1
html:option property=1 labelProperty=first
html:option property=2 labelProperty=second
html:option property=3 labelProperty=third
/html:select
JPJ

--- leonZ [EMAIL PROTECTED] wrote:


I make it more clear here:

A normal html:
select name=select1
option value=1first/option
option value=2 SELECTEDsecond/option
option value=3third/option
/select
how can I use the 'SELECTED' to set a defualt option
with struts tags.
html:select property=select1
  html:option
  ...
/html:select
leon [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

I am a beginner of struts. I can't use the
'selected' property of the
select

tag in struts to set the default selection like I
used it in a normal
html.

It's happened in 'checked' property of struts
radio tag. Could you tell me


how to set a defualt selection.





-


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


__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





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



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


Re: How can I set the defualt selection?

2003-07-08 Thread leonZ
Thank you very much! I have made it.

Adam Hardy [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 You don't need to submit a form (HTTP PUT) to get a request object. You
 can do an HTTP GET, with no form submit in HTML client-side, by clicking
 on the URL, but to the servlet container and struts this is irrelevant.
 The request object will be created for a GET just as for a PUT.

 And struts will also create a form bean for you depending entirely on
 your action mapping in struts-config, regardless of whether you did a
 GET or a PUT.

 GET and PUT are just HTTP internet transfer protocol formats. I believe
 a GET has only got a HTTP header, whereas PUT has a body too, which
 means you can send more bytes in your parameters. (GET parameters are on
 the query string, PUT params are the form fields).

 Adam

 leonZ wrote:
  But how do you set the defualt option without submit the form?
  action.execute() need the HttpServletRequest object, and this object is
got
  from a submitting of a form in jsp.
  Maybe I am wrong, could give me a valid code segment example?
 
  Adam Hardy [EMAIL PROTECTED] wrote in message
  news:[EMAIL PROTECTED]
 
 Struts will automatically mark the selected option when the value of the
 select box field/property in the actionform is set.
 
 So if you want to set one option as default in a blank form, set the
 actionform property to the value of the option you want. Preferably in
 the action.execute() so you don't muddle your jsp unnecessarily.
 
 Adam
 
 Caroline Jen wrote:
 
 I have similar questions.  What is the syntax of the
 html:option tag?
 
 Just take the example given by you, are the codes
 shown below correct?  Will the default selection
 shown?
 
 html:select property=select1
  html:option property=1 labelProperty=first
  html:option property=2 labelProperty=second
  html:option property=3 labelProperty=third
 /html:select
 
 JPJ
 
 --- leonZ [EMAIL PROTECTED] wrote:
 
 
 I make it more clear here:
 
 A normal html:
 select name=select1
  option value=1first/option
  option value=2 SELECTEDsecond/option
  option value=3third/option
 /select
 
 how can I use the 'SELECTED' to set a defualt option
 with struts tags.
 html:select property=select1
html:option
...
 /html:select
 
 leon [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 
 
 I am a beginner of struts. I can't use the
 
 'selected' property of the
 select
 
 
 tag in struts to set the default selection like I
 
 used it in a normal
 html.
 
 
 It's happened in 'checked' property of struts
 
 radio tag. Could you tell me
 
 
 how to set a defualt selection.
 
 
 
 
 
 -
 
 
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 
 
 
 __
 Do you Yahoo!?
 SBC Yahoo! DSL - Now only $29.95 per month!
 http://sbc.yahoo.com
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 




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



Re: How can I set the defualt selection?

2003-07-08 Thread Caroline Jen
Leon:

 I am working on the same thing.  Could you show
me your example of setting default selection?  

CJen
--- leonZ [EMAIL PROTECTED] wrote:
 Thank you very much! I have made it.
 
 Adam Hardy [EMAIL PROTECTED]
 wrote in message
 news:[EMAIL PROTECTED]
  You don't need to submit a form (HTTP PUT) to get
 a request object. You
  can do an HTTP GET, with no form submit in HTML
 client-side, by clicking
  on the URL, but to the servlet container and
 struts this is irrelevant.
  The request object will be created for a GET just
 as for a PUT.
 
  And struts will also create a form bean for you
 depending entirely on
  your action mapping in struts-config, regardless
 of whether you did a
  GET or a PUT.
 
  GET and PUT are just HTTP internet transfer
 protocol formats. I believe
  a GET has only got a HTTP header, whereas PUT has
 a body too, which
  means you can send more bytes in your parameters.
 (GET parameters are on
  the query string, PUT params are the form fields).
 
  Adam
 
  leonZ wrote:
   But how do you set the defualt option without
 submit the form?
   action.execute() need the HttpServletRequest
 object, and this object is
 got
   from a submitting of a form in jsp.
   Maybe I am wrong, could give me a valid code
 segment example?
  
   Adam Hardy [EMAIL PROTECTED]
 wrote in message
   news:[EMAIL PROTECTED]
  
  Struts will automatically mark the selected
 option when the value of the
  select box field/property in the actionform is
 set.
  
  So if you want to set one option as default in a
 blank form, set the
  actionform property to the value of the option
 you want. Preferably in
  the action.execute() so you don't muddle your
 jsp unnecessarily.
  
  Adam
  
  Caroline Jen wrote:
  
  I have similar questions.  What is the syntax
 of the
  html:option tag?
  
  Just take the example given by you, are the
 codes
  shown below correct?  Will the default
 selection
  shown?
  
  html:select property=select1
   html:option property=1
 labelProperty=first
   html:option property=2
 labelProperty=second
   html:option property=3
 labelProperty=third
  /html:select
  
  JPJ
  
  --- leonZ [EMAIL PROTECTED] wrote:
  
  
  I make it more clear here:
  
  A normal html:
  select name=select1
   option value=1first/option
   option value=2
 SELECTEDsecond/option
   option value=3third/option
  /select
  
  how can I use the 'SELECTED' to set a defualt
 option
  with struts tags.
  html:select property=select1
 html:option
 ...
  /html:select
  
  leon [EMAIL PROTECTED] wrote in message
  news:[EMAIL PROTECTED]
  
  
  I am a beginner of struts. I can't use the
  
  'selected' property of the
  select
  
  
  tag in struts to set the default selection
 like I
  
  used it in a normal
  html.
  
  
  It's happened in 'checked' property of struts
  
  radio tag. Could you tell me
  
  
  how to set a defualt selection.
  
  
  
  
  
 

-
  
  
  To unsubscribe, e-mail:
  [EMAIL PROTECTED]
  For additional commands, e-mail:
  [EMAIL PROTECTED]
  
  
  
  
  __
  Do you Yahoo!?
  SBC Yahoo! DSL - Now only $29.95 per month!
  http://sbc.yahoo.com
  
 

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

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

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


__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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



Re: How can I set the defualt selection?

2003-07-08 Thread leonZ
example.jsp code segment:
...
input type=hidden name=submit_flag value=1
html:select property=type
html:option value=11/html:option
html:option value=22/html:option
html:option value=33/html:option
/html:select
...

Don't forget adding the set and get method for submit_flag to the
exampleForm.java

exampleAction.java code segment:
...
public ActionForward perform(ActionMapping actionMapping, ActionForm
actionForm, HttpServletRequest httpServletRequest, HttpServletResponse
httpServletResponse) {
MessageResources messages = getResources();
Locale locale = getLocale(httpServletRequest);
String flag =
httpServletRequest.getParameter(submit_flag)==null?:httpServletRequest.g
etParameter(submit_flag);
if(flag.equals()){
( (exampleForm) actionForm).setType(2);  /** set the defualt
selection **/
return (new ActionForward(actionMapping.getInput()));   /**
here the example.jsp will be show  **/
}
..
...
}

and you have to visit the exampleAction(something like exampleAction.do)
instead of example.jsp for the webpage view.

that's my solution, I hope it will be helpful.






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



Re: How can I set the defualt selection?

2003-07-07 Thread Adam Hardy
Struts will automatically mark the selected option when the value of the 
select box field/property in the actionform is set.

So if you want to set one option as default in a blank form, set the 
actionform property to the value of the option you want. Preferably in 
the action.execute() so you don't muddle your jsp unnecessarily.

Adam

Caroline Jen wrote:
I have similar questions.  What is the syntax of the
html:option tag?
Just take the example given by you, are the codes
shown below correct?  Will the default selection
shown?
html:select property=select1
 html:option property=1 labelProperty=first
 html:option property=2 labelProperty=second
 html:option property=3 labelProperty=third
/html:select
JPJ

--- leonZ [EMAIL PROTECTED] wrote:

I make it more clear here:

A normal html:
select name=select1
 option value=1first/option
 option value=2 SELECTEDsecond/option
 option value=3third/option
/select
how can I use the 'SELECTED' to set a defualt option
with struts tags.
html:select property=select1
   html:option
   ...
/html:select
leon [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I am a beginner of struts. I can't use the
'selected' property of the
select
tag in struts to set the default selection like I
used it in a normal
html.
It's happened in 'checked' property of struts
radio tag. Could you tell me

how to set a defualt selection.





-

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


__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



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


Re: How can I set the defualt selection?

2003-07-07 Thread leonZ
But how do you set the defualt option without submit the form?
action.execute() need the HttpServletRequest object, and this object is got
from a submitting of a form in jsp.
Maybe I am wrong, could give me a valid code segment example?

Adam Hardy [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Struts will automatically mark the selected option when the value of the
 select box field/property in the actionform is set.

 So if you want to set one option as default in a blank form, set the
 actionform property to the value of the option you want. Preferably in
 the action.execute() so you don't muddle your jsp unnecessarily.

 Adam

 Caroline Jen wrote:
  I have similar questions.  What is the syntax of the
  html:option tag?
 
  Just take the example given by you, are the codes
  shown below correct?  Will the default selection
  shown?
 
  html:select property=select1
   html:option property=1 labelProperty=first
   html:option property=2 labelProperty=second
   html:option property=3 labelProperty=third
  /html:select
 
  JPJ
 
  --- leonZ [EMAIL PROTECTED] wrote:
 
 I make it more clear here:
 
 A normal html:
 select name=select1
   option value=1first/option
   option value=2 SELECTEDsecond/option
   option value=3third/option
 /select
 
 how can I use the 'SELECTED' to set a defualt option
 with struts tags.
 html:select property=select1
 html:option
 ...
 /html:select
 
 leon [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 
 I am a beginner of struts. I can't use the
 
 'selected' property of the
 select
 
 tag in struts to set the default selection like I
 
 used it in a normal
 html.
 
 It's happened in 'checked' property of struts
 
 radio tag. Could you tell me
 
 how to set a defualt selection.
 
 
 
 
 
  -
 
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 
 
 
  __
  Do you Yahoo!?
  SBC Yahoo! DSL - Now only $29.95 per month!
  http://sbc.yahoo.com
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 




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



Re: How can I set the defualt selection?

2003-07-06 Thread leonZ
I make it more clear here:

A normal html:
select name=select1
  option value=1first/option
  option value=2 SELECTEDsecond/option
  option value=3third/option
/select

how can I use the 'SELECTED' to set a defualt option with struts tags.
html:select property=select1
html:option
...
/html:select

leon [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I am a beginner of struts. I can't use the 'selected' property of the
select
 tag in struts to set the default selection like I used it in a normal
html.
 It's happened in 'checked' property of struts radio tag. Could you tell me
 how to set a defualt selection.




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



Re: How can I set the defualt selection?

2003-07-06 Thread Caroline Jen
I have similar questions.  What is the syntax of the
html:option tag?

Just take the example given by you, are the codes
shown below correct?  Will the default selection
shown?

html:select property=select1
 html:option property=1 labelProperty=first
 html:option property=2 labelProperty=second
 html:option property=3 labelProperty=third
/html:select

JPJ

--- leonZ [EMAIL PROTECTED] wrote:
 I make it more clear here:
 
 A normal html:
 select name=select1
   option value=1first/option
   option value=2 SELECTEDsecond/option
   option value=3third/option
 /select
 
 how can I use the 'SELECTED' to set a defualt option
 with struts tags.
 html:select property=select1
 html:option
 ...
 /html:select
 
 leon [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  I am a beginner of struts. I can't use the
 'selected' property of the
 select
  tag in struts to set the default selection like I
 used it in a normal
 html.
  It's happened in 'checked' property of struts
 radio tag. Could you tell me
  how to set a defualt selection.
 
 
 
 

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


__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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