You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Syed Ibrahim <sy...@paradyne.co.in> on 2007/04/04 12:24:21 UTC

properties file

Hi All,

Am going through struts2-blank-2.0.6 project, there is HelloWorld.jsp file,
while executing this file it searches for package.properties file which is
not defined in the HelloWorld.jsp.

Can anybody please let me know where it is defined.

Thanks a lot.

Ibrahim



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: properties file

Posted by Syed Ibrahim <sy...@paradyne.co.in>.
Thanks lot Victor.

Ibrahim

-----Original Message-----
From: VictorR [mailto:victor@v-code.org] 
Sent: Wednesday, April 04, 2007 4:07 PM
To: user@struts.apache.org
Subject: Re: properties file


Hi Ibrahim,

I don't know where defined is, but if you want you can change this behavior
setting the "struts.custom.i18n.resources" property as a constant into the
struts.xml file. 

<constant name="struts.custom.i18n.resources"
value="path.to.your.application_resources" />

Note the value must not contains ".properties" sufix!!

regards,



__Billa__ wrote:
> 
> 
> Hi All,
> 
> Am going through struts2-blank-2.0.6 project, there is HelloWorld.jsp
> file,
> while executing this file it searches for package.properties file which is
> not defined in the HelloWorld.jsp.
> 
> Can anybody please let me know where it is defined.
> 
> Thanks a lot.
> 
> Ibrahim
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context:
http://www.nabble.com/Struts-2-scope-tf3524836.html#a9834585
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: properties file

Posted by VictorR <vi...@v-code.org>.
Hi Ibrahim,

I don't know where defined is, but if you want you can change this behavior
setting the "struts.custom.i18n.resources" property as a constant into the
struts.xml file. 

<constant name="struts.custom.i18n.resources"
value="path.to.your.application_resources" />

Note the value must not contains ".properties" sufix!!

regards,



__Billa__ wrote:
> 
> 
> Hi All,
> 
> Am going through struts2-blank-2.0.6 project, there is HelloWorld.jsp
> file,
> while executing this file it searches for package.properties file which is
> not defined in the HelloWorld.jsp.
> 
> Can anybody please let me know where it is defined.
> 
> Thanks a lot.
> 
> Ibrahim
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Struts-2-scope-tf3524836.html#a9834585
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


unsibscribe

Posted by Levan Dvalishvili <dv...@verticali.com>.
unsubscribe

-----Original Message-----
From: Marcello Savino [mailto:Marcello.Savino@aldebra.com] 
Sent: Wednesday, April 04, 2007 8:35 AM
To: Struts Users Mailing List
Subject: Iterating over a List of JavaBean

Hi all,
In a jsp file i need to iterate over an ArrayList of javabean :

The bean:

public class myBean implements java.io.Serializable{
	private Integer code;
	private String name;
	
	public Integer getCode(){return code;}
	public String getName(){return name;}
	
	public void setCode(Integer val){ code=val;}
	public void setName(String val){ name=val;}
	
}

In the action class i set the form.list variable:
...
public ActionForward list(
	        ActionMapping mapping,
	        ActionForm form,
	        HttpServletRequest request,
	        HttpServletResponse response)
	        throws IOException, ServletException {
				try {
					myBean[] l;
					l=getMyBeanArray();
					((ActionFormBase)form).list=new
ArrayList();
					for (int i=0;i<l.length;i++){
	
((ActionFormBase)form).lista.add(l);	
					}
					request.setAttribute("lista",
((ActionFormBase)form).lista);
				} catch (Exception e){
	
((ActionFormBase)form).ErrMessage=e.getMessage() ;
				}
			return(mapping.getInputForward() );
}
...
And this is my jsp code:
...
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
...
<logic:iterate id="index" name="lista" type="myBean">
	<bean:write name="index" property="code"/>
	<bean:write name="index" property="name"/>
</logic:iterate>

But what i get is an Exception:
java.lang.ClassCastException: [LmyBean;

Any help will be greatly appreciated.
Thanks in advance

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


R: Iterating over a List of JavaBean

Posted by Marcello Savino <Ma...@aldebra.com>.
My sight is getting worst so fast  ! Sob !
Of course , now it works!
Thanks a lot to everybody !

Marcello Savino
ALDEBRA S.p.A. 
tel.  0461302441

-----Messaggio originale-----
Da: Antonio Petrelli [mailto:antonio.petrelli@gmail.com] 
Inviato: mercoledì 4 aprile 2007 14.43
A: Struts Users Mailing List
Oggetto: Re: Iterating over a List of JavaBean

2007/4/4, Marcello Savino <Ma...@aldebra.com>:
>                                         for (int i=0;i<l.length;i++){
>
> ((ActionFormBase)form).lista.add(l);
>                                         }

It seems like a bug, you are putting the array in the list a lot of times :-)

Antonio

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Iterating over a List of JavaBean

Posted by Antonio Petrelli <an...@gmail.com>.
2007/4/4, Marcello Savino <Ma...@aldebra.com>:
>                                         for (int i=0;i<l.length;i++){
>
> ((ActionFormBase)form).lista.add(l);
>                                         }

It seems like a bug, you are putting the array in the list a lot of times :-)

Antonio

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Iterating over a List of JavaBean

Posted by "Raghupathy, Gurumoorthy" <Gu...@nielsen.com>.
Remove the type="myBean" from your jsp and try 

Regards
Guru
 
