Re: Using Bean Tag inside html Tag. Urgent

2003-06-09 Thread Zhu He
Does that mean bean:define id=styleClassStr name=loginAF
property=useStyleClass type=java.lang.String/
is equivalent of
% String styleClassStr = loginAF.getUseStyleClass(); %
or
% String styleClassStr =
request.getAttribute(loginAF).getUseStyleClass();
//with proper casting.
%

One thing confuses me is a bean used by struts tag sometimes is obj stored
in request/session, sometimes is variable that can be used by jsp scriplet.
If someone could please clearify this for a newbie, I'd really appreciate
it.

thx
Zhu He

- Original Message -
From: Roy Porter [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Monday, June 09, 2003 11:33 AM
Subject: Re: Using Bean Tag inside html Tag. Urgent


 One option:

 bean:define id=styleClassStr name=loginAF property=useStyleClass
 type=java.lang.String/
 html:text property=userName styleClass=%= styleClassStr %/



 Anurag Garg wrote:

 Any solutions how to solve my this problem then. I need urgent help??
 
 -Original Message-
 From: Josh Rayls [mailto:[EMAIL PROTECTED]
 Sent: Monday, June 09, 2003 8:46 PM
 To: 'Struts Users Mailing List'
 Subject: RE: Using Bean Tag inside html Tag. Urgent
 
 
 You can't nest tags as properties in other tags.
 
 -Josh
 
 -Original Message-
 From: Anurag Garg [mailto:[EMAIL PROTECTED]
 Sent: Monday, June 09, 2003 11:20 AM
 To: [EMAIL PROTECTED]
 Subject: Using Bean Tag inside html Tag. Urgent
 
 
 Hi,
 
  I am facing problem in using bean:write / tag inside html:text
 /.
  What I am trying to do is something like this
  html:text property=userName styleClass=bean:write
 name=\loginAF\
 property=\useStyleClass\ /  /
  I am not getting the output I am expecting. I expect to get the
 value
 stored in useStyleClass in styleClass attribute but What I am
 getting in
 styleClass is the entire tag i.e. bean:write tag.
  Any solutions for this problem.
 
 Anurag Garg
 
 
 -
 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]



newbiew Q: how to do redirect instead of forward

2003-06-06 Thread Zhu He
for forward we usually do
execute() {
...
return mapping.findForward(listing);
}

I tried to use redirect by
execute() {
  ActionForward af = mapping.findForward(listing);
  af.setRedirect(true);
  return af;
}

but get exception
javax.servlet.ServletException: Configuration is frozen
at 
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:541)
at 
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:482)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1420)


Re: newbiew Q: how to do redirect instead of forward

2003-06-06 Thread Zhu He
b)  plus the addressbar doesn't change.
this sometimes causes problem, for example starting from a fowarded page,
you go to another webpage, then go back you will not get the same page.

Zhu
- Original Message -
From: Brandon Goodin [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Thursday, June 05, 2003 4:48 PM
Subject: RE: newbiew Q: how to do redirect instead of forward


 1) You need to set your forward redirect=(true|false) in your
 struts-config.xml for that particular action mapping.
 2) The difference...
 a) redirect generates a whole new request by sending a header back to
the
 client you lose all of your request scope data.
 b) forward continues with the same request and arrives at the view with
 request object intact.

 RequestDispatcher vs response.redirect();

 Brandon Goodin

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 05, 2003 2:37 PM
 To: Struts Users Mailing List
 Subject: Re: newbiew Q: how to do redirect instead of forward




 This is probably a silly question, but what's the difference between
 forward and redirect?


 Thanx,
 Ian

 Ian D. Stewart
 Open Systems Engineer II
 Enterprise Midrange - Bank One Infrastructure  Operations
 [EMAIL PROTECTED]
 (614) 213-6100




 Zhu He [EMAIL PROTECTED] on 06/05/2003 04:16:07 PM

 Please respond to Struts Users Mailing List
   [EMAIL PROTECTED]

 To:   [EMAIL PROTECTED]
 cc:

 Subject:  newbiew Q: how to do redirect instead of forward



 for forward we usually do
 execute() {
 ...
 return mapping.findForward(listing);
 }

 I tried to use redirect by
 execute() {
   ActionForward af = mapping.findForward(listing);
   af.setRedirect(true);
   return af;
 }

 but get exception
 javax.servlet.ServletException: Configuration is frozen
  at

