RE: Problem using session var

2005-05-11 Thread David G. Friedman
Rafael,

Your try/catch lists YOUR setter as:

tipocambio.setstrValor()

This suggests you make your getter tipocambio.getstrValor().  Unfortunately,
bean:write capitalizes the first letter of the property so bean:write is
trying to invoke 1stTipoCambio.getStrValor(), not your
1stTipoCambio.getstrValor() (Note the Str versus str in the setter which
you probably used the same way in your getter) method as suggested by your
example code.

Regards,
David

-Original Message-
From: Rafael Taboada [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 11, 2005 7:54 PM
To: Struts List
Subject: Problem using session var


 Hi folks. I have a problem using session variables, I hope u can help me.

 In my jsp:

 bean:write name=lstTipoCambio property=strValor /

In my action:

 if (session.getAttribute(lstTipoCambio)==null)
 session.setAttribute(lstTipoCambio,articuloDAO.getTipoCambio());

In my DAO:

getTipoCambio returns a Collection, a set of TipoCambio objects.

try {
StringBuffer sbSelect = new StringBuffer();

sbSelect.append(select TCA_VALOR_F );
sbSelect.append(from SCR_TIPOCAMBIO_TCA);
stmtSelect = conn.prepareStatement(sbSelect.toString());
rs = stmtSelect.executeQuery();

while (rs.next()) {
TipoCambio tipocambio = new TipoCambioImpl();

tipocambio.setstrValor(rs.getString(TCA_VALOR_F));
collResultado.add(tipocambio);
}
}


Off course TipoCambio is a bean with getters and setters method for
each attribute.

And the error:

 javax.servlet.ServletException: No getter method for property
strValor of bean lstTipoCambio

org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContext
Impl.java:846)

org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextIm
pl.java:779)

org.apache.jsp.pages.Articulos_002dNuevo_jsp._jspService(Articulos_002dNuev
o_jsp.java:525)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:
325)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilte
r.java:362)

org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1
056)

org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcess
or.java:261)

org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProce
ssor.java:388)

org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesReq
uestProcessor.java:316)

org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:231
)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilte
r.java:362)


Please, can u know why?. If I have a TipoCambio bean with getters and
setter method...

 THanks for ur help
--

 Rafael Taboada

-
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: Problem using session var

2005-05-11 Thread Rafael Taboada
 I didn't know about capitalization of bean:write.

 So, how can i know in order to print some data in my jsp?. using
session vars...

 Using JSTL?..

 I don't know.


-- 

 Rafael Taboada

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



Re: Problem using session var

2005-05-11 Thread Larry Meadors
This has nothing to do with sessions - it is just standard bean naming, and 
AFAIK, all jsp tags will stick to this. 

The methods getXxx and setXxx create a property named xxx.

One more naming issue to watch out for is this one: The methods getXName and 
setXName create a property named XName, not xName - if the first 2 letters 
are uppercase, the name is taken exactly.

If you cannot rename the methods, then I think you are stuck with using a 
scriptlet. :-(

Larry


On 5/11/05, Rafael Taboada [EMAIL PROTECTED] wrote:
 
 I didn't know about capitalization of bean:write.
 
 So, how can i know in order to print some data in my jsp?. using
 session vars...
 
 Using JSTL?..
 
 I don't know.
 
 --
 
 Rafael Taboada
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: Problem using session var

2005-05-11 Thread Rafael Taboada
 I renamed my methods but nothing happened.

 My new getters and setters:

 getStrValor()
 setStrValor()

 But it's still the same error.

 But I did this:

logic:iterate id=lista name=lstTipoCambio
   bean:write name=lista property=strValor /
/logic:iterate

 And it worked Do u know why? Because lstTipoCambio is a
collection object???.

 And why don't work renaming my methods like Larry said???

-- 

 Rafael Taboada

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



RE: Problem using session var

2005-05-11 Thread David G. Friedman
Rafael,

Are you sure you used the logic:iterate with the old method signatures and
not the new case sensitive getters and setters?

Regards,
David

-Original Message-
From: Rafael Taboada [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 11, 2005 9:44 PM
Cc: Struts Users Mailing List
Subject: Re: Problem using session var


 I renamed my methods but nothing happened.

 My new getters and setters:

 getStrValor()
 setStrValor()

 But it's still the same error.

 But I did this:

logic:iterate id=lista name=lstTipoCambio
   bean:write name=lista property=strValor /
/logic:iterate

 And it worked Do u know why? Because lstTipoCambio is a
collection object???.

 And why don't work renaming my methods like Larry said???

--

 Rafael Taboada

-
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: Problem using session var

2005-05-11 Thread Rafael Taboada
 Yes, I used logic:iterate with getstrValor and setstrValor and it worked fine..

 But I tried with logic:iterate and getStrValor and setStrValor and it
worked too...

 So, what's the problem???... Is my

 bean:write name=lstTipoCambio property=strValor /

 Has it to be inside a iteration method??? Because lstTipoCambio is a collection

 Id tried withouth logic:iterate and getStrValor and setStrValor but
it didn't worked...
 


-- 

 Rafael Taboada

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



Re: Problem using session var

2005-05-11 Thread Rafael Taboada
 My bad... I cleaned and rebuilt and

 It works without logic:iterate and getStrValor and setStrValor and
strValor attribute. :)

 But. Why does it work using logic:iterate and getstrValor and setstrValor?

 Thanks for help me.


-- 

 Rafael Taboada

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



Re: Problem using session var

2005-05-11 Thread Lucas Bern
Hi!
bean write tag just takes a bean under name key form the scope where you 
indicates with scope or with findAttrinute searching in every scopes if you 
omit the scope attribute.
Once the bean is found, the tag, takes the value of the property attribute as 
String and 
-first replace the first letter of this string by the same letter capitalized,
-seccond concats this result to the String get 
-finally the result ys a String with the form getXayz if the ptoprty value of 
the tag were xayz
 
So the tag has two elements, a bean, and the name of a method, a getter...
Via reflection api the getter is executed over the bean, and the result is 
printed in the screen...
 
all this work is done with common bean utils component so i recommend you visit 
the page
 
finally the tag will  be trying to execute the method getStrValue, on a Set, 
and this getter is never found
so you get an exception
 
i wish it hepls...
Lucas


Rafael Taboada [EMAIL PROTECTED] escribió:
Yes, I used logic:iterate with getstrValor and setstrValor and it worked fine..

But I tried with logic:iterate and getStrValor and setStrValor and it
worked too...

So, what's the problem???... Is my



Has it to be inside a iteration method??? Because lstTipoCambio is a collection

Id tried withouth logic:iterate and getStrValor and setStrValor but
it didn't worked...



-- 

Rafael Taboada

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




-
 A tu celular ¿no le falta algo?
 Usá Yahoo! Messenger y Correo Yahoo! en tu teléfono celular.
 Más información aquí.