------------------------------------------------------------------------
-----------
Gurumoorthy Raghupathy
Email  :  gurumoorthy.raghupathy@vnuinc.co.uk
Internal Extn : 2337 
External Phone  : 01483712337 
Nielsen Book
3rd Floor Midas House
62 Goldsworth Road
Woking Surrey GU21 6LQ
Visit us at  : http://www.nielsenbookdata.co.uk/ 
------------------------------------------------------------------------
-----------
-----Original Message-----
From: Marcello Savino [mailto:Marcello.Savino@aldebra.com] 
Sent: 04 April 2007 13:35
To: Struts Users Mailing List
Subject: Iterating over a List of JavaBean

Hi all,
In a jsp file i need to iterate over an ArrayList of javabean :

The bean:

public class myBean implements java.io.Serializable{
	private Integer code;
	private String name;
	
	public Integer getCode(){return code;}
	public String getName(){return name;}
	
	public void setCode(Integer val){ code=val;}
	public void setName(String val){ name=val;}
	
}

In the action class i set the form.list variable:
...
public ActionForward list(
	        ActionMapping mapping,
	        ActionForm form,
	        HttpServletRequest request,
	        HttpServletResponse response)
	        throws IOException, ServletException {
				try {
					myBean[] l;
					l=getMyBeanArray();
					((ActionFormBase)form).list=new
ArrayList();
					for (int i=0;i<l.length;i++){
	
((ActionFormBase)form).lista.add(l);	
					}
					request.setAttribute("lista",
((ActionFormBase)form).lista);
				} catch (Exception e){
	
((ActionFormBase)form).ErrMessage=e.getMessage() ;
				}
			return(mapping.getInputForward() );
}
...
And this is my jsp code:
...
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
...
<logic:iterate id="index" name="lista" type="myBean">
	<bean:write name="index" property="code"/>
	<bean:write name="index" property="name"/>
</logic:iterate>

But what i get is an Exception:
java.lang.ClassCastException: [LmyBean;

Any help will be greatly appreciated.
Thanks in advance

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Iterating over a List of JavaBean

Posted by Dave Newton <ne...@yahoo.com>.
--- Marcello Savino wrote:
> for (int i = 0; i < l.length; i++) {
>     ((ActionFormBase) form).lista.add(l);
> }

You may mean l[i] here.

Tip o' the day: cast your form once, early; it's much
easier to read.

d.



 
____________________________________________________________________________________
It's here! Your new message!  
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Iterating over a List of JavaBean

Posted by Marcello Savino <Ma...@aldebra.com>.
Hi all,
In a jsp file i need to iterate over an ArrayList of javabean :

The bean:

public class myBean implements java.io.Serializable{
	private Integer code;
	private String name;
	
	public Integer getCode(){return code;}
	public String getName(){return name;}
	
	public void setCode(Integer val){ code=val;}
	public void setName(String val){ name=val;}
	
}

In the action class i set the form.list variable:
...
public ActionForward list(
	        ActionMapping mapping,
	        ActionForm form,
	        HttpServletRequest request,
	        HttpServletResponse response)
	        throws IOException, ServletException {
				try {
					myBean[] l;
					l=getMyBeanArray();
					((ActionFormBase)form).list=new
ArrayList();
					for (int i=0;i<l.length;i++){
	
((ActionFormBase)form).lista.add(l);	
					}
					request.setAttribute("lista",
((ActionFormBase)form).lista);
				} catch (Exception e){
	
((ActionFormBase)form).ErrMessage=e.getMessage() ;
				}
			return(mapping.getInputForward() );
}
...
And this is my jsp code:
...
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
...
<logic:iterate id="index" name="lista" type="myBean">
	<bean:write name="index" property="code"/>
	<bean:write name="index" property="name"/>
</logic:iterate>

But what i get is an Exception:
java.lang.ClassCastException: [LmyBean;

Any help will be greatly appreciated.
Thanks in advance

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: properties file

Posted by Syed Ibrahim <sy...@paradyne.co.in>.
Thanks Dave.

-----Original Message-----
From: Dave Newton [mailto:newton.dave@yahoo.com] 
Sent: Wednesday, April 04, 2007 5:12 PM
To: Struts Users Mailing List
Subject: Re: properties file

--- Syed Ibrahim <sy...@paradyne.co.in> wrote:
> Am going through struts2-blank-2.0.6 project, there
> is HelloWorld.jsp file, while executing this file it

> searches for package.properties file which is
> not defined in the HelloWorld.jsp.
> 
> Can anybody please let me know where it is defined.

/WEB-INF/src/java/example

package.properties files live in the package of the
class(es) that references it.

http://struts.apache.org/2.x/docs/localizing-output.html

d.



 
____________________________________________________________________________
________
Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives.
http://tools.search.yahoo.com/toolbar/features/mail/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: properties file

Posted by Dave Newton <ne...@yahoo.com>.
--- Syed Ibrahim <sy...@paradyne.co.in> wrote:
> Am going through struts2-blank-2.0.6 project, there
> is HelloWorld.jsp file, while executing this file it

> searches for package.properties file which is
> not defined in the HelloWorld.jsp.
> 
> Can anybody please let me know where it is defined.

/WEB-INF/src/java/example

package.properties files live in the package of the
class(es) that references it.

http://struts.apache.org/2.x/docs/localizing-output.html

d.



 
____________________________________________________________________________________
Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives.
http://tools.search.yahoo.com/toolbar/features/mail/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org