org.apache.struts.action.RequestProcessor.processException(RequestProcessor.
 java:541)

  at

org.apache.struts.action.RequestProcessor.processActionPerform(RequestProces
 sor.java:482)

  at

org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)

  at
 org.apache.struts.action.ActionServlet.process(ActionServlet.java:1420)








 This transmission may contain information that is privileged, confidential
 and/or exempt from disclosure under applicable law. If you are not the
 intended recipient, you are hereby notified that any disclosure, copying,
 distribution, or use of the information contained herein (including any
 reliance thereon) is STRICTLY PROHIBITED. If you received this
transmission
 in error, please immediately contact the sender and destroy the material
in
 its entirety, whether in electronic or hard copy format. Thank you.


 -
 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: newbiew Q: how to do redirect instead of forward

2003-06-06 Thread Zhu He

 Ok.  So, from the user's perspective, when we do a redirect, they are sent
 to a different location.  When we do a forward, they are not, even if the
 content changes?
The content changes to the content of the new page, but address bar stays
the same because all the forwarding is done on the server side.


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



Re: Action Form: HashMap

2003-06-06 Thread Zhu He
if you are using map backed actionForm, make sure getXXX() setXXX() where
XXX matches the name of the map.
In you case function names should be getMap() setMap()
- Original Message -
From: Ray Madigan [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Friday, June 06, 2003 9:37 AM
Subject: RE: Action Form: HashMap


 OK,  I made the following changes, and it didn't do what I expected.
 HELP!

 I added to the ActionForm:

 /**
  * The form HashMap
  */
 private HashMap map = new HashMap ( );

 public Object getStringMapped ( String key ) {
 return map.get ( key );
 }

 public void setStringMapped ( String key, String value ) {
 map.put ( key, value );
 }

 I modified the jsp as:
 html:form action='Foo.do'

 c:forEach var='element' items='${elements}' 
 html-el:text property='stringMapped ( ${element.element} )'
   value='${element.value}'/
 /c:forEach

 ...

 /thml:form

 When I look at the form in my DispatchAction map is always empty.

 Any help would be appreciated!

 -Original Message-
 From: David Graham [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 05, 2003 11:13 AM
 To: [EMAIL PROTECTED]
 Subject: Re: Action Form: HashMap


 Read the mapped properties section here:
 http://jakarta.apache.org/struts/faqs/indexedprops.html

 David


 From: Ray Madigan [EMAIL PROTECTED]
 Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Subject: Action Form: HashMap
 Date: Thu, 5 Jun 2003 11:00:12 -0700
 
 I have a form that has elements that I do not know the names of ahead
 of time.
 
 I want to have struts scrape the form into a map so the key is the name
 of the element and the value is the value of the element when it was
 submitted.
 
 I looked for an action form that acted like this.  Has anyone done it
 before, or is there a better way?
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 

 _
 Tired of spam? Get advanced junk mail protection with MSN 8.
 http://join.msn.com/?page=features/junkmail


 -
 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: Action Form: HashMap

2003-06-06 Thread Zhu He
In your jsp page, you have to specify your input as
html:text property=xxx(key)/
where xxx maps to the  map name.
see
http://jakarta.apache.org/struts/userGuide/building_controller.html#map_acti
on_form_classes
- Original Message -
From: Ray Madigan [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Friday, June 06, 2003 10:23 AM
Subject: RE: Action Form: HashMap


 I tried this and it also didn't work.  The get and set methods do not
 call the HashMap directly, cause a HashMap uses get and put.

 The geters and setters that I supply are the interface to the HashMap,
 and in this case could be a simple Properties class, if the result
 is a set of strings?  Is this correct, or am i confused?

 I appreciate your help!

 -Original Message-
 From: Zhu He [mailto:[EMAIL PROTECTED]
 Sent: Friday, June 06, 2003 7:04 AM
 To: Struts Users Mailing List
 Subject: Re: Action Form: HashMap


 if you are using map backed actionForm, make sure getXXX() setXXX() where
 XXX matches the name of the map.
 In you case function names should be getMap() setMap()
 - Original Message -
 From: Ray Madigan [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Sent: Friday, June 06, 2003 9:37 AM
 Subject: RE: Action Form: HashMap


  OK,  I made the following changes, and it didn't do what I expected.
  HELP!
 
  I added to the ActionForm:
 
  /**
   * The form HashMap
   */
  private HashMap map = new HashMap ( );
 
  public Object getStringMapped ( String key ) {
  return map.get ( key );
  }
 
  public void setStringMapped ( String key, String value ) {
  map.put ( key, value );
  }
 
  I modified the jsp as:
  html:form action='Foo.do'
 
  c:forEach var='element' items='${elements}' 
  html-el:text property='stringMapped ( ${element.element} )'
value='${element.value}'/
  /c:forEach
 
  ...
 
  /thml:form
 
  When I look at the form in my DispatchAction map is always empty.
 
  Any help would be appreciated!
 
  -Original Message-
  From: David Graham [mailto:[EMAIL PROTECTED]
  Sent: Thursday, June 05, 2003 11:13 AM
  To: [EMAIL PROTECTED]
  Subject: Re: Action Form: HashMap
 
 
  Read the mapped properties section here:
  http://jakarta.apache.org/struts/faqs/indexedprops.html
 
  David
 
 
  From: Ray Madigan [EMAIL PROTECTED]
  Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
  To: Struts Users Mailing List [EMAIL PROTECTED]
  Subject: Action Form: HashMap
  Date: Thu, 5 Jun 2003 11:00:12 -0700
  
  I have a form that has elements that I do not know the names of ahead
  of time.
  
  I want to have struts scrape the form into a map so the key is the name
  of the element and the value is the value of the element when it was
  submitted.
  
  I looked for an action form that acted like this.  Has anyone done it
  before, or is there a better way?
  
  
  
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
 
  _
  Tired of spam? Get advanced junk mail protection with MSN 8.
  http://join.msn.com/?page=features/junkmail
 
 
  -
  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]


 -
 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: Action Form: HashMap

2003-06-06 Thread Zhu He
Yes the name is important, but I have to change my previous statements a
little.

Using the one from online doc
public FooForm extends ActionForm {

private final Map values = new HashMap();

public void setValue(String key, Object value) {
values.put(key, value);
}

public Object getValue(String key) {
return values.get(key);
}

}
html:text property=value(foo)/The key of name matching is
property=value(foo) will trigger invocation of setValue(foo, )  and
getValue(foo)The name matching pattern is property=xxx(key) matches
function setXxx() getXxx()
The example you give is ActionForm to change java beans.
But set/get values from type Map doesn't fit into the bean coding
convention. That's where map backed ActionForm come into play in struts1.1


- Original Message -
From: Ray Madigan [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Friday, June 06, 2003 11:54 AM
Subject: RE: Action Form: HashMap


 Thanks for your response.  It still doesn't work.  I looked at the page
 you refered me to and the HashMap is names values and the getter/setter's
 are named getValue, and setValue.  Is the s at the end of the map name
 important.

 I changed my form/jsp to work with an element of a known name.

 in the form
 private String foo = null;

 public String getFoo ( ) {
 return foo;
 }

 public void setFoo ( String foo ) {
 this.foo = foo;
 }

 and the input tag becomes

 html-el:text property='${element.element}'
   value='${element.value}'/

 And it works like a champ.  Is there anything else I have to do
 to make the HashMap work?  Like use a different Base Form class?

 This seems easy enough?  I'm losing my mind!

 -Original Message-
 From: Zhu He [mailto:[EMAIL PROTECTED]
 Sent: Friday, June 06, 2003 8:13 AM
 To: Struts Users Mailing List
 Subject: Re: Action Form: HashMap


 In your jsp page, you have to specify your input as
 html:text property=xxx(key)/
 where xxx maps to the  map name.
 see

http://jakarta.apache.org/struts/userGuide/building_controller.html#map_acti
 on_form_classes
 - Original Message -
 From: Ray Madigan [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Sent: Friday, June 06, 2003 10:23 AM
 Subject: RE: Action Form: HashMap


  I tried this and it also didn't work.  The get and set methods do not
  call the HashMap directly, cause a HashMap uses get and put.
 
  The geters and setters that I supply are the interface to the HashMap,
  and in this case could be a simple Properties class, if the result
  is a set of strings?  Is this correct, or am i confused?
 
  I appreciate your help!
 
  -Original Message-
  From: Zhu He [mailto:[EMAIL PROTECTED]
  Sent: Friday, June 06, 2003 7:04 AM
  To: Struts Users Mailing List
  Subject: Re: Action Form: HashMap
 
 
  if you are using map backed actionForm, make sure getXXX() setXXX()
where
  XXX matches the name of the map.
  In you case function names should be getMap() setMap()
  - Original Message -
  From: Ray Madigan [EMAIL PROTECTED]
  To: Struts Users Mailing List [EMAIL PROTECTED]
  Sent: Friday, June 06, 2003 9:37 AM
  Subject: RE: Action Form: HashMap
 
 
   OK,  I made the following changes, and it didn't do what I expected.
   HELP!
  
   I added to the ActionForm:
  
   /**
* The form HashMap
*/
   private HashMap map = new HashMap ( );
  
   public Object getStringMapped ( String key ) {
   return map.get ( key );
   }
  
   public void setStringMapped ( String key, String value ) {
   map.put ( key, value );
   }
  
   I modified the jsp as:
   html:form action='Foo.do'
  
   c:forEach var='element' items='${elements}' 
   html-el:text property='stringMapped ( ${element.element} )'
 value='${element.value}'/
   /c:forEach
  
   ...
  
   /thml:form
  
   When I look at the form in my DispatchAction map is always empty.
  
   Any help would be appreciated!
  
   -Original Message-
   From: David Graham [mailto:[EMAIL PROTECTED]
   Sent: Thursday, June 05, 2003 11:13 AM
   To: [EMAIL PROTECTED]
   Subject: Re: Action Form: HashMap
  
  
   Read the mapped properties section here:
   http://jakarta.apache.org/struts/faqs/indexedprops.html
  
   David
  
  
   From: Ray Madigan [EMAIL PROTECTED]
   Reply-To: Struts Users Mailing List
[EMAIL PROTECTED]
   To: Struts Users Mailing List [EMAIL PROTECTED]
   Subject: Action Form: HashMap
   Date: Thu, 5 Jun 2003 11:00:12 -0700
   
   I have a form that has elements that I do not know the names of ahead
   of time.
   
   I want to have struts scrape the form into a map so the key is the
name
   of the element and the value is the value of the element when it was
   submitted.
   
   I looked for an action form that acted like this.  Has anyone done it
   before, or is there a better way

tags to compare properties of 2 bean.

2003-06-05 Thread Zhu He
Hi
We can use struts tag to compare the property of a bean to a value, like
logic:equal name=bean property=prop1
 scope=request value=value

Are there struts tags we can use to compare the properties of 2 beans
(without using any jsp scriplet)?

I am a newbie
thx for you patience.


Zhu