ActionForm's reset method is invoked twice ??

2003-09-09 Thread Fumitada Hattori
Hi gurus,

I wanna know that ActionForm's reset method is invoked twice ?
There's an action tag in my struts-config.xml.
action path=/Test
  type=example.Test
  name=TestForm
  scope=request

 forward name=success path=/top.jsp/
/action

and I got a jsp named test.jsp
html:form action=/Test

  html:submit value=submit/
/html:form

With my application, seems that both when I visite the test.jsp 
and I click the submit button, reset method is invoked.

Is it a normal operation ?

Thanks in advance.



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



Why is No getter method for property happening... damn.

2003-09-07 Thread Fumitada Hattori
Hi gurus,

I got a simple bean below.

public class Company {
   private static ArrayList list;
   private int id;
   private String name;

   static{
  list = new ArrayList();
  list.add(new Company(0,));
  list.add(new Company(1,MS));
  list.add(new Company(2,SUN));
  list.add(new Company(3,IBM));
  list.add(new Company(4,SYBASE));
   }

   public Company(){}

   public Company(int id, String name){
  this.id = id;
  this.name = name;
   }

   public int getId(){
  return id;
   }

   public String getName(){
  return name;
   }

   public static ArrayList getList(){
  return list;
   }
}
---

This bean is set into the application scope at tomcat starts.
sc.getServletContext().setAttribute(company,new Company());

In jsp, I try to get the bean like this.
logic:iterate id=id name=company property=list scope=application
   bean:write name=id property=name/BR
/logic:iterate

It's supposed to be showen like
MS
SUN
IBM
SYBASE

but I get the following error.
org.apache.jasper.JasperException: No getter method for property list of bean
company

why ?? I cannot figure out...damn.

Thanks in advance.




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



Re: Why is No getter method for property happening... damn.

2003-09-07 Thread Fumitada Hattori
Hi,

I fixed it.
It was becuase the method getList() was a staic method.

Thanks.




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



How can I construct STRUTS select options tag according to a parameter ?

2003-08-30 Thread Fumitada Hattori
Hi there.

How can I construct STRUTS select options tag according to a parameter ?

I got a jsp named example_1.jsp.
One accesses the page with a parameter like example_1.jsp?id=2 .
Now what I wanna do is that the example_1.jsp get the value of id
parameter and construct select options tag dynamically.

Like below...
String id = request.getParameter(id);
USBean us = (USBean)request.getServletContext().getAttribute(USBean);
StateBean state = us.getState(id);
ArrayList cities = state.getCities();

All Beans above are set in the application scope when tomcat starts.

I dont' know how to make us.getState(id) with STRUTS select options tag,
since USBean's getState( ) method requires a id parameter.

What I'm doing now is 
Using 1 more page ( actionExample.do ) right before 
the example_1.jsp.

One accesses the actionExample.do with the id parameter like 
actionExample.do?id=2 and forward to example_1.jsp

In the actionExample.do, get a value of the id parameter and 
StateBean accroding to the value.
Set the StateBean in session scope like below.

String id = request.getParameter(id);
USBean us = (USBean)request.getServletContext().getAttribute(USBean);
StateBean state = us.getState(id);
request.getSession(true).setAttribute(state,state);

then in example_1.jsp
html:select property=state 
html:options collection=cities property=id labelProperty=name /
/html:select

I don't wanna do this anymore...since eveytime users accesses the
actionExample.do , state bean is set in the session scope...
Isn't this too much work ???

Thanks in advance.





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



How to get a String object from request scope.

2003-08-27 Thread Fumitada Hattori
Hi gurus.

I got one Action servlet class and one jsp.
If the action servlet is successfully processed, it's forwarded to the
jsp.
In the Action servlet, there's a following statement.



String my_name = JACK;
request.setAttributte(MY_NAME,my_name);
return (mapping.findForward(success));


Now I wanna get the MY_NAME property with a struts tag in the jsp 
which is redirected from the Action servlet.
I don't know how to make it since the instance(my_name) in the action 
servlet is a just String Object...not a javabean.

Thanks in advance.

wolfgang



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