Re: Form data lost [S 1.3.8]

2012-07-31 Thread Anjib


 aren't default scope is session??
i am wondering if I am missing any other point other than scope.

On 7/31/2012 6:20 PM, Paul Benedict wrote:

I think you're losing the data because you're unintentionally creating
a new form. Make sure both actions refer to the form with the same
scope.

On Tue, Jul 31, 2012 at 11:09 AM, Anjib Mulepati  wrote:

Hi All,

I am using large form to input data. I have some validation code as well as
I have condition where if something goes wrong in execution of action it
will take the user back to the form.
My problem is when validation fail or form returned from action execution
all my form data are lost. How can I have form retain its data even after
fail?
I am using struts tag for form and session scope for form.

 

 *
 
 



 

 


   
 
 



 
 


public class CreateAgentForm extends org.apache.struts.action.ActionForm {
 ..

 public ActionErrors validate(ActionMapping mapping, HttpServletRequest
request) {
 ActionErrors errors = new ActionErrors();
 if (getAgentName() == null || getAgentName().length()<  1) {
 errors.add("createAgent", new
ActionMessage("error.agentName.required"));
 }
.
 return errors;
 }
}

Thanks,
Anjib

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


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






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



Re: Form data lost [S 1.3.8]

2012-07-31 Thread Paul Benedict
I think you're losing the data because you're unintentionally creating
a new form. Make sure both actions refer to the form with the same
scope.

On Tue, Jul 31, 2012 at 11:09 AM, Anjib Mulepati  wrote:
> Hi All,
>
> I am using large form to input data. I have some validation code as well as
> I have condition where if something goes wrong in execution of action it
> will take the user back to the form.
> My problem is when validation fail or form returned from action execution
> all my form data are lost. How can I have form retain its data even after
> fail?
> I am using struts tag for form and session scope for form.
>
>  focus="agentVersion">
>
>  key="label.agentVersion" />*
>  tabindex="1" titleKey="title.agentVersion" value="" />
> 
>
>
>
> 
>
> 
>
>
>type="com.anjib.actions.agencyadmin.CreateAgentAction"
> input="/showCreateAgent.do"
> name="CreateAgentForm"
> scope="session" >
> 
> 
>
>
>  type="com.anjib.actions.agencyadmin.ShowCreateAgentAction">
> 
> 
>
>
> public class CreateAgentForm extends org.apache.struts.action.ActionForm {
> ..
>
> public ActionErrors validate(ActionMapping mapping, HttpServletRequest
> request) {
> ActionErrors errors = new ActionErrors();
> if (getAgentName() == null || getAgentName().length() < 1) {
> errors.add("createAgent", new
> ActionMessage("error.agentName.required"));
> }
>.
> return errors;
> }
> }
>
> Thanks,
> Anjib
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>

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



Re: Form data lost [S 1.3.8]

2012-07-31 Thread Anjib Mulepati
I mean when form data are invalid, user get the message on top of the 
form but all data in filed get lost. It shows blank form with error 
message. i want to show previously entered data so that user can correct 
only invalid field.


On 7/31/2012 3:09 PM, Martin Gainty wrote:

could you define your intentions..?

when form validation fails you want to save the data?
what happens when form validation succeeds..do you invalidate the session?

Martin
__
Verzicht und Vertraulichkeitanmerkung

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene 
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede 
unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. 
Diese Nachricht dient lediglich dem Austausch von Informationen und 
entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten 
Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den 
Inhalt uebernehmen.




> Date: Tue, 31 Jul 2012 12:09:07 -0400
> From: anji...@hotmail.com
> To: user@struts.apache.org
> Subject: Form data lost [S 1.3.8]
>
> Hi All,
>
> I am using large form to input data. I have some validation code as 
well
> as I have condition where if something goes wrong in execution of 
action

> it will take the user back to the form.
> My problem is when validation fail or form returned from action
> execution all my form data are lost. How can I have form retain its 
data

> even after fail?
> I am using struts tag for form and session scope for form.
>
>  focus="agentVersion">
>
>  key="label.agentVersion" />*
>  styleId="agentVersion" tabindex="1" titleKey="title.agentVersion"
> value="" />
> 
>
> 
>
>  value="Create Agent" title="Create Agent" />
>
> 
>
>
>  type="com.anjib.actions.agencyadmin.CreateAgentAction"
> input="/showCreateAgent.do"
> name="CreateAgentForm"
> scope="session" >
> 
> 
>
>
>  type="com.anjib.actions.agencyadmin.ShowCreateAgentAction">
> 
> 
>
>
> public class CreateAgentForm extends 
org.apache.struts.action.ActionForm {

> ..
>
> public ActionErrors validate(ActionMapping mapping,
> HttpServletRequest request) {
> ActionErrors errors = new ActionErrors();
> if (getAgentName() == null || getAgentName().length() < 1) {
> errors.add("createAgent", new
> ActionMessage("error.agentName.required"));
> }
> .
> return errors;
> }
> }
>
> Thanks,
> Anjib
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>




Form data lost [S 1.3.8]

2012-07-31 Thread Anjib Mulepati

Hi All,

I am using large form to input data. I have some validation code as well 
as I have condition where if something goes wrong in execution of action 
it will take the user back to the form.
My problem is when validation fail or form returned from action 
execution all my form data are lost. How can I have form retain its data 
even after fail?

I am using struts tag for form and session scope for form.

focus="agentVersion">


key="label.agentVersion" />*
styleId="agentVersion" tabindex="1" titleKey="title.agentVersion" 
value="" />



   

value="Create Agent" title="Create Agent" />





  









public class CreateAgentForm extends org.apache.struts.action.ActionForm {
..

public ActionErrors validate(ActionMapping mapping, 
HttpServletRequest request) {

ActionErrors errors = new ActionErrors();
if (getAgentName() == null || getAgentName().length() < 1) {
errors.add("createAgent", new 
ActionMessage("error.agentName.required"));

}
   .
return errors;
}
}

Thanks,
Anjib

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



AW: File upload from JSP with "multipart/form-data" does not work on Weblogic v12c

2012-02-06 Thread Peter.Keller
I finally opened a service request at Oracle. They pointed me to Bug#13657792: 
"SERVLET 3.0 FILE UPLOAD BREAKS OTHER FILE UPLOAD FRAMEWORKS"

With Multipart file handling/upload now being covered as a standard nature of 
the Servlet 3.0 specification, it looks like the WLS 12c web container is 
eagerly gobbling the data before the framework gets a chance to see it.

According to Oracle support, the engineers are working on a solution.

Regards, Peter

-Ursprüngliche Nachricht-
Von: peter.kel...@meteoswiss.ch [mailto:peter.kel...@meteoswiss.ch] 
Gesendet: Mittwoch, 1. Februar 2012 13:47
An: user@struts.apache.org
Betreff: AW: File upload from JSP with "multipart/form-data" does not work on 
Weblogic v12c

I just tested the upload actions in the Struts 2 showcase and the findings are 
the same: the file upload is broken in Weblogic v12.1.1. Who will fix that? 
Thanks, Peter


-Ursprüngliche Nachricht-
Von: peter.kel...@meteoswiss.ch [mailto:peter.kel...@meteoswiss.ch] 
Gesendet: Dienstag, 31. Januar 2012 15:14
An: user@struts.apache.org
Betreff: File upload from JSP with "multipart/form-data" does not work on 
Weblogic v12c

Dear list

File upload from JSP with "multipart/form-data" does not work on Weblogic v12c 
which supports Java Servlet specification v3.0. The same code worked as 
expected for Weblogic v10.3.X which supports Java Servlet specification v2.4. 
The same code does NOT work with Struts v2.1.8 on Weblogic v12c.

Debugging the application with Weblogic running in Eclipse I found out, that 
ALL parameters given in the JSP form (data, contextTx) are simply ignored. The 
"method" attribute in the  tag is also ignored and therefore Struts 
always invokes the execute() method of the Struts action.

Please find the setup below.

Is this is a bug? Or is something wrong with the setup?

Thanks, Peter

web.xml:

 http://java.sun.com/xml/ns/j2ee"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";
version="2.4">

Datadispatcher Console
Datadispatcher Web


Tiles configuration file

org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG
/WEB-INF/tiles.xml




org.apache.struts2.tiles.StrutsTilesListener



tiles

org.apache.tiles.web.startup.TilesServlet
2



tiles-dispatch

org.apache.tiles.web.util.TilesDispatchServlet



tiles-dispatch
*.tiles



struts

org.apache.struts2.dispatcher.FilterDispatcher



struts
/*




struts.xml:


http://struts.apache.org/dtds/struts-2.3.dtd";>










 

upload.page
upload.page




JSP:

<%@ taglib prefix="s" uri="/struts-tags" %>

Upload
 
  Content Id
  Import File


Java Action:

package ch.meteoswiss.datadispatcher.console;

public class UploadAction extends ActionSupport {

private static final Logger logger = Logger.getLogger(UploadAction.class);

private String contentTx;

private File data;
private String dataContentType;
private String dataFileName;

public String execute() {
logger.info(" execute ");
return super.execute();
}
   
public String upload() throws Exception {
logger.info(" upload ");
logger.info("data = "+data);
logger.info("contentTx = "+contentTx);
return SUCCESS;
}
public void setContentTx(String contentTx) {
this.contentTx = contentTx;
}
public String getContentTx() {
return contentTx;
}
public void setData(File data) {
this.data = data;
}
public File getData() {
return data;
}
public void setDataContentType(String dataContentType) {
this.dataContentType = dataContentType;
}
public String getDataContentType() {
return dataContentType;
}
public void setDataFileName(String dataFileName) {
this.dataFileName = dataFileName;
}
public String getDataFileName() {
return dataFileName;
}
}
  



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


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


--

AW: File upload from JSP with "multipart/form-data" does not work on Weblogic v12c

2012-02-01 Thread Peter.Keller
I just tested the upload actions in the Struts 2 showcase and the findings are 
the same: the file upload is broken in Weblogic v12.1.1. Who will fix that? 
Thanks, Peter


-Ursprüngliche Nachricht-
Von: peter.kel...@meteoswiss.ch [mailto:peter.kel...@meteoswiss.ch] 
Gesendet: Dienstag, 31. Januar 2012 15:14
An: user@struts.apache.org
Betreff: File upload from JSP with "multipart/form-data" does not work on 
Weblogic v12c

Dear list

File upload from JSP with "multipart/form-data" does not work on Weblogic v12c 
which supports Java Servlet specification v3.0. The same code worked as 
expected for Weblogic v10.3.X which supports Java Servlet specification v2.4. 
The same code does NOT work with Struts v2.1.8 on Weblogic v12c.

Debugging the application with Weblogic running in Eclipse I found out, that 
ALL parameters given in the JSP form (data, contextTx) are simply ignored. The 
"method" attribute in the  tag is also ignored and therefore Struts 
always invokes the execute() method of the Struts action.

Please find the setup below.

Is this is a bug? Or is something wrong with the setup?

Thanks, Peter

web.xml:

 http://java.sun.com/xml/ns/j2ee"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";
version="2.4">

Datadispatcher Console
Datadispatcher Web


Tiles configuration file

org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG
/WEB-INF/tiles.xml




org.apache.struts2.tiles.StrutsTilesListener



tiles

org.apache.tiles.web.startup.TilesServlet
2



tiles-dispatch

org.apache.tiles.web.util.TilesDispatchServlet



tiles-dispatch
*.tiles



struts

org.apache.struts2.dispatcher.FilterDispatcher



struts
/*




struts.xml:


http://struts.apache.org/dtds/struts-2.3.dtd";>










 

upload.page
upload.page




JSP:

<%@ taglib prefix="s" uri="/struts-tags" %>

Upload
 
  Content Id
  Import File


Java Action:

package ch.meteoswiss.datadispatcher.console;

public class UploadAction extends ActionSupport {

private static final Logger logger = Logger.getLogger(UploadAction.class);

private String contentTx;

private File data;
private String dataContentType;
private String dataFileName;

public String execute() {
logger.info(" execute ");
return super.execute();
}
   
public String upload() throws Exception {
logger.info(" upload ");
logger.info("data = "+data);
logger.info("contentTx = "+contentTx);
return SUCCESS;
}
public void setContentTx(String contentTx) {
this.contentTx = contentTx;
}
public String getContentTx() {
return contentTx;
}
public void setData(File data) {
this.data = data;
}
public File getData() {
return data;
}
public void setDataContentType(String dataContentType) {
this.dataContentType = dataContentType;
}
public String getDataContentType() {
return dataContentType;
}
public void setDataFileName(String dataFileName) {
this.dataFileName = dataFileName;
}
public String getDataFileName() {
return dataFileName;
}
}
  



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


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



File upload from JSP with "multipart/form-data" does not work on Weblogic v12c

2012-01-31 Thread Peter.Keller
Dear list

File upload from JSP with "multipart/form-data" does not work on Weblogic v12c 
which supports Java Servlet specification v3.0. The same code worked as 
expected for Weblogic v10.3.X which supports Java Servlet specification v2.4. 
The same code does NOT work with Struts v2.1.8 on Weblogic v12c.

Debugging the application with Weblogic running in Eclipse I found out, that 
ALL parameters given in the JSP form (data, contextTx) are simply ignored. The 
"method" attribute in the  tag is also ignored and therefore Struts 
always invokes the execute() method of the Struts action.

Please find the setup below.

Is this is a bug? Or is something wrong with the setup?

Thanks, Peter

web.xml:

 http://java.sun.com/xml/ns/j2ee"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";
version="2.4">

Datadispatcher Console
Datadispatcher Web


Tiles configuration file

org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG
/WEB-INF/tiles.xml




org.apache.struts2.tiles.StrutsTilesListener



tiles

org.apache.tiles.web.startup.TilesServlet
2



tiles-dispatch

org.apache.tiles.web.util.TilesDispatchServlet



tiles-dispatch
*.tiles



struts

org.apache.struts2.dispatcher.FilterDispatcher



struts
/*




struts.xml:


http://struts.apache.org/dtds/struts-2.3.dtd";>










 

upload.page
upload.page




JSP:

<%@ taglib prefix="s" uri="/struts-tags" %>

Upload
 
  Content Id
  Import File


Java Action:

package ch.meteoswiss.datadispatcher.console;

public class UploadAction extends ActionSupport {

private static final Logger logger = Logger.getLogger(UploadAction.class);

private String contentTx;

private File data;
private String dataContentType;
private String dataFileName;

public String execute() {
logger.info(" execute ");
return super.execute();
}
   
public String upload() throws Exception {
logger.info(" upload ");
logger.info("data = "+data);
logger.info("contentTx = "+contentTx);
return SUCCESS;
}
public void setContentTx(String contentTx) {
this.contentTx = contentTx;
}
public String getContentTx() {
return contentTx;
}
public void setData(File data) {
this.data = data;
}
public File getData() {
return data;
}
public void setDataContentType(String dataContentType) {
this.dataContentType = dataContentType;
}
public String getDataContentType() {
return dataContentType;
}
public void setDataFileName(String dataFileName) {
this.dataFileName = dataFileName;
}
public String getDataFileName() {
return dataFileName;
}
}
  



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



Re: Multipart/Form-Data with Struts 1

2010-10-05 Thread DavidZaz

Yes, it only occurs under Internet Explorer. I've reproduced with IE 7 and 8.


Dave Newton-6 wrote:
> 
> If you're uploading a file, the form must be multipart.
> 
> Which version of IE? Is it only under IE that it happens?
> 
> Dave
> 
> On Tue, Oct 5, 2010 at 10:16 AM, DavidZaz  wrote:
> 
>>
>> I have a legacy application using Struts 1.2.8 and I have the following
>> HTML
>> form:
>>
>> > enctype="multipart/form-data">
>> > styleId="tinymce">
>> 
>>
>> If I include multiple blank lines in the tinyMCE editor, the generated
>> HTML
>> should be:
>>
>>  
>>
>> However, IE posts the following HTML:
>>
>> Â 
>>
>> At first glance, I thought that this was exclusively a tinyMCE problem
>> and
>> I
>> posted on their forum. However, the problem goes away when I remove the
>> enctype="multipart/form-data" from the html:form declaration. Does Struts
>> 1
>> do anything unusual with the enctype multipart/form-data attribute? It
>> does
>> not seem that other tinyMCE editor users are experiencing this issue
>> (since
>> they probably aren't using Struts 1).
>>
>> Is there any alternative to using multipart/form-data? My form does
>> include
>> a file upload which is why I initially added the multipart/form-data.
>> --
>> View this message in context:
>> http://old.nabble.com/Multipart-Form-Data-with-Struts-1-tp2988p2988.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Multipart-Form-Data-with-Struts-1-tp2988p29887895.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Multipart/Form-Data with Struts 1

2010-10-05 Thread Dave Newton
If you're uploading a file, the form must be multipart.

Which version of IE? Is it only under IE that it happens?

Dave

On Tue, Oct 5, 2010 at 10:16 AM, DavidZaz  wrote:

>
> I have a legacy application using Struts 1.2.8 and I have the following
> HTML
> form:
>
>  enctype="multipart/form-data">
>  styleId="tinymce">
> 
>
> If I include multiple blank lines in the tinyMCE editor, the generated HTML
> should be:
>
>  
>
> However, IE posts the following HTML:
>
> Â 
>
> At first glance, I thought that this was exclusively a tinyMCE problem and
> I
> posted on their forum. However, the problem goes away when I remove the
> enctype="multipart/form-data" from the html:form declaration. Does Struts 1
> do anything unusual with the enctype multipart/form-data attribute? It does
> not seem that other tinyMCE editor users are experiencing this issue (since
> they probably aren't using Struts 1).
>
> Is there any alternative to using multipart/form-data? My form does include
> a file upload which is why I initially added the multipart/form-data.
> --
> View this message in context:
> http://old.nabble.com/Multipart-Form-Data-with-Struts-1-tp2988p2988.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


Multipart/Form-Data with Struts 1

2010-10-05 Thread DavidZaz

I have a legacy application using Struts 1.2.8 and I have the following HTML
form:


 


If I include multiple blank lines in the tinyMCE editor, the generated HTML
should be:

 

However, IE posts the following HTML:

 

At first glance, I thought that this was exclusively a tinyMCE problem and I
posted on their forum. However, the problem goes away when I remove the
enctype="multipart/form-data" from the html:form declaration. Does Struts 1
do anything unusual with the enctype multipart/form-data attribute? It does
not seem that other tinyMCE editor users are experiencing this issue (since
they probably aren't using Struts 1).

Is there any alternative to using multipart/form-data? My form does include
a file upload which is why I initially added the multipart/form-data.
-- 
View this message in context: 
http://old.nabble.com/Multipart-Form-Data-with-Struts-1-tp2988p2988.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Set JSP timeout in struts 1 app with multipart/form-data form

2010-10-04 Thread Maurizio Cucchiara
Have you tried setting disableUploadTimeout variable on tomcat?

2010/10/4 Oscar :
> Well, i'm using Tomcat 6 for development but also i'm going to test in OAS
> because that will be the production environment.
>
> Regards.
>
> 2010/10/4 Maurizio Cucchiara 
>
>> Hi,
>> what application server are you using? Did you watch application server
>> logs?
>> I think the problem is related with your AS.
>> For instance, Tomcat have a disableUploadTimeout variable.
>>
>>
>> Maurizio Cucchiara
>>
>>
>> 2010/10/4 Oscar :
>> > Hi to all, i have a question about a situation that i have in my
>> > application. It's in Struts 1.1 . Basically, i have a multipart/form-data
>> > form in the jsp that contains 2 elements: a html:file control and a
>> > html:submit button . This form will be used to upload MS Access database
>> > file up to 800mb to extract it's data and pass it to Oracle. When i tried
>> > for first time, i selected the file and press the button. I monitored the
>> > request using Firebug extension on firefox and i saw when it sends the
>> file
>> > into the request, but after a while the browser resets the connection
>> > (request)  maybe because the request takes too long.
>> >
>> > And that happens when i test it locally, but imagine in production,
>> probably
>> > the upload will take more time depending of the connection, so i wanna
>> ask
>> > you Struts User mail list members, if somebody knows how to specify
>> > something like the "request timeout" to avoit the browser to reset the
>> > request.
>> >
>> > Thanks in advance.
>> >
>> >
>> > --
>> > Oscar Calderón
>> > SCJP 6  <http://javahowto.net>
>> >
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
>
>
> --
> Oscar Calderón
> SCJP 6  <http://javahowto.net>
>

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



Re: Set JSP timeout in struts 1 app with multipart/form-data form

2010-10-04 Thread Oscar
Well, i'm using Tomcat 6 for development but also i'm going to test in OAS
because that will be the production environment.

Regards.

2010/10/4 Maurizio Cucchiara 

> Hi,
> what application server are you using? Did you watch application server
> logs?
> I think the problem is related with your AS.
> For instance, Tomcat have a disableUploadTimeout variable.
>
>
> Maurizio Cucchiara
>
>
> 2010/10/4 Oscar :
> > Hi to all, i have a question about a situation that i have in my
> > application. It's in Struts 1.1 . Basically, i have a multipart/form-data
> > form in the jsp that contains 2 elements: a html:file control and a
> > html:submit button . This form will be used to upload MS Access database
> > file up to 800mb to extract it's data and pass it to Oracle. When i tried
> > for first time, i selected the file and press the button. I monitored the
> > request using Firebug extension on firefox and i saw when it sends the
> file
> > into the request, but after a while the browser resets the connection
> > (request)  maybe because the request takes too long.
> >
> > And that happens when i test it locally, but imagine in production,
> probably
> > the upload will take more time depending of the connection, so i wanna
> ask
> > you Struts User mail list members, if somebody knows how to specify
> > something like the "request timeout" to avoit the browser to reset the
> > request.
> >
> > Thanks in advance.
> >
> >
> > --
> > Oscar Calderón
> > SCJP 6  <http://javahowto.net>
> >
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


-- 
Oscar Calderón
SCJP 6  <http://javahowto.net>


Re: Set JSP timeout in struts 1 app with multipart/form-data form

2010-10-04 Thread Maurizio Cucchiara
Hi,
what application server are you using? Did you watch application server logs?
I think the problem is related with your AS.
For instance, Tomcat have a disableUploadTimeout variable.


Maurizio Cucchiara


2010/10/4 Oscar :
> Hi to all, i have a question about a situation that i have in my
> application. It's in Struts 1.1 . Basically, i have a multipart/form-data
> form in the jsp that contains 2 elements: a html:file control and a
> html:submit button . This form will be used to upload MS Access database
> file up to 800mb to extract it's data and pass it to Oracle. When i tried
> for first time, i selected the file and press the button. I monitored the
> request using Firebug extension on firefox and i saw when it sends the file
> into the request, but after a while the browser resets the connection
> (request)  maybe because the request takes too long.
>
> And that happens when i test it locally, but imagine in production, probably
> the upload will take more time depending of the connection, so i wanna ask
> you Struts User mail list members, if somebody knows how to specify
> something like the "request timeout" to avoit the browser to reset the
> request.
>
> Thanks in advance.
>
>
> --
> Oscar Calderón
> SCJP 6  <http://javahowto.net>
>

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



Set JSP timeout in struts 1 app with multipart/form-data form

2010-10-03 Thread Oscar
Hi to all, i have a question about a situation that i have in my
application. It's in Struts 1.1 . Basically, i have a multipart/form-data
form in the jsp that contains 2 elements: a html:file control and a
html:submit button . This form will be used to upload MS Access database
file up to 800mb to extract it's data and pass it to Oracle. When i tried
for first time, i selected the file and press the button. I monitored the
request using Firebug extension on firefox and i saw when it sends the file
into the request, but after a while the browser resets the connection
(request)  maybe because the request takes too long.

And that happens when i test it locally, but imagine in production, probably
the upload will take more time depending of the connection, so i wanna ask
you Struts User mail list members, if somebody knows how to specify
something like the "request timeout" to avoit the browser to reset the
request.

Thanks in advance.


-- 
Oscar Calderón
SCJP 6  <http://javahowto.net>


problem while reading multipart/form-data in struts

2009-12-15 Thread binash

We are using a validation framework to validate all input to our application.
This is implemented with a filter. In order to handle multipart form data
twice, we have created BufferedRequestWrapper class (as a sub class
'HttpServletRequestWrapper'). Now with this class I am able to get all the
form bean values in both filter class as well as in the struts ActionForms.
After saving the form data, i am redirecting the request to a jsp page which
includes global header page. In this included page i am getting following
error

java.lang.IllegalArgumentException: Cannot invoke Form.setCompanyLogo -
argument type mismatch.

In this page Struts try to populate(set methods) the form bean instead of
calling get methods. Here above exceptions is thrown in PropertiesUtil's
invoke method. please help to solve this problem. (we are not getting the
error if we pass Request objet instead of Wrapper object. in that case we
wont be able to get form data twice)

Wrapper class used is

public class BufferedRequestWrapper extends HttpServletRequestWrapper {

/**
 * The variable holds the Log4j instance to log the INFO, DEBUG, ERROR
and FATAL events.
 */
private static Logger LOG =
Logger.getLogger(BufferedRequestWrapper.class.getName());

ByteArrayInputStream bais;
ByteArrayOutputStream baos;
BufferedServletInputStream bsis;
byte[] buffer;
HttpServletRequest request =null;

public HttpServletRequest getHTTPRequest(){
return request;
}


public BufferedRequestWrapper(HttpServletRequest req) throws IOException
{
super(req);
this.request = req;
// Read InputStream and store its content in a buffer.
InputStream is = req.getInputStream();
baos = new ByteArrayOutputStream();
byte buf[] = new byte[1024];
int letti;
while ((letti = is.read(buf)) > 0)
baos.write(buf, 0, letti);
buffer = baos.toByteArray();
}

public ServletInputStream getInputStream() {
try {
// Generate a new InputStream by stored buffer
bais = new ByteArrayInputStream(buffer);
// Istantiate a subclass of ServletInputStream
// (Only ServletInputStream or subclasses of it are accepted by
the
// servlet engine!)
bsis = new BufferedServletInputStream(bais);
} catch (Exception ex) {
ex.printStackTrace();
} finally {
return bsis;
}
}


}

following code is  there in filter

if(request.getHeader(CONTENT_TYPE)!=null && isMultiPart() // checks if req
is multipart
 bufferedRequest = new BufferedRequestWrapper(request);
 //validate the input.
 Validator.validate(bufferedRequest);
 fc.doFilter(bufferedRequest, res);
  } else { // for normal request
 //validate the input.
 Validator.validate(request);
 fc.doFilter(req, res);
 }


exception thrown in jSP page is (this jsp page is part of view page after
the execution action class which handles form data)

19:49:22,785 ERROR [PropertyUtils] Method invocation failed.
java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:1773)
at
org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:1759)
at
org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java:1648)
at
org.apache.commons.beanutils.PropertyUtilsBean.setProperty(PropertyUtilsBean.java:1677)
at
org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1022)
at
org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:811)  
-- 
View this message in context: 
http://old.nabble.com/problem-while-reading-multipart-form-data-in-struts-tp26806463p26806463.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



RE: How to access the form data directly?

2009-11-15 Thread Neil Aggarwal
Juanjo:

> Uuuu it works, but... I prefer don't use scriptlet of 
> Java... Is
> there any way to use the tags like s:property or s:iterator?

I understand it is not as clean as using struts tags, but
I drop into using scriptlets when I can't figure out how
to do it with the tags.

If you can post a small example, I will try to see if I
can figure something out.

Neil

--
Neil Aggarwal, (281)846-8957, http://UnmeteredVPS.net
Host your struts app on a CentOS VPS for only $25/month!
Unmetered bandwidth, 7 day no risk trial, Google Checkout 


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



Re: How to access the form data directly?

2009-11-15 Thread Juanjo C
The data that I want to show is the bean (the values of their fields) that I
have declared in the ModelDriven... I think that this data are available in
the jsp...

Uff... It's difficult for me to express my question in English ...  sorry.

Thanks

2009/11/15 Musachy Barroso 

> where is the data that you want to show, in the action?
>
> musachy
>
> On Sat, Nov 14, 2009 at 6:55 PM, Juanjo C  wrote:
> > Hi,
> >
> > I have an action class that implements the interfaces ModelDriven and
> > Preparable with a bean that has data. And I have too an JSP that shows,
> > through s:textfield, the data to the user. It works fine.
> >
> > But I need show in other way the data, i.e. with s:property or
> s:iterator...
> > but I don't know where are this data... In the ValueStack?
> >
> > Any idea?
> >
> > sorry for my English
> >
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


Re: How to access the form data directly?

2009-11-15 Thread Juanjo C
Uuuu it works, but... I prefer don't use scriptlet of Java... Is
there any way to use the tags like s:property or s:iterator?

Thanks Neil.

2009/11/15 Neil Aggarwal 

> Juanjo:
>
> > but I don't know where are this data... In the ValueStack?
>
> I use this code in my JSP to retrieve values from
> the value stack:
>
> ActionContext.getContext().getValueStack().findValue("myValue");
>
> I hope that helps,
>Neil
>
> --
> Neil Aggarwal, (281)846-8957, http://UnmeteredVPS.net
> CentOS 5.4 VPS with unmetered bandwidth only $25/month!
> 7 day no risk trial, Google Checkout accepted
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


Re: How to access the form data directly?

2009-11-14 Thread Musachy Barroso
where is the data that you want to show, in the action?

musachy

On Sat, Nov 14, 2009 at 6:55 PM, Juanjo C  wrote:
> Hi,
>
> I have an action class that implements the interfaces ModelDriven and
> Preparable with a bean that has data. And I have too an JSP that shows,
> through s:textfield, the data to the user. It works fine.
>
> But I need show in other way the data, i.e. with s:property or s:iterator...
> but I don't know where are this data... In the ValueStack?
>
> Any idea?
>
> sorry for my English
>

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



RE: How to access the form data directly?

2009-11-14 Thread Neil Aggarwal
Juanjo:

> but I don't know where are this data... In the ValueStack?

I use this code in my JSP to retrieve values from
the value stack:

ActionContext.getContext().getValueStack().findValue("myValue");

I hope that helps,
Neil

--
Neil Aggarwal, (281)846-8957, http://UnmeteredVPS.net
CentOS 5.4 VPS with unmetered bandwidth only $25/month!
7 day no risk trial, Google Checkout accepted 


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



How to access the form data directly?

2009-11-14 Thread Juanjo C
Hi,

I have an action class that implements the interfaces ModelDriven and
Preparable with a bean that has data. And I have too an JSP that shows,
through s:textfield, the data to the user. It works fine.

But I need show in other way the data, i.e. with s:property or s:iterator...
but I don't know where are this data... In the ValueStack?

Any idea?

sorry for my English


Re: Struts 1 form data change

2009-10-07 Thread Paweł Wielgus
ould use.
>>>>>>>>
>>>>>>>> Paul
>>>>>>>>
>>>>>>>> On Mon, Oct 5, 2009 at 9:15 PM, SanJ.SANJAY 
>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> Thanks Paul,
>>>>>>>>>
>>>>>>>>>                 I thought about that also but selecting a tab isn't
>>>>>>>>> always
>>>>>>>>> mean that I change the data inside that tab.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Paul Benedict-2 wrote:
>>>>>>>>>>
>>>>>>>>>> SanJ,
>>>>>>>>>>
>>>>>>>>>> Can you track which tab the user selected? Perhaps you can set a
>>>>>>>>>> javascript variable when one is selected. The only down side here
>>>>>>>>>> is
>>>>>>>>>> that you'll have to hardcode which fields belong to which tab. Once
>>>>>>>>>> you do that, you can do what you want.
>>>>>>>>>>
>>>>>>>>>> Paul
>>>>>>>>>>
>>>>>>>>>> On Mon, Oct 5, 2009 at 7:42 PM, SanJ.SANJAY 
>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>> I am using struts 1. I have Adobe SPRY tabs in my JSP.
>>>>>>>>>>>
>>>>>>>>>>> There are two separate set of fields/ data in each tab. So suppose
>>>>>>>>>>> someone
>>>>>>>>>>> changes fields in Tab 2 only and save the JSP, I do not want to
>>>>>>>>>>> save
>>>>>>>>>>> the
>>>>>>>>>>> tab
>>>>>>>>>>> 1 fields also because those fields are not changed.
>>>>>>>>>>>
>>>>>>>>>>> I was wondering if there is any way I can distinguish that only
>>>>>>>>>>> TAB
>>>>>>>>>>> 2
>>>>>>>>>>> fields
>>>>>>>>>>> are changed so that I can process only those fields in action
>>>>>>>>>>> instead
>>>>>>>>>>> of
>>>>>>>>>>> processing all the JSP form fields.
>>>>>>>>>>>
>>>>>>>>>>> I would appreciate some inputs!
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>> View this message in context:
>>>>>>>>>>> http://www.nabble.com/Struts-1-form-data-change-tp25758644p25758644.html
>>>>>>>>>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> -
>>>>>>>>>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>>>>>>>>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> -
>>>>>>>>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>>>>>>>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> View this message in context:
>>>>>>>>> http://www.nabble.com/Struts-1-form-data-change-tp25758644p25761964.html
>>>>>>>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> -
>>>>>>>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>>>>>>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>> -
>>>>>>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>>>>>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> View this message in context:
>>>>>>> http://www.nabble.com/Struts-1-form-data-change-tp25758644p25762087.html
>>>>>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>>>>>
>>>>>>>
>>>>>>> -
>>>>>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>>>>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> -
>>>>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>>>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>> -
>>>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Struts-1-form-data-change-tp25758644p25767781.html
>>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>> -
>>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>>
>>>>
>>>
>>> -
>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>
>>>
>>>
>>
>>
>>
>> --
>> View this message in context: 
>> http://www.nabble.com/Struts-1-form-data-change-tp25758644p25770086.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

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



Re: Struts 1 form data change

2009-10-06 Thread Paul Benedict
SanJ,

Don't worry about performance. You can't program advanced features by
writing nothing. You'll have to do the check.

>> I have the same idea in mind but how would I know tab being saved is 'A'?
The tab last selected is the tab being saved. As I said, use a hidden
field to tell you.

Paul

On Tue, Oct 6, 2009 at 9:43 AM, SanJ.SANJAY  wrote:
>
> Or
>
>
>    I can compare at server side, the values of fields in tabs.
>
>
> public void execute(...) {
>  if (fields in tab 'A' are changed ) {
>    saveTabA();
>  } else if (fields in tab 'B' are changed) {
>    saveTabB();
>  }
> }
>
>
> But don't know how will it affect the performance?
>
>
>
> Thanks,
>
> SanJ
>
>
>
>
>
> Paul Benedict-2 wrote:
>>
>> SanJ,
>>
>> This is where you have to modify your code :-) You'll have to take
>> into account which tab was saved, and only save that tab's data. As
>> you said yourself, you can't just take the entire ActionForm data.
>>
>> public void execute(...) {
>>   if (tab being saved is 'A') {
>>     saveTabA();
>>   } else if (tab being saved is 'B') {
>>     saveTabB();
>>   }
>> }
>>
>> Paul
>>
>> On Tue, Oct 6, 2009 at 7:28 AM, SanJ.SANJAY  wrote:
>>>
>>> Pawel,
>>>
>>>        You are right, but, the data that I have in tab 1 contains lot of
>>> fields and is kind of different set of data. So if I just change the Tab
>>> 2
>>> data and click save, I am unnecessarily re-saving the data of tab1 (which
>>> means firing big queries to Database) when all I need is just save set of
>>> data in Tab2. This could be a performance hit.
>>>
>>> Thanks
>>>
>>>
>>>
>>>
>>> Paweł Wielgus wrote:
>>>>
>>>> Hi all,
>>>> consider a story like this:
>>>> lets say i'm the user, i'm loading this page,
>>>> then i select tab1 and look at the data,
>>>> then i select tab2 and change the data tab2_d1,
>>>> then i select tab1 and change the data tab1_d1,
>>>> then again select tab2 and change data tab2_d1 to it's original value,
>>>> and i click "save".
>>>> Now what would You like to save?
>>>> In general, what is the benefit of savin only partial data?
>>>> I claim there is none or very little,
>>>> just look how much work You have to do
>>>> to make it hapen versus normal way.
>>>>
>>>> Best greetings,
>>>> Paweł Wielgus.
>>>>
>>>>
>>>> 2009/10/6 Paul Benedict :
>>>>> It could be a character that represents which tab is selected. A, B, C,
>>>>> etc.
>>>>>
>>>>> On Mon, Oct 5, 2009 at 9:40 PM, SanJ.SANJAY 
>>>>> wrote:
>>>>>>
>>>>>> Paul,
>>>>>>
>>>>>> I will try that..hidden field will be a java variable. So it should be
>>>>>> like
>>>>>> a boolean which toggles every user select Tab?
>>>>>>
>>>>>> Thanks ..
>>>>>>
>>>>>>
>>>>>>
>>>>>> Paul Benedict-2 wrote:
>>>>>>>
>>>>>>> SanJ,
>>>>>>>
>>>>>>> When a user selects the tab, modify a hidden form field that
>>>>>>> indicates
>>>>>>> the tab selected. Do you know javascript? That's what you would use.
>>>>>>>
>>>>>>> Paul
>>>>>>>
>>>>>>> On Mon, Oct 5, 2009 at 9:15 PM, SanJ.SANJAY 
>>>>>>> wrote:
>>>>>>>>
>>>>>>>> Thanks Paul,
>>>>>>>>
>>>>>>>>                 I thought about that also but selecting a tab isn't
>>>>>>>> always
>>>>>>>> mean that I change the data inside that tab.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Paul Benedict-2 wrote:
>>>>>>>>>
>>>>>>>>> SanJ,
>>>>>>>>>
>>>>>>>>> Can you track which tab the user selected? Perhaps you can set a
>>>>>>>>> javascript variable 

Re: Struts 1 form data change

2009-10-06 Thread SanJ.SANJAY

Or


I can compare at server side, the values of fields in tabs.

If value




SanJ.SANJAY wrote:
> 
> Thanks Paul, appreciate that.
> 
>   I have the same idea in mind but how would I know tab being saved is
> 'A'? I can only detect if the tab is 'clicked or selected' not if the data
> in tab is 'changed'.Hmmm ...interesting  :-).
> 
> I have three tabs in JSP with one form and only one save button for all. 
> 
> public void execute(...) {
>   if (fields in tab 'A' are changed ) {
> saveTabA();
>   } else if (fields in tab 'B' are changed) {
> saveTabB();
>   }
> }
> 
> 
> But don't know how will it affect the performance?
> 
> 
> 
> 
> 
> 
> 
> Paul Benedict-2 wrote:
>> 
>> SanJ,
>> 
>> This is where you have to modify your code :-) You'll have to take
>> into account which tab was saved, and only save that tab's data. As
>> you said yourself, you can't just take the entire ActionForm data.
>> 
>> public void execute(...) {
>>   if (tab being saved is 'A') {
>> saveTabA();
>>   } else if (tab being saved is 'B') {
>> saveTabB();
>>   }
>> }
>> 
>> Paul
>> 
>> On Tue, Oct 6, 2009 at 7:28 AM, SanJ.SANJAY  wrote:
>>>
>>> Pawel,
>>>
>>>        You are right, but, the data that I have in tab 1 contains lot of
>>> fields and is kind of different set of data. So if I just change the Tab
>>> 2
>>> data and click save, I am unnecessarily re-saving the data of tab1
>>> (which
>>> means firing big queries to Database) when all I need is just save set
>>> of
>>> data in Tab2. This could be a performance hit.
>>>
>>> Thanks
>>>
>>>
>>>
>>>
>>> Paweł Wielgus wrote:
>>>>
>>>> Hi all,
>>>> consider a story like this:
>>>> lets say i'm the user, i'm loading this page,
>>>> then i select tab1 and look at the data,
>>>> then i select tab2 and change the data tab2_d1,
>>>> then i select tab1 and change the data tab1_d1,
>>>> then again select tab2 and change data tab2_d1 to it's original value,
>>>> and i click "save".
>>>> Now what would You like to save?
>>>> In general, what is the benefit of savin only partial data?
>>>> I claim there is none or very little,
>>>> just look how much work You have to do
>>>> to make it hapen versus normal way.
>>>>
>>>> Best greetings,
>>>> Paweł Wielgus.
>>>>
>>>>
>>>> 2009/10/6 Paul Benedict :
>>>>> It could be a character that represents which tab is selected. A, B,
>>>>> C,
>>>>> etc.
>>>>>
>>>>> On Mon, Oct 5, 2009 at 9:40 PM, SanJ.SANJAY 
>>>>> wrote:
>>>>>>
>>>>>> Paul,
>>>>>>
>>>>>> I will try that..hidden field will be a java variable. So it should
>>>>>> be
>>>>>> like
>>>>>> a boolean which toggles every user select Tab?
>>>>>>
>>>>>> Thanks ..
>>>>>>
>>>>>>
>>>>>>
>>>>>> Paul Benedict-2 wrote:
>>>>>>>
>>>>>>> SanJ,
>>>>>>>
>>>>>>> When a user selects the tab, modify a hidden form field that
>>>>>>> indicates
>>>>>>> the tab selected. Do you know javascript? That's what you would use.
>>>>>>>
>>>>>>> Paul
>>>>>>>
>>>>>>> On Mon, Oct 5, 2009 at 9:15 PM, SanJ.SANJAY 
>>>>>>> wrote:
>>>>>>>>
>>>>>>>> Thanks Paul,
>>>>>>>>
>>>>>>>>                 I thought about that also but selecting a tab isn't
>>>>>>>> always
>>>>>>>> mean that I change the data inside that tab.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Paul Benedict-2 wrote:
>>>>>>>>>
>>>>>>>>> SanJ,
>>>>>>>

Re: Struts 1 form data change

2009-10-06 Thread SanJ.SANJAY

Thanks Paul, appreciate that.

  I have the same idea in mind but how would I know tab being saved is
'A'? I can only detect if the tab is 'clicked or selected' not if the data
in tab is 'changed'.Hmmm ...interesting  :-).

I have three tabs in JSP with one form and only one save button for all. 





Paul Benedict-2 wrote:
> 
> SanJ,
> 
> This is where you have to modify your code :-) You'll have to take
> into account which tab was saved, and only save that tab's data. As
> you said yourself, you can't just take the entire ActionForm data.
> 
> public void execute(...) {
>   if (tab being saved is 'A') {
> saveTabA();
>   } else if (tab being saved is 'B') {
> saveTabB();
>   }
> }
> 
> Paul
> 
> On Tue, Oct 6, 2009 at 7:28 AM, SanJ.SANJAY  wrote:
>>
>> Pawel,
>>
>>        You are right, but, the data that I have in tab 1 contains lot of
>> fields and is kind of different set of data. So if I just change the Tab
>> 2
>> data and click save, I am unnecessarily re-saving the data of tab1 (which
>> means firing big queries to Database) when all I need is just save set of
>> data in Tab2. This could be a performance hit.
>>
>> Thanks
>>
>>
>>
>>
>> Paweł Wielgus wrote:
>>>
>>> Hi all,
>>> consider a story like this:
>>> lets say i'm the user, i'm loading this page,
>>> then i select tab1 and look at the data,
>>> then i select tab2 and change the data tab2_d1,
>>> then i select tab1 and change the data tab1_d1,
>>> then again select tab2 and change data tab2_d1 to it's original value,
>>> and i click "save".
>>> Now what would You like to save?
>>> In general, what is the benefit of savin only partial data?
>>> I claim there is none or very little,
>>> just look how much work You have to do
>>> to make it hapen versus normal way.
>>>
>>> Best greetings,
>>> Paweł Wielgus.
>>>
>>>
>>> 2009/10/6 Paul Benedict :
>>>> It could be a character that represents which tab is selected. A, B, C,
>>>> etc.
>>>>
>>>> On Mon, Oct 5, 2009 at 9:40 PM, SanJ.SANJAY 
>>>> wrote:
>>>>>
>>>>> Paul,
>>>>>
>>>>> I will try that..hidden field will be a java variable. So it should be
>>>>> like
>>>>> a boolean which toggles every user select Tab?
>>>>>
>>>>> Thanks ..
>>>>>
>>>>>
>>>>>
>>>>> Paul Benedict-2 wrote:
>>>>>>
>>>>>> SanJ,
>>>>>>
>>>>>> When a user selects the tab, modify a hidden form field that
>>>>>> indicates
>>>>>> the tab selected. Do you know javascript? That's what you would use.
>>>>>>
>>>>>> Paul
>>>>>>
>>>>>> On Mon, Oct 5, 2009 at 9:15 PM, SanJ.SANJAY 
>>>>>> wrote:
>>>>>>>
>>>>>>> Thanks Paul,
>>>>>>>
>>>>>>>                 I thought about that also but selecting a tab isn't
>>>>>>> always
>>>>>>> mean that I change the data inside that tab.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Paul Benedict-2 wrote:
>>>>>>>>
>>>>>>>> SanJ,
>>>>>>>>
>>>>>>>> Can you track which tab the user selected? Perhaps you can set a
>>>>>>>> javascript variable when one is selected. The only down side here
>>>>>>>> is
>>>>>>>> that you'll have to hardcode which fields belong to which tab. Once
>>>>>>>> you do that, you can do what you want.
>>>>>>>>
>>>>>>>> Paul
>>>>>>>>
>>>>>>>> On Mon, Oct 5, 2009 at 7:42 PM, SanJ.SANJAY 
>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> I am using struts 1. I have Adobe SPRY tabs in my JSP.
>>>>>>>>>
>>>>>>>>> There are two separate set of fields/ data in each tab. So suppose
>>>>>>>>> someone
>>>>>>>>> changes fields in Tab 2 only and

Re: Struts 1 form data change

2009-10-06 Thread Paul Benedict
SanJ,

This is where you have to modify your code :-) You'll have to take
into account which tab was saved, and only save that tab's data. As
you said yourself, you can't just take the entire ActionForm data.

public void execute(...) {
  if (tab being saved is 'A') {
saveTabA();
  } else if (tab being saved is 'B') {
saveTabB();
  }
}

Paul

On Tue, Oct 6, 2009 at 7:28 AM, SanJ.SANJAY  wrote:
>
> Pawel,
>
>        You are right, but, the data that I have in tab 1 contains lot of
> fields and is kind of different set of data. So if I just change the Tab 2
> data and click save, I am unnecessarily re-saving the data of tab1 (which
> means firing big queries to Database) when all I need is just save set of
> data in Tab2. This could be a performance hit.
>
> Thanks
>
>
>
>
> Paweł Wielgus wrote:
>>
>> Hi all,
>> consider a story like this:
>> lets say i'm the user, i'm loading this page,
>> then i select tab1 and look at the data,
>> then i select tab2 and change the data tab2_d1,
>> then i select tab1 and change the data tab1_d1,
>> then again select tab2 and change data tab2_d1 to it's original value,
>> and i click "save".
>> Now what would You like to save?
>> In general, what is the benefit of savin only partial data?
>> I claim there is none or very little,
>> just look how much work You have to do
>> to make it hapen versus normal way.
>>
>> Best greetings,
>> Paweł Wielgus.
>>
>>
>> 2009/10/6 Paul Benedict :
>>> It could be a character that represents which tab is selected. A, B, C,
>>> etc.
>>>
>>> On Mon, Oct 5, 2009 at 9:40 PM, SanJ.SANJAY  wrote:
>>>>
>>>> Paul,
>>>>
>>>> I will try that..hidden field will be a java variable. So it should be
>>>> like
>>>> a boolean which toggles every user select Tab?
>>>>
>>>> Thanks ..
>>>>
>>>>
>>>>
>>>> Paul Benedict-2 wrote:
>>>>>
>>>>> SanJ,
>>>>>
>>>>> When a user selects the tab, modify a hidden form field that indicates
>>>>> the tab selected. Do you know javascript? That's what you would use.
>>>>>
>>>>> Paul
>>>>>
>>>>> On Mon, Oct 5, 2009 at 9:15 PM, SanJ.SANJAY 
>>>>> wrote:
>>>>>>
>>>>>> Thanks Paul,
>>>>>>
>>>>>>                 I thought about that also but selecting a tab isn't
>>>>>> always
>>>>>> mean that I change the data inside that tab.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Paul Benedict-2 wrote:
>>>>>>>
>>>>>>> SanJ,
>>>>>>>
>>>>>>> Can you track which tab the user selected? Perhaps you can set a
>>>>>>> javascript variable when one is selected. The only down side here is
>>>>>>> that you'll have to hardcode which fields belong to which tab. Once
>>>>>>> you do that, you can do what you want.
>>>>>>>
>>>>>>> Paul
>>>>>>>
>>>>>>> On Mon, Oct 5, 2009 at 7:42 PM, SanJ.SANJAY 
>>>>>>> wrote:
>>>>>>>>
>>>>>>>> I am using struts 1. I have Adobe SPRY tabs in my JSP.
>>>>>>>>
>>>>>>>> There are two separate set of fields/ data in each tab. So suppose
>>>>>>>> someone
>>>>>>>> changes fields in Tab 2 only and save the JSP, I do not want to save
>>>>>>>> the
>>>>>>>> tab
>>>>>>>> 1 fields also because those fields are not changed.
>>>>>>>>
>>>>>>>> I was wondering if there is any way I can distinguish that only TAB
>>>>>>>> 2
>>>>>>>> fields
>>>>>>>> are changed so that I can process only those fields in action
>>>>>>>> instead
>>>>>>>> of
>>>>>>>> processing all the JSP form fields.
>>>>>>>>
>>>>>>>> I would appreciate some inputs!
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>&g

Re: Struts 1 form data change

2009-10-06 Thread SanJ.SANJAY

Pawel,

You are right, but, the data that I have in tab 1 contains lot of
fields and is kind of different set of data. So if I just change the Tab 2
data and click save, I am unnecessarily re-saving the data of tab1 (which
means firing big queries to Database) when all I need is just save set of
data in Tab2. This could be a performance hit. 

Thanks




Paweł Wielgus wrote:
> 
> Hi all,
> consider a story like this:
> lets say i'm the user, i'm loading this page,
> then i select tab1 and look at the data,
> then i select tab2 and change the data tab2_d1,
> then i select tab1 and change the data tab1_d1,
> then again select tab2 and change data tab2_d1 to it's original value,
> and i click "save".
> Now what would You like to save?
> In general, what is the benefit of savin only partial data?
> I claim there is none or very little,
> just look how much work You have to do
> to make it hapen versus normal way.
> 
> Best greetings,
> Paweł Wielgus.
> 
> 
> 2009/10/6 Paul Benedict :
>> It could be a character that represents which tab is selected. A, B, C,
>> etc.
>>
>> On Mon, Oct 5, 2009 at 9:40 PM, SanJ.SANJAY  wrote:
>>>
>>> Paul,
>>>
>>> I will try that..hidden field will be a java variable. So it should be
>>> like
>>> a boolean which toggles every user select Tab?
>>>
>>> Thanks ..
>>>
>>>
>>>
>>> Paul Benedict-2 wrote:
>>>>
>>>> SanJ,
>>>>
>>>> When a user selects the tab, modify a hidden form field that indicates
>>>> the tab selected. Do you know javascript? That's what you would use.
>>>>
>>>> Paul
>>>>
>>>> On Mon, Oct 5, 2009 at 9:15 PM, SanJ.SANJAY 
>>>> wrote:
>>>>>
>>>>> Thanks Paul,
>>>>>
>>>>>                 I thought about that also but selecting a tab isn't
>>>>> always
>>>>> mean that I change the data inside that tab.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Paul Benedict-2 wrote:
>>>>>>
>>>>>> SanJ,
>>>>>>
>>>>>> Can you track which tab the user selected? Perhaps you can set a
>>>>>> javascript variable when one is selected. The only down side here is
>>>>>> that you'll have to hardcode which fields belong to which tab. Once
>>>>>> you do that, you can do what you want.
>>>>>>
>>>>>> Paul
>>>>>>
>>>>>> On Mon, Oct 5, 2009 at 7:42 PM, SanJ.SANJAY 
>>>>>> wrote:
>>>>>>>
>>>>>>> I am using struts 1. I have Adobe SPRY tabs in my JSP.
>>>>>>>
>>>>>>> There are two separate set of fields/ data in each tab. So suppose
>>>>>>> someone
>>>>>>> changes fields in Tab 2 only and save the JSP, I do not want to save
>>>>>>> the
>>>>>>> tab
>>>>>>> 1 fields also because those fields are not changed.
>>>>>>>
>>>>>>> I was wondering if there is any way I can distinguish that only TAB
>>>>>>> 2
>>>>>>> fields
>>>>>>> are changed so that I can process only those fields in action
>>>>>>> instead
>>>>>>> of
>>>>>>> processing all the JSP form fields.
>>>>>>>
>>>>>>> I would appreciate some inputs!
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> View this message in context:
>>>>>>> http://www.nabble.com/Struts-1-form-data-change-tp25758644p25758644.html
>>>>>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>>>>>
>>>>>>>
>>>>>>> -
>>>>>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>>>>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> -
>>>>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>>>>> For additional commands, e-mail: user-h...@struts.apa

Re: Struts 1 form data change

2009-10-06 Thread Paweł Wielgus
Hi all,
consider a story like this:
lets say i'm the user, i'm loading this page,
then i select tab1 and look at the data,
then i select tab2 and change the data tab2_d1,
then i select tab1 and change the data tab1_d1,
then again select tab2 and change data tab2_d1 to it's original value,
and i click "save".
Now what would You like to save?
In general, what is the benefit of savin only partial data?
I claim there is none or very little,
just look how much work You have to do
to make it hapen versus normal way.

Best greetings,
Paweł Wielgus.


2009/10/6 Paul Benedict :
> It could be a character that represents which tab is selected. A, B, C, etc.
>
> On Mon, Oct 5, 2009 at 9:40 PM, SanJ.SANJAY  wrote:
>>
>> Paul,
>>
>> I will try that..hidden field will be a java variable. So it should be like
>> a boolean which toggles every user select Tab?
>>
>> Thanks ..
>>
>>
>>
>> Paul Benedict-2 wrote:
>>>
>>> SanJ,
>>>
>>> When a user selects the tab, modify a hidden form field that indicates
>>> the tab selected. Do you know javascript? That's what you would use.
>>>
>>> Paul
>>>
>>> On Mon, Oct 5, 2009 at 9:15 PM, SanJ.SANJAY  wrote:
>>>>
>>>> Thanks Paul,
>>>>
>>>>                 I thought about that also but selecting a tab isn't
>>>> always
>>>> mean that I change the data inside that tab.
>>>>
>>>>
>>>>
>>>>
>>>> Paul Benedict-2 wrote:
>>>>>
>>>>> SanJ,
>>>>>
>>>>> Can you track which tab the user selected? Perhaps you can set a
>>>>> javascript variable when one is selected. The only down side here is
>>>>> that you'll have to hardcode which fields belong to which tab. Once
>>>>> you do that, you can do what you want.
>>>>>
>>>>> Paul
>>>>>
>>>>> On Mon, Oct 5, 2009 at 7:42 PM, SanJ.SANJAY  wrote:
>>>>>>
>>>>>> I am using struts 1. I have Adobe SPRY tabs in my JSP.
>>>>>>
>>>>>> There are two separate set of fields/ data in each tab. So suppose
>>>>>> someone
>>>>>> changes fields in Tab 2 only and save the JSP, I do not want to save
>>>>>> the
>>>>>> tab
>>>>>> 1 fields also because those fields are not changed.
>>>>>>
>>>>>> I was wondering if there is any way I can distinguish that only TAB 2
>>>>>> fields
>>>>>> are changed so that I can process only those fields in action instead
>>>>>> of
>>>>>> processing all the JSP form fields.
>>>>>>
>>>>>> I would appreciate some inputs!
>>>>>>
>>>>>>
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://www.nabble.com/Struts-1-form-data-change-tp25758644p25758644.html
>>>>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>> -
>>>>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>>>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>> -
>>>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Struts-1-form-data-change-tp25758644p25761964.html
>>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>> -
>>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>>
>>>>
>>>
>>> -
>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>
>>>
>>>
>>
>> --
>> View this message in context: 
>> http://www.nabble.com/Struts-1-form-data-change-tp25758644p25762087.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

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



Re: Struts 1 form data change

2009-10-05 Thread Paul Benedict
It could be a character that represents which tab is selected. A, B, C, etc.

On Mon, Oct 5, 2009 at 9:40 PM, SanJ.SANJAY  wrote:
>
> Paul,
>
> I will try that..hidden field will be a java variable. So it should be like
> a boolean which toggles every user select Tab?
>
> Thanks ..
>
>
>
> Paul Benedict-2 wrote:
>>
>> SanJ,
>>
>> When a user selects the tab, modify a hidden form field that indicates
>> the tab selected. Do you know javascript? That's what you would use.
>>
>> Paul
>>
>> On Mon, Oct 5, 2009 at 9:15 PM, SanJ.SANJAY  wrote:
>>>
>>> Thanks Paul,
>>>
>>>                 I thought about that also but selecting a tab isn't
>>> always
>>> mean that I change the data inside that tab.
>>>
>>>
>>>
>>>
>>> Paul Benedict-2 wrote:
>>>>
>>>> SanJ,
>>>>
>>>> Can you track which tab the user selected? Perhaps you can set a
>>>> javascript variable when one is selected. The only down side here is
>>>> that you'll have to hardcode which fields belong to which tab. Once
>>>> you do that, you can do what you want.
>>>>
>>>> Paul
>>>>
>>>> On Mon, Oct 5, 2009 at 7:42 PM, SanJ.SANJAY  wrote:
>>>>>
>>>>> I am using struts 1. I have Adobe SPRY tabs in my JSP.
>>>>>
>>>>> There are two separate set of fields/ data in each tab. So suppose
>>>>> someone
>>>>> changes fields in Tab 2 only and save the JSP, I do not want to save
>>>>> the
>>>>> tab
>>>>> 1 fields also because those fields are not changed.
>>>>>
>>>>> I was wondering if there is any way I can distinguish that only TAB 2
>>>>> fields
>>>>> are changed so that I can process only those fields in action instead
>>>>> of
>>>>> processing all the JSP form fields.
>>>>>
>>>>> I would appreciate some inputs!
>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/Struts-1-form-data-change-tp25758644p25758644.html
>>>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>> -
>>>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>>>
>>>>>
>>>>
>>>> -
>>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Struts-1-form-data-change-tp25758644p25761964.html
>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>
>>>
>>> -
>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>
>>>
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/Struts-1-form-data-change-tp25758644p25762087.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

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



Re: Struts 1 form data change

2009-10-05 Thread SanJ.SANJAY

Paul,

I will try that..hidden field will be a java variable. So it should be like
a boolean which toggles every user select Tab?

Thanks ..



Paul Benedict-2 wrote:
> 
> SanJ,
> 
> When a user selects the tab, modify a hidden form field that indicates
> the tab selected. Do you know javascript? That's what you would use.
> 
> Paul
> 
> On Mon, Oct 5, 2009 at 9:15 PM, SanJ.SANJAY  wrote:
>>
>> Thanks Paul,
>>
>>                 I thought about that also but selecting a tab isn't
>> always
>> mean that I change the data inside that tab.
>>
>>
>>
>>
>> Paul Benedict-2 wrote:
>>>
>>> SanJ,
>>>
>>> Can you track which tab the user selected? Perhaps you can set a
>>> javascript variable when one is selected. The only down side here is
>>> that you'll have to hardcode which fields belong to which tab. Once
>>> you do that, you can do what you want.
>>>
>>> Paul
>>>
>>> On Mon, Oct 5, 2009 at 7:42 PM, SanJ.SANJAY  wrote:
>>>>
>>>> I am using struts 1. I have Adobe SPRY tabs in my JSP.
>>>>
>>>> There are two separate set of fields/ data in each tab. So suppose
>>>> someone
>>>> changes fields in Tab 2 only and save the JSP, I do not want to save
>>>> the
>>>> tab
>>>> 1 fields also because those fields are not changed.
>>>>
>>>> I was wondering if there is any way I can distinguish that only TAB 2
>>>> fields
>>>> are changed so that I can process only those fields in action instead
>>>> of
>>>> processing all the JSP form fields.
>>>>
>>>> I would appreciate some inputs!
>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Struts-1-form-data-change-tp25758644p25758644.html
>>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>> -
>>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>>
>>>>
>>>
>>> -
>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Struts-1-form-data-change-tp25758644p25761964.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Struts-1-form-data-change-tp25758644p25762087.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Struts 1 form data change

2009-10-05 Thread Paul Benedict
SanJ,

When a user selects the tab, modify a hidden form field that indicates
the tab selected. Do you know javascript? That's what you would use.

Paul

On Mon, Oct 5, 2009 at 9:15 PM, SanJ.SANJAY  wrote:
>
> Thanks Paul,
>
>                 I thought about that also but selecting a tab isn't always
> mean that I change the data inside that tab.
>
>
>
>
> Paul Benedict-2 wrote:
>>
>> SanJ,
>>
>> Can you track which tab the user selected? Perhaps you can set a
>> javascript variable when one is selected. The only down side here is
>> that you'll have to hardcode which fields belong to which tab. Once
>> you do that, you can do what you want.
>>
>> Paul
>>
>> On Mon, Oct 5, 2009 at 7:42 PM, SanJ.SANJAY  wrote:
>>>
>>> I am using struts 1. I have Adobe SPRY tabs in my JSP.
>>>
>>> There are two separate set of fields/ data in each tab. So suppose
>>> someone
>>> changes fields in Tab 2 only and save the JSP, I do not want to save the
>>> tab
>>> 1 fields also because those fields are not changed.
>>>
>>> I was wondering if there is any way I can distinguish that only TAB 2
>>> fields
>>> are changed so that I can process only those fields in action instead of
>>> processing all the JSP form fields.
>>>
>>> I would appreciate some inputs!
>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Struts-1-form-data-change-tp25758644p25758644.html
>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>
>>>
>>> -
>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>
>>>
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/Struts-1-form-data-change-tp25758644p25761964.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

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



Re: Struts 1 form data change

2009-10-05 Thread SanJ.SANJAY

Thanks Paul,

 I thought about that also but selecting a tab isn't always
mean that I change the data inside that tab.




Paul Benedict-2 wrote:
> 
> SanJ,
> 
> Can you track which tab the user selected? Perhaps you can set a
> javascript variable when one is selected. The only down side here is
> that you'll have to hardcode which fields belong to which tab. Once
> you do that, you can do what you want.
> 
> Paul
> 
> On Mon, Oct 5, 2009 at 7:42 PM, SanJ.SANJAY  wrote:
>>
>> I am using struts 1. I have Adobe SPRY tabs in my JSP.
>>
>> There are two separate set of fields/ data in each tab. So suppose
>> someone
>> changes fields in Tab 2 only and save the JSP, I do not want to save the
>> tab
>> 1 fields also because those fields are not changed.
>>
>> I was wondering if there is any way I can distinguish that only TAB 2
>> fields
>> are changed so that I can process only those fields in action instead of
>> processing all the JSP form fields.
>>
>> I would appreciate some inputs!
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Struts-1-form-data-change-tp25758644p25758644.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
> 
> -----
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Struts-1-form-data-change-tp25758644p25761964.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Struts 1 form data change

2009-10-05 Thread Paul Benedict
SanJ,

Can you track which tab the user selected? Perhaps you can set a
javascript variable when one is selected. The only down side here is
that you'll have to hardcode which fields belong to which tab. Once
you do that, you can do what you want.

Paul

On Mon, Oct 5, 2009 at 7:42 PM, SanJ.SANJAY  wrote:
>
> I am using struts 1. I have Adobe SPRY tabs in my JSP.
>
> There are two separate set of fields/ data in each tab. So suppose someone
> changes fields in Tab 2 only and save the JSP, I do not want to save the tab
> 1 fields also because those fields are not changed.
>
> I was wondering if there is any way I can distinguish that only TAB 2 fields
> are changed so that I can process only those fields in action instead of
> processing all the JSP form fields.
>
> I would appreciate some inputs!
>
>
> --
> View this message in context: 
> http://www.nabble.com/Struts-1-form-data-change-tp25758644p25758644.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

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



Struts 1 form data change

2009-10-05 Thread SanJ.SANJAY

I am using struts 1. I have Adobe SPRY tabs in my JSP. 

There are two separate set of fields/ data in each tab. So suppose someone
changes fields in Tab 2 only and save the JSP, I do not want to save the tab
1 fields also because those fields are not changed.

I was wondering if there is any way I can distinguish that only TAB 2 fields
are changed so that I can process only those fields in action instead of
processing all the JSP form fields.

I would appreciate some inputs!


-- 
View this message in context: 
http://www.nabble.com/Struts-1-form-data-change-tp25758644p25758644.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: IE ajax theme form data problem

2009-01-29 Thread Robert Dietrick
Thanks.  That did it.

On Wed, Jan 28, 2009 at 10:53 PM, Jeromy Evans
 wrote:
> Try turning off the loading text.
>
> It's a guess, but it sounds similar to the loadingText bug due to Dojo in
> IE.  If the target div contains the source form and loadingText enabled, the
> loadingText overwrites the form before the its new values are read.  Details
> are mentioned several times in this mailing list.
>
>
> On 29/01/2009, at 3:50 PM, Robert Dietrick wrote:
>
>> Hi,
>>
>> I have a page which uses a tabbedPanel with three tabs.  In each of
>> the three tabs, I load a separate div:
>> 
>>> href="%{viewProfileUrl}" theme="ajax" cssClass="tab">
>>> href="%{viewUserPrefsUrl}" theme="ajax" cssClass="tab">
>>> href="%{viewGamePrefsUrl}" theme="ajax" cssClass="tab">
>> 
>>
>> In each of the tabbed divs, there is a form which uses the ajax theme
>> and targets the div in which the for resides.  E.g.,
>>
>> 
>> 
>> ...
>> 
>> 
>>
>> Under IE (6 & 7), when I modify the data in the form fields and submit
>> the form, somehow the original form data (before my modifications) is
>> being sent to the server.  Has anyone seen this before?
>>
>> Thanks.
>>
>> -rob
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

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



Re: IE ajax theme form data problem

2009-01-28 Thread Jeromy Evans

Try turning off the loading text.

It's a guess, but it sounds similar to the loadingText bug due to Dojo  
in IE.  If the target div contains the source form and loadingText  
enabled, the loadingText overwrites the form before the its new values  
are read.  Details are mentioned several times in this mailing list.



On 29/01/2009, at 3:50 PM, Robert Dietrick wrote:


Hi,

I have a page which uses a tabbedPanel with three tabs.  In each of
the three tabs, I load a separate div:






In each of the tabbed divs, there is a form which uses the ajax theme
and targets the div in which the for resides.  E.g.,



...



Under IE (6 & 7), when I modify the data in the form fields and submit
the form, somehow the original form data (before my modifications) is
being sent to the server.  Has anyone seen this before?

Thanks.

-rob

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




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



IE ajax theme form data problem

2009-01-28 Thread Robert Dietrick
Hi,

I have a page which uses a tabbedPanel with three tabs.  In each of
the three tabs, I load a separate div:






In each of the tabbed divs, there is a form which uses the ajax theme
and targets the div in which the for resides.  E.g.,



...



Under IE (6 & 7), when I modify the data in the form fields and submit
the form, somehow the original form data (before my modifications) is
being sent to the server.  Has anyone seen this before?

Thanks.

-rob

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



Help in resetting multiple form data

2008-09-18 Thread Sulabha Walavalkar
Hi,

 

I am using 4 forms in one jsp, the reason being few select UI components &
search are common to other use cases. 

The problem I'm facing is with resetting the fields on successful completion
of any transaction.

 

One option is calling reset() method on all the forms in java script
function on onload even of body. But my application is using tiles & master
layout jsp because of which my function on body onload is not getting
called.

 

Can someone help me out giving any options to clear the data for all the
forms displayed in jsp?

 

Thanks & Regards,
Sulabha 

 



Re: JAZN Exception when posting form with ecntype="multipart/form-data"

2008-07-01 Thread Dimitris Mouchritsas

Dimitris Mouchritsas wrote:

Dimitris Mouchritsas wrote:

Hi all,
we've recently upgraded our j2ee application to use struts 1.3.8 and 
we're getting a weird exception when trying to

upload a file. Here's the jsp:

testFileUpload.jsp
= 


<%@ page contentType="text/html;charset=utf-8"%>
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles"%>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic"%>



enctype="multipart/form-data">   

   
   * Attachment:
   
   styleClass="w33" size="40" />

   
   Save changes   

=== 


  Here's the action:

//-- 

//$Id: PrepareTestFileUploadAction.java,v 1.1 2008/06/30 12:26:53 
kshe Exp $

//$Author: kshe $
//$Date: 2008/06/30 12:26:53 $
//$Revision: 1.1 $
//-- 


package my.company.web.actions.test;

import java.rmi.RemoteException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.upload.FormFile;


import my.company.web.actions.common.BaseAction;

import my.company.web.forms.TestUploadForm;

/**
* @custom.security-filter operation="public"
*
* @struts.action path="/test/prepareTestFileUpload"
*name="testUploadForm" 
input="/test/prepareTestFileUpload"

*
* @struts.action-forward name="goForward" path="test.file.upload"
*/
public class PrepareTestFileUploadAction extends BaseAction {

   private static Logger log = 
Logger.getLogger(PrepareTestFileUploadAction.class);
 
   public PrepareTestFileUploadAction()  {

   super();
   }

   public ActionForward doExecute(ActionMapping mapping, ActionForm 
form,

   HttpServletRequest request, HttpServletResponse response)
   throws RepException, RemoteException {

   String forward = "goForward";
   TestUploadForm testForm = (TestUploadForm)form;

   FormFile file = testForm.getAttachment();

   if (file != null) {
   log.debug("File: " + file.getFileName());
   } else {
   log.debug("File == null");
   }


   return mapping.findForward(forward);
   }
}


It seems we're able to get the filename on the server side, but when 
it tries to go forward

here's the exception we get:

Caused by: javax.servlet.ServletException: JAAS-OC4J: 
JAZNFilter.doFilter - unable to find the current servlet

   at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
   at 
com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:663) 

   at 
com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330) 

   at 
com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:222) 

   at 
org.apache.struts.chain.commands.servlet.PerformForward.handleAsForward(PerformForward.java:113) 

   at 
org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformForward.java:96) 

   at 
org.apache.struts.chain.commands.AbstractPerformForward.execute(AbstractPerformForward.java:54) 

   at 
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51) 

   at 
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
   at 
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305) 

   at 
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
   at 
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283) 

   at 
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
   at 
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)

   at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
   at 
com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65) 


   at oracle.security.jazn.oc4j.JAZNFilter$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at javax.security.auth.Subject.doAsPrivileg

Re: JAZN Exception when posting form with ecntype="multipart/form-data"

2008-07-01 Thread Dimitris Mouchritsas

Dimitris Mouchritsas wrote:

Hi all,
we've recently upgraded our j2ee application to use struts 1.3.8 and 
we're getting a weird exception when trying to

upload a file. Here's the jsp:

testFileUpload.jsp
= 


<%@ page contentType="text/html;charset=utf-8"%>
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles"%>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic"%>



enctype="multipart/form-data">   

   
   * Attachment:
   
   styleClass="w33" size="40" />

   
   Save changes   

=== 


  Here's the action:

//-- 

//$Id: PrepareTestFileUploadAction.java,v 1.1 2008/06/30 12:26:53 kshe 
Exp $

//$Author: kshe $
//$Date: 2008/06/30 12:26:53 $
//$Revision: 1.1 $
//-- 


package my.company.web.actions.test;

import java.rmi.RemoteException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.upload.FormFile;


import my.company.web.actions.common.BaseAction;

import my.company.web.forms.TestUploadForm;

/**
* @custom.security-filter operation="public"
*
* @struts.action path="/test/prepareTestFileUpload"
*name="testUploadForm" 
input="/test/prepareTestFileUpload"

*
* @struts.action-forward name="goForward" path="test.file.upload"
*/
public class PrepareTestFileUploadAction extends BaseAction {

   private static Logger log = 
Logger.getLogger(PrepareTestFileUploadAction.class);
 
   public PrepareTestFileUploadAction()  {

   super();
   }

   public ActionForward doExecute(ActionMapping mapping, ActionForm form,
   HttpServletRequest request, HttpServletResponse response)
   throws RepException, RemoteException {

   String forward = "goForward";
   TestUploadForm testForm = (TestUploadForm)form;

   FormFile file = testForm.getAttachment();

   if (file != null) {
   log.debug("File: " + file.getFileName());
   } else {
   log.debug("File == null");
   }


   return mapping.findForward(forward);
   }
}


It seems we're able to get the filename on the server side, but when 
it tries to go forward

here's the exception we get:

Caused by: javax.servlet.ServletException: JAAS-OC4J: 
JAZNFilter.doFilter - unable to find the current servlet

   at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
   at 
com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:663) 

   at 
com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330) 

   at 
com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:222) 

   at 
org.apache.struts.chain.commands.servlet.PerformForward.handleAsForward(PerformForward.java:113) 

   at 
org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformForward.java:96) 

   at 
org.apache.struts.chain.commands.AbstractPerformForward.execute(AbstractPerformForward.java:54) 

   at 
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51) 


   at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
   at 
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305) 


   at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
   at 
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283) 

   at 
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
   at 
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)

   at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
   at 
com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65) 


   at oracle.security.jazn.oc4j.JAZNFilter$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
   at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown So

JAZN Exception when posting form with ecntype="multipart/form-data"

2008-06-30 Thread Dimitris Mouchritsas

Hi all,
we've recently upgraded our j2ee application to use struts 1.3.8 and 
we're getting a weird exception when trying to

upload a file. Here's the jsp:

testFileUpload.jsp
=
<%@ page contentType="text/html;charset=utf-8"%>
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles"%>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic"%>



enctype="multipart/form-data"> 
  

   
   * Attachment:
   
   styleClass="w33" size="40" />

   
   Save changes   


===
  
Here's the action:


//--
//$Id: PrepareTestFileUploadAction.java,v 1.1 2008/06/30 12:26:53 kshe Exp $
//$Author: kshe $
//$Date: 2008/06/30 12:26:53 $
//$Revision: 1.1 $
//--
package my.company.web.actions.test;

import java.rmi.RemoteException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.upload.FormFile;


import my.company.web.actions.common.BaseAction;

import my.company.web.forms.TestUploadForm;

/**
* @custom.security-filter operation="public"
*
* @struts.action path="/test/prepareTestFileUpload"
*name="testUploadForm" input="/test/prepareTestFileUpload"
*
* @struts.action-forward name="goForward" path="test.file.upload"
*/
public class PrepareTestFileUploadAction extends BaseAction {

   private static Logger log = 
Logger.getLogger(PrepareTestFileUploadAction.class);
  


   public PrepareTestFileUploadAction()  {
   super();
   }

   public ActionForward doExecute(ActionMapping mapping, ActionForm form,
   HttpServletRequest request, HttpServletResponse response)
   throws RepException, RemoteException {

   String forward = "goForward";
   TestUploadForm testForm = (TestUploadForm)form;

   FormFile file = testForm.getAttachment();

   if (file != null) {
   log.debug("File: " + file.getFileName());
   } else {
   log.debug("File == null");
   }


   return mapping.findForward(forward);
   }
}


It seems we're able to get the filename on the server side, but when it 
tries to go forward

here's the exception we get:

Caused by: javax.servlet.ServletException: JAAS-OC4J: 
JAZNFilter.doFilter - unable to find the current servlet

   at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
   at 
com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:663)
   at 
com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
   at 
com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:222)
   at 
org.apache.struts.chain.commands.servlet.PerformForward.handleAsForward(PerformForward.java:113)
   at 
org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformForward.java:96)
   at 
org.apache.struts.chain.commands.AbstractPerformForward.execute(AbstractPerformForward.java:54)
   at 
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)

   at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
   at 
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305)

   at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
   at 
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
   at 
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)

   at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
   at 
com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)

   at oracle.security.jazn.oc4j.JAZNFilter$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
   at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Sourc

Re: Handling form data

2008-04-30 Thread Laurie Harper
First, I should point out that an 'input' result of type 'chain' should 
work here. What makes you think it doesn't? You wont get a browser 
redirect with chaining, though, so if you want that the 
MessageStoreInterceptor can help with preserving error messages.


You can configure which methods skip validation with the excludeMethods 
parameter for the workflow and validation interceptors. Which methods 
are skipped by default varies with the different stacks defined in 
struts-defaults.xml, but assuming you're using defaultStack, it's 
input,back,cancel,browse.


I'd suggest looking at the example applications to see how these issues 
are handled there for more ideas.


L.

Brian Hawkins wrote:

I've run into a situation that I would like to get others opinions on.

The problem is with handling a form.  Here is the scenario: I have a form
called form.jsp, this form needs data from the database so it has an
associated FormAction.java class.  The struts.xml file looks like this:


/form.jsp


The form then posts the data to another action called postForm and the
struts.xml looks like this:


...


Now for the issues.  The first issue is field validation.  I can't just add
an input result that points to /form.jsp because the form needs the data out
of FormAction.  If I redirect to myForm I loose the field validation and the
same goes for chaining (I know I can hack out the errors from the stack but
that is ugly).  Using the session to save error info on is also ugly.

My preference is to use just one action class and have two methods.  I would
use execute() to get the data to view the form and postData() for posting
the data.  This way if postData found a field errors it could call execute
and then return an input status.  This solution still has problems in terms
of interceptor validators.  The validator needs to check for required fields
only when the postData() method is called and not when execute is called and
if there is an error when calling postData() it needs to call execute before
returning an input status.  I would like to make a validator that is smart
enough to know when to validate fields and when not to based on the method
being called but I cannot find a way to get what method on the action is
being called.

Is there a best practices on how to handle form data in an elegant manner?
Is there a way to know what method is being called?
So many questions and so few answers :(

thanks
Brian




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



Re: Handling form data

2008-04-30 Thread Greg Lindholm

This should help you 
http://struts.apache.org/2.0.11.1/docs/how-do-we-repopulate-controls-when-validation-fails.html
FAQ:How do we repopulate controls when validation fails .
You can use the Preparable interface to load the data from the database.
Validation does not (by default config) run on result of "input".



Brian Hawkins-3 wrote:
> 
> I've run into a situation that I would like to get others opinions on.
> 
> The problem is with handling a form.  Here is the scenario: I have a form
> called form.jsp, this form needs data from the database so it has an
> associated FormAction.java class.  The struts.xml file looks like this:
> 
> 
> /form.jsp
> 
> 
> The form then posts the data to another action called postForm and the
> struts.xml looks like this:
> 
> 
> ...
> 
> 
> Now for the issues.  The first issue is field validation.  I can't just
> add
> an input result that points to /form.jsp because the form needs the data
> out
> of FormAction.  If I redirect to myForm I loose the field validation and
> the
> same goes for chaining (I know I can hack out the errors from the stack
> but
> that is ugly).  Using the session to save error info on is also ugly.
> 
> My preference is to use just one action class and have two methods.  I
> would
> use execute() to get the data to view the form and postData() for posting
> the data.  This way if postData found a field errors it could call execute
> and then return an input status.  This solution still has problems in
> terms
> of interceptor validators.  The validator needs to check for required
> fields
> only when the postData() method is called and not when execute is called
> and
> if there is an error when calling postData() it needs to call execute
> before
> returning an input status.  I would like to make a validator that is smart
> enough to know when to validate fields and when not to based on the method
> being called but I cannot find a way to get what method on the action is
> being called.
> 
> Is there a best practices on how to handle form data in an elegant manner?
> Is there a way to know what method is being called?
> So many questions and so few answers :(
> 
> thanks
> Brian
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Handling-form-data-tp16968494p16982984.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Handling form data

2008-04-29 Thread Brian Hawkins
I've run into a situation that I would like to get others opinions on.

The problem is with handling a form.  Here is the scenario: I have a form
called form.jsp, this form needs data from the database so it has an
associated FormAction.java class.  The struts.xml file looks like this:


/form.jsp


The form then posts the data to another action called postForm and the
struts.xml looks like this:


...


Now for the issues.  The first issue is field validation.  I can't just add
an input result that points to /form.jsp because the form needs the data out
of FormAction.  If I redirect to myForm I loose the field validation and the
same goes for chaining (I know I can hack out the errors from the stack but
that is ugly).  Using the session to save error info on is also ugly.

My preference is to use just one action class and have two methods.  I would
use execute() to get the data to view the form and postData() for posting
the data.  This way if postData found a field errors it could call execute
and then return an input status.  This solution still has problems in terms
of interceptor validators.  The validator needs to check for required fields
only when the postData() method is called and not when execute is called and
if there is an error when calling postData() it needs to call execute before
returning an input status.  I would like to make a validator that is smart
enough to know when to validate fields and when not to based on the method
being called but I cannot find a way to get what method on the action is
being called.

Is there a best practices on how to handle form data in an elegant manner?
Is there a way to know what method is being called?
So many questions and so few answers :(

thanks
Brian


Re: Struts 1.3 : DynaValidatorActionForm missing input form data on errors display

2008-03-18 Thread Laurie Harper

eod wrote:

Hi,

I'm seeing input form data disappear if the validation fails & the page is
re-displayed; have Googled around but found nothing specific to dyna forms,
so I'm hoping someone has come across this & know what the issue is; I had
tried setting the action's scope to session as a test, but the form data
still disappears.

The form is declared as a DynaValidatorActionForm b/c I hope to re-use it in
later actions.
I'm using an initial setup action w/ validation off which forwards to the
page in question that captures user data.

Thanks in advance for any help.

Here are the relevant form, actions & validation declarations :

struts-config.xml :


 
 
 
 
 
 
 
 












validation.xml :





 





What does shipping.page refer to? A Tiles definition? The 'input' 
attribute of your form handling action should probably point back to the 
setup action.


L.


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



Struts 1.3 : DynaValidatorActionForm missing input form data on errors display

2008-03-12 Thread eod

Hi,

I'm seeing input form data disappear if the validation fails & the page is
re-displayed; have Googled around but found nothing specific to dyna forms,
so I'm hoping someone has come across this & know what the issue is; I had
tried setting the action's scope to session as a test, but the form data
still disappears.

The form is declared as a DynaValidatorActionForm b/c I hope to re-use it in
later actions.
I'm using an initial setup action w/ validation off which forwards to the
page in question that captures user data.

Thanks in advance for any help.

Here are the relevant form, actions & validation declarations :

struts-config.xml :

 
 
 
 
 
 
 
 
 











validation.xml :





 


...



-- 
View this message in context: 
http://www.nabble.com/Struts-1.3-%3A-DynaValidatorActionForm-missing-input-form-data-on-errors-display-tp16011991p16011991.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Difficulty with submitting variable amouts of form data

2007-08-02 Thread Ken Bowen

Hi,

[I'm using struts 1.2.7  (with EL from contrib) on Tomcat 5.5.9].

I'm attempting to submit variable amounts of form data in a table following
the model of James Turner: 
http://www.developer.com/java/ejb/article.php/10931_3321521_1.
The goal is to retrieve items (user-configured "alerts") from a DB, 
present descriptions
of them as lines in a table, with checkboxes for "edit" and "delete" 
added to each.

Here is the relevant part of my struts-config.xml:

  type="org.apache.struts.action.DynaActionForm" >  
  



 name="dynamicEditAlertForm"

 validate="false"
 scope="session"
 type="com...SetupEditAlertFormAction" >
 

 
 name="dynamicEditAlertForm"

 validate="false"
 scope="session"
 type="com...EditAlertAction" >
 


Successful login forwards to /SetupEditAlertForm, which is intended to 
create

the session-scoped form which will be associated with the form for choosing
(on page begin.work) the items to be edited;  The form action is /EditAlert
(see jsp below).

Here is the relevant part of the execute code for SetupEditAlertFormAction:

   List alertChoiceDescs
   = alertsDBMgr.getAlertBeansChoiceDescs(); //get alerts from db

   AlertChoiceDesc[] alertLines
   = new AlertChoiceDesc[alertChoiceDescs.size()];
   alertChoiceDescs.toArray(alertLines);

   df.set("alertsArray", alertLines);
   return mapping.findForward("success");


The class AlertChoiceDesc is a vanilla Bean (with properties id, 
description, etc.)


The JSP page 'begin.work' is defined in a struts-tiles.xml definition.  The
relevant part of the page body is this:

   
   
ID ...  Edit Delete 
   
   

   
   
   ...
   -- // placeholders for checkboxes to be added
   --
   
   
   


   

   
   
   
My current db contains 7 user alerts.  Debugging 
SetupEditAlertFormAction shows

that the variable alertLines contains the expected 7 AlertChoiceDesc objects
at the line:df.set("alertsArray", alertLines);

However, the JSP page 'begin.work' displays the table with only the 
header and

the submit buttons -- no data rows.

I've tried this using both
  type="org.apache.struts.action.DynaActionForm" >  
as shown here, and with the type

  type="org.apache.struts.validator.DynaValidatorForm"
used by Turner.  The behavior is the same in both cases>

I hope someone can help me see what I'm missing here.

More generally, I'm not committed to this specific pattern.  
I'll be happy to use any other technique which would allow me to present 
a variable
number of data items to the user, with checkbox (or radio buttons) 
attached, and

then obtain the user's choices.

Thanks in advance,
Ken Bowen


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



Re: Submitting a variable amount of form data

2007-07-29 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Richard,

Richard Sayre wrote:
> I have a form that can have 1 to many 'Name'  text fields.  In struts
> 2 how do I set up the action so it can automatically grab the values
> that are in those fields?
> 
> If I had 1 name field I would just put a name variable in the Action
> Class and create a setter and getter for it.  How do I do this with
> multiple names?

You do the same thing, but use an array of String objects as the data type:

private String[] _name;
public void setName(String[] name) { _name = name }
public String[] getName() { return _name; }

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGrJKP9CaO5/Lv0PARAvTnAJ4mWls7/Ms5RbKcBo1OIz0RXUWvkQCbBz69
Mfp7JuBYAwLCmLNNK+NTtR0=
=JmcI
-END PGP SIGNATURE-

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



Submitting a variable amount of form data

2007-07-29 Thread Richard Sayre
I have a form that can have 1 to many 'Name'  text fields.  In struts
2 how do I set up the action so it can automatically grab the values
that are in those fields?

If I had 1 name field I would just put a name variable in the Action
Class and create a setter and getter for it.  How do I do this with
multiple names?

Thanks,

Rich

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



Re: autocompleter y multipart/form-data

2007-06-08 Thread Musachy Barroso

You will have to take a look at Dojo's documentation. That form is submitted
using dojo.io.bind, and I don't think it supports multiparts

musachy

On 6/8/07, Nicolás Pace <[EMAIL PROTECTED]> wrote:


Hello

When I setup my form with encoding=multiaprt/form-data, the
autocompleter tag stops working.
When i trace the problem, it seems that no parameters are sent.
Any suggestion?

Thanks

Nickoar

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





--
"Hey you! Would you help me to carry the stone?" Pink Floyd


autocompleter y multipart/form-data

2007-06-08 Thread Nicolás Pace

Hello

When I setup my form with encoding=multiaprt/form-data, the
autocompleter tag stops working.
When i trace the problem, it seems that no parameters are sent.
Any suggestion?

Thanks

Nickoar

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



parameters interceptor and multipart/form-data

2007-06-04 Thread Joshua Szmajda

Hi all,

Whenever I set the enctype on my form to multipart/form-data (in order 
to handle some file uploads), it sporadically will stop the parameters 
interceptor from receiving any data at all.


When this happens, the log shows:
12:47:23,999 [http-8080-Processor24] DEBUG 
erceptor.ParametersInterceptor  - Setting params

as opposed to something like:
12:46:31,516 [http-8080-Processor25] DEBUG 
erceptor.ParametersInterceptor  - Setting params ferm.weight => [  ] 
ferm.program => [  ] ...


If I take off the enctype attribute, it always works fine (except for 
uploading files of course).


I've seen one other reference to this problem here: 
http://forums.opensymphony.com/thread.jspa?messageID=56353�

but no solution.

Any help is greatly appreciated!

-Joshua Szmajda

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



Re: Form data to Vector

2007-04-16 Thread Lance

ok, i hadn't realised you were a newb.
yes, vector is on your form... i'd use an ArrayList tho (Vector is 
synchronized = slower)


eg
public ActionForward execute(ActionMapping mapping, ActionForm f, 
javax.servlet.http.HttpServletRequest request, 
javax.servlet.http.HttpServletResponse response)  {

   MyForm form = (MyForm) f;

  if ("add".equals(mapping.getParameter()) {
  form.getVector().add(new Record());
  } else if ("save".equals(mapping.getParameter()) {
  saveRecords(form.getVector());
  }
}

try searching the web for struts CRUD examples / tutorials.

Balazs Michnay wrote:

OK, we're getting closer and closer to the solution... :)
It seems that only the first options works for me, because the data are held by two 
 controls that are created dynamically and are populated from the 
db. So when you click on the first one, the form is submitted by a Javascript 
function so that the second one can be populated with db data.

Yes, I have two different .do actions for each submit button.

  

Your add action adds an empty row to your vector then goes back to the page,
JSP magically draws the empty record.
  


OK, now I completely understand the logic, I just don't see how it can be 
implemented.
I really need to know where the vector should be stored (form bean?) and how 
exactly I can add an element to it (create a method in the form bean class to 
add elements?).
You say, that elements should be added in the action class, but how can I 
reference a bean method that performs the actual adding? I couldn't figure it 
out...
Of course, when you press the submit button (not the add button) all the 
previously added elements must be available...

I hope my goal is clear for you,

Thanks a lot,

MB

- Original Message 
From: Lance <[EMAIL PROTECTED]>
To: Struts Users Mailing List 
Sent: Monday, April 16, 2007 2:41:05 PM
Subject: Re: Form data to Vector

Ok, so your add button creates a new blank record on your page
Your save button posts the form to some save action which validates / 
saves to the db


Two options:
1.
When you click on your "add" button you submit the form
You submit the form to /add.do instead of /save.do
Your add action adds an empty row to your vector then goes back to the 
page, JSP magically draws the empty record.
When you hit save, the record is in the vector so struts can just 
populate it.

Worse user experience because of serverside hit

2.
Add button calls a javascript function which uses the DOM to create a 
row with the inputs in the same style as your jsp

No serverside hit for "add"
Need to use a LazyList / Factory so that when you post to /save.do, the 
empty record will be created before struts populates it.


Balazs Michnay wrote:
  

This is how I need to do it: I
have a form with two submit buttons. One should add the content of a text field 
to a Vector (which is therefore in the form bean) without leaving the page, and 
the other submit button should point to another page that has access to the 
Vector values.
So I have two action classes, one for each submit button. Pressing one of them 
should therefore add one value to the Vector. I try to do this in my JSP, 
because I don't know how to call a specific bean method from the action class...
Hope I could explain it clearly...

Thanks for you help,

MB

- Original Message 
From: Lance <[EMAIL PROTECTED]>
To: Struts Users Mailing List 
Sent: Monday, April 16, 2007 2:15:06 PM
Subject: Re: Form data to Vector

Ok, im not sure how exactly you are using it but this is how I tend to 
do it.


In your load() action, you hit the db and generate some object for each 
row and put them into your vector.
Your jsp loops over all of the objects in the vector and displays 
s for each object (row)


Sometimes, you may generate a row without a serverside call (javascript) 
then post the form. In this case the set(index, object) of your vector 
will cause an IndexOutOfBoundsException. For this case, I use a LazyList 
and a factory which creates an empty object at the new index, then 
struts can populate the object with the  values.


http://jakarta.apache.org/commons/collections/apidocs-COLLECTIONS_3_0/org/apache/commons/collections/list/LazyList.html

Balazs Michnay wrote:
  


Struts does not seem to accept a Vector-typed field as a property value. The 
form simply fails to load.
I'd happily use LazyList and a Factory together instead of a Vector if it's 
easy to implement...
First I wanted to get it working with Vector, then I can easily switch to a 
different container.


In my JSP:


In my bean:
private Vector vizsgalatEsOrvos;

public Vector getVizsgalatEsOrvos() {
return vizsgalatEsOrvos;
}

public void setVizsgalatEsOrvos(Vector vizsgalatEsOrvos) {
this.vizsgalatEsOrvos = vizsgalatEsOrvos;
}

Re: Form data to Vector

2007-04-16 Thread Balazs Michnay
OK, we're getting closer and closer to the solution... :)
It seems that only the first options works for me, because the data are held by 
two  controls that are created dynamically and are populated from 
the db. So when you click on the first one, the form is submitted by a 
Javascript function so that the second one can be populated with db data.

Yes, I have two different .do actions for each submit button.

>> Your add action adds an empty row to your vector then goes back to the page,
>> JSP magically draws the empty record.

OK, now I completely understand the logic, I just don't see how it can be 
implemented.
I really need to know where the vector should be stored (form bean?) and how 
exactly I can add an element to it (create a method in the form bean class to 
add elements?).
You say, that elements should be added in the action class, but how can I 
reference a bean method that performs the actual adding? I couldn't figure it 
out...
Of course, when you press the submit button (not the add button) all the 
previously added elements must be available...

I hope my goal is clear for you,

Thanks a lot,

MB

- Original Message 
From: Lance <[EMAIL PROTECTED]>
To: Struts Users Mailing List 
Sent: Monday, April 16, 2007 2:41:05 PM
Subject: Re: Form data to Vector

Ok, so your add button creates a new blank record on your page
Your save button posts the form to some save action which validates / 
saves to the db

Two options:
1.
When you click on your "add" button you submit the form
You submit the form to /add.do instead of /save.do
Your add action adds an empty row to your vector then goes back to the 
page, JSP magically draws the empty record.
When you hit save, the record is in the vector so struts can just 
populate it.
Worse user experience because of serverside hit

2.
Add button calls a javascript function which uses the DOM to create a 
row with the inputs in the same style as your jsp
No serverside hit for "add"
Need to use a LazyList / Factory so that when you post to /save.do, the 
empty record will be created before struts populates it.

Balazs Michnay wrote:
> This is how I need to do it: I
> have a form with two submit buttons. One should add the content of a text 
> field to a Vector (which is therefore in the form bean) without leaving the 
> page, and the other submit button should point to another page that has 
> access to the Vector values.
> So I have two action classes, one for each submit button. Pressing one of 
> them should therefore add one value to the Vector. I try to do this in my 
> JSP, because I don't know how to call a specific bean method from the action 
> class...
> Hope I could explain it clearly...
>
> Thanks for you help,
>
> MB
>
> - Original Message 
> From: Lance <[EMAIL PROTECTED]>
> To: Struts Users Mailing List 
> Sent: Monday, April 16, 2007 2:15:06 PM
> Subject: Re: Form data to Vector
>
> Ok, im not sure how exactly you are using it but this is how I tend to 
> do it.
>
> In your load() action, you hit the db and generate some object for each 
> row and put them into your vector.
> Your jsp loops over all of the objects in the vector and displays 
> s for each object (row)
>
> Sometimes, you may generate a row without a serverside call (javascript) 
> then post the form. In this case the set(index, object) of your vector 
> will cause an IndexOutOfBoundsException. For this case, I use a LazyList 
> and a factory which creates an empty object at the new index, then 
> struts can populate the object with the  values.
>
> http://jakarta.apache.org/commons/collections/apidocs-COLLECTIONS_3_0/org/apache/commons/collections/list/LazyList.html
>
> Balazs Michnay wrote:
>   
>> Struts does not seem to accept a Vector-typed field as a property value. The 
>> form simply fails to load.
>> I'd happily use LazyList and a Factory together instead of a Vector if it's 
>> easy to implement...
>> First I wanted to get it working with Vector, then I can easily switch to a 
>> different container.
>>
>> 
>> In my JSP:
>> 
>> 
>> In my bean:
>> private Vector vizsgalatEsOrvos;
>>
>> public Vector getVizsgalatEsOrvos() {
>> return vizsgalatEsOrvos;
>> }
>>
>> public void setVizsgalatEsOrvos(Vector vizsgalatEsOrvos) {
>> this.vizsgalatEsOrvos = vizsgalatEsOrvos;
>> }
>> 
>> Instantiating my Vector in the constructor won't help...
>> Struts should call
>>
>> myForm.getMyVector().set(0, ?)
>>
>> Do I need to implement this metod? Do I need to write my own setter

Re: Form data to Vector

2007-04-16 Thread Lance

Ok, so your add button creates a new blank record on your page
Your save button posts the form to some save action which validates / 
saves to the db


Two options:
1.
When you click on your "add" button you submit the form
You submit the form to /add.do instead of /save.do
Your add action adds an empty row to your vector then goes back to the 
page, JSP magically draws the empty record.
When you hit save, the record is in the vector so struts can just 
populate it.

Worse user experience because of serverside hit

2.
Add button calls a javascript function which uses the DOM to create a 
row with the inputs in the same style as your jsp

No serverside hit for "add"
Need to use a LazyList / Factory so that when you post to /save.do, the 
empty record will be created before struts populates it.


Balazs Michnay wrote:

This is how I need to do it: I
have a form with two submit buttons. One should add the content of a text field 
to a Vector (which is therefore in the form bean) without leaving the page, and 
the other submit button should point to another page that has access to the 
Vector values.
So I have two action classes, one for each submit button. Pressing one of them 
should therefore add one value to the Vector. I try to do this in my JSP, 
because I don't know how to call a specific bean method from the action class...
Hope I could explain it clearly...

Thanks for you help,

MB

- Original Message 
From: Lance <[EMAIL PROTECTED]>
To: Struts Users Mailing List 
Sent: Monday, April 16, 2007 2:15:06 PM
Subject: Re: Form data to Vector

Ok, im not sure how exactly you are using it but this is how I tend to 
do it.


In your load() action, you hit the db and generate some object for each 
row and put them into your vector.
Your jsp loops over all of the objects in the vector and displays 
s for each object (row)


Sometimes, you may generate a row without a serverside call (javascript) 
then post the form. In this case the set(index, object) of your vector 
will cause an IndexOutOfBoundsException. For this case, I use a LazyList 
and a factory which creates an empty object at the new index, then 
struts can populate the object with the  values.


http://jakarta.apache.org/commons/collections/apidocs-COLLECTIONS_3_0/org/apache/commons/collections/list/LazyList.html

Balazs Michnay wrote:
  

Struts does not seem to accept a Vector-typed field as a property value. The 
form simply fails to load.
I'd happily use LazyList and a Factory together instead of a Vector if it's 
easy to implement...
First I wanted to get it working with Vector, then I can easily switch to a 
different container.


In my JSP:


In my bean:
private Vector vizsgalatEsOrvos;

public Vector getVizsgalatEsOrvos() {
return vizsgalatEsOrvos;
}

public void setVizsgalatEsOrvos(Vector vizsgalatEsOrvos) {
this.vizsgalatEsOrvos = vizsgalatEsOrvos;
}

Instantiating my Vector in the constructor won't help...
Struts should call

myForm.getMyVector().set(0, ?)

Do I need to implement this metod? Do I need to write my own setters/getters to 
do this?
How can I do this exactly? 


Thanks,

MB

- Original Message 
From: Lance <[EMAIL PROTECTED]>
To: user@struts.apache.org
Sent: Monday, April 16, 2007 12:12:00 PM
Subject: Re: Form data to Vector



Lance wrote:
  


Sorry, it helps if i read your question fully.

The way to do this is to name your html form elements using in the 
struts (BeanUtils) conventions
If you have a form element named "myVector[3]" then struts will call 
myForm.getMyVector().set(3, ?)


It is sometimes easiest to use the struts nested tags to do this


   
   


will produce





If you are adding elements to the vector (instead of just editing 
existing vector elements), you might want to use a LazyList and a 
Factory together instead of a Vector, if you do, I can give you a bit 
more help if you need.


Lance.


Lance wrote:

  

Only way to get data into a Vector is by a scriptlet or in your action.
Struts 2's OGNL has a nice way of doing this but unfortunately with 
S1 we're left with dirty scriptlets in JSPs some of the time.


JSTL has a  that sometimes comes in handy where you 
provide a comma separated list of Strings and iterate through the 
elements.


Balazs Michnay wrote:
  


Thanks for the reply.
Yes, I know how to use the  to display the elements 
of a Vector (or ArrayList), I just don't see how to put these values 
into the Vector. I mean if I have a Vector (or an ArrayList) 
property in my form bean, how do I put some of my form data into my 
bean property. Do I need to modify the setters/getters? There must 
be a way to do this...
And yes, you're right, one the data are in the Vector, I can use 
 to display them.

Thanks for your help,

Re

Re: Form data to Vector

2007-04-16 Thread Balazs Michnay
This is how I need to do it: I
have a form with two submit buttons. One should add the content of a text field 
to a Vector (which is therefore in the form bean) without leaving the page, and 
the other submit button should point to another page that has access to the 
Vector values.
So I have two action classes, one for each submit button. Pressing one of them 
should therefore add one value to the Vector. I try to do this in my JSP, 
because I don't know how to call a specific bean method from the action class...
Hope I could explain it clearly...

Thanks for you help,

MB

- Original Message 
From: Lance <[EMAIL PROTECTED]>
To: Struts Users Mailing List 
Sent: Monday, April 16, 2007 2:15:06 PM
Subject: Re: Form data to Vector

Ok, im not sure how exactly you are using it but this is how I tend to 
do it.

In your load() action, you hit the db and generate some object for each 
row and put them into your vector.
Your jsp loops over all of the objects in the vector and displays 
s for each object (row)

Sometimes, you may generate a row without a serverside call (javascript) 
then post the form. In this case the set(index, object) of your vector 
will cause an IndexOutOfBoundsException. For this case, I use a LazyList 
and a factory which creates an empty object at the new index, then 
struts can populate the object with the  values.

http://jakarta.apache.org/commons/collections/apidocs-COLLECTIONS_3_0/org/apache/commons/collections/list/LazyList.html

Balazs Michnay wrote:
> Struts does not seem to accept a Vector-typed field as a property value. The 
> form simply fails to load.
> I'd happily use LazyList and a Factory together instead of a Vector if it's 
> easy to implement...
> First I wanted to get it working with Vector, then I can easily switch to a 
> different container.
>
> 
> In my JSP:
> 
> 
> In my bean:
> private Vector vizsgalatEsOrvos;
>
> public Vector getVizsgalatEsOrvos() {
> return vizsgalatEsOrvos;
> }
>
> public void setVizsgalatEsOrvos(Vector vizsgalatEsOrvos) {
> this.vizsgalatEsOrvos = vizsgalatEsOrvos;
> }
> 
> Instantiating my Vector in the constructor won't help...
> Struts should call
>
> myForm.getMyVector().set(0, ?)
>
> Do I need to implement this metod? Do I need to write my own setters/getters 
> to do this?
> How can I do this exactly? 
>
> Thanks,
>
> MB
>
> - Original Message ----
> From: Lance <[EMAIL PROTECTED]>
> To: user@struts.apache.org
> Sent: Monday, April 16, 2007 12:12:00 PM
> Subject: Re: Form data to Vector
>
>
>
> Lance wrote:
>   
>> Sorry, it helps if i read your question fully.
>>
>> The way to do this is to name your html form elements using in the 
>> struts (BeanUtils) conventions
>> If you have a form element named "myVector[3]" then struts will call 
>> myForm.getMyVector().set(3, ?)
>>
>> It is sometimes easiest to use the struts nested tags to do this
>>
>> 
>>
>>
>> 
>>
>> will produce
>> 
>> 
>> 
>> 
>>
>> If you are adding elements to the vector (instead of just editing 
>> existing vector elements), you might want to use a LazyList and a 
>> Factory together instead of a Vector, if you do, I can give you a bit 
>> more help if you need.
>>
>> Lance.
>>
>>
>> Lance wrote:
>> 
>>> Only way to get data into a Vector is by a scriptlet or in your action.
>>> Struts 2's OGNL has a nice way of doing this but unfortunately with 
>>> S1 we're left with dirty scriptlets in JSPs some of the time.
>>>
>>> JSTL has a  that sometimes comes in handy where you 
>>> provide a comma separated list of Strings and iterate through the 
>>> elements.
>>>
>>> Balazs Michnay wrote:
>>>   
>>>> Thanks for the reply.
>>>> Yes, I know how to use the  to display the elements 
>>>> of a Vector (or ArrayList), I just don't see how to put these values 
>>>> into the Vector. I mean if I have a Vector (or an ArrayList) 
>>>> property in my form bean, how do I put some of my form data into my 
>>>> bean property. Do I need to modify the setters/getters? There must 
>>>> be a way to do this...
>>>> And yes, you're right, one the data are in the Vector, I can use 
>>>>  to display them.
>>>> Thanks for your help,
>>>>
>>>> Regards,
>>>>
>>>> MB
>>>>
>&

Re: Form data to Vector

2007-04-16 Thread Lance
Ok, im not sure how exactly you are using it but this is how I tend to 
do it.


In your load() action, you hit the db and generate some object for each 
row and put them into your vector.
Your jsp loops over all of the objects in the vector and displays 
s for each object (row)


Sometimes, you may generate a row without a serverside call (javascript) 
then post the form. In this case the set(index, object) of your vector 
will cause an IndexOutOfBoundsException. For this case, I use a LazyList 
and a factory which creates an empty object at the new index, then 
struts can populate the object with the  values.


http://jakarta.apache.org/commons/collections/apidocs-COLLECTIONS_3_0/org/apache/commons/collections/list/LazyList.html

Balazs Michnay wrote:

Struts does not seem to accept a Vector-typed field as a property value. The 
form simply fails to load.
I'd happily use LazyList and a Factory together instead of a Vector if it's 
easy to implement...
First I wanted to get it working with Vector, then I can easily switch to a 
different container.


In my JSP:


In my bean:
private Vector vizsgalatEsOrvos;

public Vector getVizsgalatEsOrvos() {
return vizsgalatEsOrvos;
}

public void setVizsgalatEsOrvos(Vector vizsgalatEsOrvos) {
this.vizsgalatEsOrvos = vizsgalatEsOrvos;
}

Instantiating my Vector in the constructor won't help...
Struts should call

myForm.getMyVector().set(0, ?)

Do I need to implement this metod? Do I need to write my own setters/getters to 
do this?
How can I do this exactly? 


Thanks,

MB

- Original Message 
From: Lance <[EMAIL PROTECTED]>
To: user@struts.apache.org
Sent: Monday, April 16, 2007 12:12:00 PM
Subject: Re: Form data to Vector



Lance wrote:
  

Sorry, it helps if i read your question fully.

The way to do this is to name your html form elements using in the 
struts (BeanUtils) conventions
If you have a form element named "myVector[3]" then struts will call 
myForm.getMyVector().set(3, ?)


It is sometimes easiest to use the struts nested tags to do this


   
   


will produce





If you are adding elements to the vector (instead of just editing 
existing vector elements), you might want to use a LazyList and a 
Factory together instead of a Vector, if you do, I can give you a bit 
more help if you need.


Lance.


Lance wrote:


Only way to get data into a Vector is by a scriptlet or in your action.
Struts 2's OGNL has a nice way of doing this but unfortunately with 
S1 we're left with dirty scriptlets in JSPs some of the time.


JSTL has a  that sometimes comes in handy where you 
provide a comma separated list of Strings and iterate through the 
elements.


Balazs Michnay wrote:
  

Thanks for the reply.
Yes, I know how to use the  to display the elements 
of a Vector (or ArrayList), I just don't see how to put these values 
into the Vector. I mean if I have a Vector (or an ArrayList) 
property in my form bean, how do I put some of my form data into my 
bean property. Do I need to modify the setters/getters? There must 
be a way to do this...
And yes, you're right, one the data are in the Vector, I can use 
 to display them.

Thanks for your help,

Regards,

MB

- Original Message 
From: Martin Gainty <[EMAIL PROTECTED]>
To: Struts Users Mailing List 
Sent: Friday, April 13, 2007 3:45:17 PM
Subject: Re: Form data to Vector

Balazs

Take a look at
http://struts.apache.org/1.0.2/api/org/apache/struts/taglib/logic/package-summary.html 

you will see this example of implementing a vector via use of struts 
logic:iterate in your jsp


<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%
  java.util.Vector vector = new java.util.Vector();
  vector.add(new Integer(12));
  vector.add(new Integer(5));
 %>

 Do something with myCollectionElement

This email message and any files transmitted with it contain 
confidential
information intended only for the person(s) to whom this email 
message is
addressed.  If you have received this email message in error, please 
notify

the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

- Original Message - From: "Balazs Michnay" 
<[EMAIL PROTECTED]>

To: "Struts Users Mailing List" 
Sent: Friday, April 13, 2007 4:09 AM
Subject: Form data to Vector


 


Hi,

I have a form with two submit buttons. One should add the content 
of a text field to a Vector (which is in the form bean?), and the 
other one should point to another page that has access to the 
Vector values.

I'd like to know how to add form data to a Vector.
Any help would be appreciated.

Thanks a lot,

MB



___

Re: Form data to Vector

2007-04-16 Thread Balazs Michnay
Struts does not seem to accept a Vector-typed field as a property value. The 
form simply fails to load.
I'd happily use LazyList and a Factory together instead of a Vector if it's 
easy to implement...
First I wanted to get it working with Vector, then I can easily switch to a 
different container.


In my JSP:


In my bean:
private Vector vizsgalatEsOrvos;

public Vector getVizsgalatEsOrvos() {
return vizsgalatEsOrvos;
}

public void setVizsgalatEsOrvos(Vector vizsgalatEsOrvos) {
this.vizsgalatEsOrvos = vizsgalatEsOrvos;
}

Instantiating my Vector in the constructor won't help...
Struts should call

myForm.getMyVector().set(0, ?)

Do I need to implement this metod? Do I need to write my own setters/getters to 
do this?
How can I do this exactly? 

Thanks,

MB

- Original Message 
From: Lance <[EMAIL PROTECTED]>
To: user@struts.apache.org
Sent: Monday, April 16, 2007 12:12:00 PM
Subject: Re: Form data to Vector



Lance wrote:
> Sorry, it helps if i read your question fully.
>
> The way to do this is to name your html form elements using in the 
> struts (BeanUtils) conventions
> If you have a form element named "myVector[3]" then struts will call 
> myForm.getMyVector().set(3, ?)
>
> It is sometimes easiest to use the struts nested tags to do this
>
> 
>
>
> 
>
> will produce
> 
> 
> 
> 
>
> If you are adding elements to the vector (instead of just editing 
> existing vector elements), you might want to use a LazyList and a 
> Factory together instead of a Vector, if you do, I can give you a bit 
> more help if you need.
>
> Lance.
>
>
> Lance wrote:
>> Only way to get data into a Vector is by a scriptlet or in your action.
>> Struts 2's OGNL has a nice way of doing this but unfortunately with 
>> S1 we're left with dirty scriptlets in JSPs some of the time.
>>
>> JSTL has a  that sometimes comes in handy where you 
>> provide a comma separated list of Strings and iterate through the 
>> elements.
>>
>> Balazs Michnay wrote:
>>> Thanks for the reply.
>>> Yes, I know how to use the  to display the elements 
>>> of a Vector (or ArrayList), I just don't see how to put these values 
>>> into the Vector. I mean if I have a Vector (or an ArrayList) 
>>> property in my form bean, how do I put some of my form data into my 
>>> bean property. Do I need to modify the setters/getters? There must 
>>> be a way to do this...
>>> And yes, you're right, one the data are in the Vector, I can use 
>>>  to display them.
>>> Thanks for your help,
>>>
>>> Regards,
>>>
>>> MB
>>>
>>> - Original Message 
>>> From: Martin Gainty <[EMAIL PROTECTED]>
>>> To: Struts Users Mailing List 
>>> Sent: Friday, April 13, 2007 3:45:17 PM
>>> Subject: Re: Form data to Vector
>>>
>>> Balazs
>>>
>>> Take a look at
>>> http://struts.apache.org/1.0.2/api/org/apache/struts/taglib/logic/package-summary.html
>>>  
>>>
>>> you will see this example of implementing a vector via use of struts 
>>> logic:iterate in your jsp
>>>
>>> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
>>> <%
>>>   java.util.Vector vector = new java.util.Vector();
>>>   vector.add(new Integer(12));
>>>   vector.add(new Integer(5));
>>>  %>
>>> 
>>>  Do something with myCollectionElement
>>> 
>>> This email message and any files transmitted with it contain 
>>> confidential
>>> information intended only for the person(s) to whom this email 
>>> message is
>>> addressed.  If you have received this email message in error, please 
>>> notify
>>> the sender immediately by telephone or email and destroy the original
>>> message without making a copy.  Thank you.
>>>
>>> - Original Message - From: "Balazs Michnay" 
>>> <[EMAIL PROTECTED]>
>>> To: "Struts Users Mailing List" 
>>> Sent: Friday, April 13, 2007 4:09 AM
>>> Subject: Form data to Vector
>>>
>>>
>>>  
>>>> Hi,
>>>>
>>>> I have a form with two submit buttons. One should add the content 
>>>> of a text field to a Vector (which is in the form bean?), and the 
>>>> other one should point to another page that has access to the 
>>>

Re: Form data to Vector

2007-04-16 Thread Lance



Lance wrote:

Sorry, it helps if i read your question fully.

The way to do this is to name your html form elements using in the 
struts (BeanUtils) conventions
If you have a form element named "myVector[3]" then struts will call 
myForm.getMyVector().set(3, ?)


It is sometimes easiest to use the struts nested tags to do this


   
   


will produce





If you are adding elements to the vector (instead of just editing 
existing vector elements), you might want to use a LazyList and a 
Factory together instead of a Vector, if you do, I can give you a bit 
more help if you need.


Lance.


Lance wrote:

Only way to get data into a Vector is by a scriptlet or in your action.
Struts 2's OGNL has a nice way of doing this but unfortunately with 
S1 we're left with dirty scriptlets in JSPs some of the time.


JSTL has a  that sometimes comes in handy where you 
provide a comma separated list of Strings and iterate through the 
elements.


Balazs Michnay wrote:

Thanks for the reply.
Yes, I know how to use the  to display the elements 
of a Vector (or ArrayList), I just don't see how to put these values 
into the Vector. I mean if I have a Vector (or an ArrayList) 
property in my form bean, how do I put some of my form data into my 
bean property. Do I need to modify the setters/getters? There must 
be a way to do this...
And yes, you're right, one the data are in the Vector, I can use 
 to display them.

Thanks for your help,

Regards,

MB

- Original Message 
From: Martin Gainty <[EMAIL PROTECTED]>
To: Struts Users Mailing List 
Sent: Friday, April 13, 2007 3:45:17 PM
Subject: Re: Form data to Vector

Balazs

Take a look at
http://struts.apache.org/1.0.2/api/org/apache/struts/taglib/logic/package-summary.html 

you will see this example of implementing a vector via use of struts 
logic:iterate in your jsp


<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%
  java.util.Vector vector = new java.util.Vector();
  vector.add(new Integer(12));
  vector.add(new Integer(5));
 %>

 Do something with myCollectionElement

This email message and any files transmitted with it contain 
confidential
information intended only for the person(s) to whom this email 
message is
addressed.  If you have received this email message in error, please 
notify

the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

- Original Message - From: "Balazs Michnay" 
<[EMAIL PROTECTED]>

To: "Struts Users Mailing List" 
Sent: Friday, April 13, 2007 4:09 AM
Subject: Form data to Vector


 

Hi,

I have a form with two submit buttons. One should add the content 
of a text field to a Vector (which is in the form bean?), and the 
other one should point to another page that has access to the 
Vector values.

I'd like to know how to add form data to a Vector.
Any help would be appreciated.

Thanks a lot,

MB



__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 



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







__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com   







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



Re: Form data to Vector

2007-04-16 Thread Lance

Only way to get data into a Vector is by a scriptlet or in your action.
Struts 2's OGNL has a nice way of doing this but unfortunately with S1 
we're left with dirty scriptlets in JSPs some of the time.


JSTL has a  that sometimes comes in handy where you 
provide a comma separated list of Strings and iterate through the elements.


Balazs Michnay wrote:

Thanks for the reply.
Yes, I know how to use the  to display the elements of a Vector 
(or ArrayList), I just don't see how to put these values into the Vector. I mean if I 
have a Vector (or an ArrayList) property in my form bean, how do I put some of my 
form data into my bean property. Do I need to modify the setters/getters? There must 
be a way to do this...
And yes, you're right, one the data are in the Vector, I can use 
 to display them.
Thanks for your help,

Regards,

MB

- Original Message 
From: Martin Gainty <[EMAIL PROTECTED]>
To: Struts Users Mailing List 
Sent: Friday, April 13, 2007 3:45:17 PM
Subject: Re: Form data to Vector

Balazs

Take a look at
http://struts.apache.org/1.0.2/api/org/apache/struts/taglib/logic/package-summary.html
you will see this example of implementing a vector via use of struts 
logic:iterate in your jsp


<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%
  java.util.Vector vector = new java.util.Vector();
  vector.add(new Integer(12));
  vector.add(new Integer(5));
 %>

 Do something with myCollectionElement

This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

- Original Message - 
From: "Balazs Michnay" <[EMAIL PROTECTED]>

To: "Struts Users Mailing List" 
Sent: Friday, April 13, 2007 4:09 AM
Subject: Form data to Vector


  

Hi,

I have a form with two submit buttons. One should add the content of a 
text field to a Vector (which is in the form bean?), and the other one 
should point to another page that has access to the Vector values.

I'd like to know how to add form data to a Vector.
Any help would be appreciated.

Thanks a lot,

MB



__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 




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







__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
  



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



Re: Form data to Vector

2007-04-16 Thread Balazs Michnay
Thanks for the reply.
Yes, I know how to use the  to display the elements of a Vector 
(or ArrayList), I just don't see how to put these values into the Vector. I 
mean if I have a Vector (or an ArrayList) property in my form bean, how do I 
put some of my form data into my bean property. Do I need to modify the 
setters/getters? There must be a way to do this...
And yes, you're right, one the data are in the Vector, I can use 
 to display them.
Thanks for your help,

Regards,

MB

- Original Message 
From: Martin Gainty <[EMAIL PROTECTED]>
To: Struts Users Mailing List 
Sent: Friday, April 13, 2007 3:45:17 PM
Subject: Re: Form data to Vector

Balazs

Take a look at
http://struts.apache.org/1.0.2/api/org/apache/struts/taglib/logic/package-summary.html
you will see this example of implementing a vector via use of struts 
logic:iterate in your jsp

<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%
  java.util.Vector vector = new java.util.Vector();
  vector.add(new Integer(12));
  vector.add(new Integer(5));
 %>

 Do something with myCollectionElement

This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

- Original Message - 
From: "Balazs Michnay" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" 
Sent: Friday, April 13, 2007 4:09 AM
Subject: Form data to Vector


> Hi,
>
> I have a form with two submit buttons. One should add the content of a 
> text field to a Vector (which is in the form bean?), and the other one 
> should point to another page that has access to the Vector values.
> I'd like to know how to add form data to a Vector.
> Any help would be appreciated.
>
> Thanks a lot,
>
> MB
>
>
>
> __
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com 


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







__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: Form data to Vector

2007-04-13 Thread Martin Gainty

Balazs

Take a look at
http://struts.apache.org/1.0.2/api/org/apache/struts/taglib/logic/package-summary.html
you will see this example of implementing a vector via use of struts 
logic:iterate in your jsp


<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%
 java.util.Vector vector = new java.util.Vector();
 vector.add(new Integer(12));
 vector.add(new Integer(5));
%>

Do something with myCollectionElement

This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

- Original Message - 
From: "Balazs Michnay" <[EMAIL PROTECTED]>

To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, April 13, 2007 4:09 AM
Subject: Form data to Vector



Hi,

I have a form with two submit buttons. One should add the content of a 
text field to a Vector (which is in the form bean?), and the other one 
should point to another page that has access to the Vector values.

I'd like to know how to add form data to a Vector.
Any help would be appreciated.

Thanks a lot,

MB



__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 



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



Form data to Vector

2007-04-13 Thread Balazs Michnay
Hi,

I have a form with two submit buttons. One should add the content of a text 
field to a Vector (which is in the form bean?), and the other one should point 
to another page that has access to the Vector values.
I'd like to know how to add form data to a Vector.
Any help would be appreciated.

Thanks a lot,

MB



__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

RE: Empty request parameters with enctype set to "multipart/form-data"

2007-02-15 Thread Hartrich, James CTR USTRANSCOM J6
I believe there was a previous problem with FilterDispatcher.doFilter()
Cheers!

-Original Message-
From: Karsten Voges [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 15, 2007 9:17 AM
To: Struts Users Mailing List
Subject: Re: Empty request parameters with enctype set to
"multipart/form-data"

Thanks a lot. This definitly helped.
Just pasted in the following code into web.xml and the error
disappeared:

struts-cleanup
org.apache.struts2.dispatcher.ActionContextCleanUp


struts-cleanup
/*


Strange that it needs this, but good to know that there is a fix for
this.

Cheers,
Karsten.


Andrew Stepanenko schrieb:
> Hello,
>
> http://www.archivum.info/user@struts.apache.org/2007-02/msg00012.html
>
> Regards,
> Andrew Stepanenko

-
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: Empty request parameters with enctype set to "multipart/form-data"

2007-02-15 Thread Karsten Voges

Thanks a lot. This definitly helped.
Just pasted in the following code into web.xml and the error disappeared:

struts-cleanup
org.apache.struts2.dispatcher.ActionContextCleanUp


struts-cleanup
/*


Strange that it needs this, but good to know that there is a fix for this.

Cheers,
Karsten.


Andrew Stepanenko schrieb:

Hello,

http://www.archivum.info/user@struts.apache.org/2007-02/msg00012.html

Regards,
Andrew Stepanenko


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



Re: Empty request parameters with enctype set to "multipart/form-data"

2007-02-15 Thread Andrew Stepanenko

Hello,

http://www.archivum.info/user@struts.apache.org/2007-02/msg00012.html

Regards,
Andrew Stepanenko

On 2/15/07, Karsten Voges <[EMAIL PROTECTED]> wrote:

Hi list,

I downloaded Struts 2.0.5 (beta) and started developing of a small app
(simple form submit) on Tomcat 5.5.17 (JDK 1.5). Its working quite good
and I am happy with both the stability and the programming model.

Unfortunately I have a problem with some requests (form submitting)
sending no request parameters at all (empty enumeration) and setting no
fields of my actions. This mainly happens the first time the form gets
submitted and mainly.
When I set the enctype parameter in the s:form with enctype =
"application/x-www-form-urlencoded" the form gets submitted without a
problem. All request parameters are set (checked via
ServletActionContext.getRequest().getParameterNames()), all fields in
the action are populated.
But to upload files I have to set the enctype to "multipart/form-data" :(

I found the following questions with the same problem, but no solution
so far:
http://www.junlu.com/msg/309344.html
http://www.archivum.info/user@struts.apache.org/2006-12/msg00622.html

I have not special interceptors in place.
When no parameters are set, the fileinterceptor is not cleaning the tmp
files, if the request is coming in well, the fileinterceptor is logging
as well.

Of course I could seperate the rest of the form from the upload, but I
am not to sure if this would work either.
I copied all the code over from struts2-showcase-2.0.5 regarding the
fileupload and it is working most of the times, but not 100%.

The strange thing, is that it mainly happens the first time I submit,
but not the following times, but sometimes it also happens a second or
third time.
It never happens after it worked once, so after the form submit worked
once fine it works fine always.

Any help much appreciated.
Thanks,
Karsten.

-
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]



Empty request parameters with enctype set to "multipart/form-data"

2007-02-15 Thread Karsten Voges

Hi list,

I downloaded Struts 2.0.5 (beta) and started developing of a small app 
(simple form submit) on Tomcat 5.5.17 (JDK 1.5). Its working quite good 
and I am happy with both the stability and the programming model.


Unfortunately I have a problem with some requests (form submitting) 
sending no request parameters at all (empty enumeration) and setting no 
fields of my actions. This mainly happens the first time the form gets 
submitted and mainly.
When I set the enctype parameter in the s:form with enctype = 
"application/x-www-form-urlencoded" the form gets submitted without a 
problem. All request parameters are set (checked via 
ServletActionContext.getRequest().getParameterNames()), all fields in 
the action are populated.

But to upload files I have to set the enctype to "multipart/form-data" :(

I found the following questions with the same problem, but no solution 
so far:

http://www.junlu.com/msg/309344.html
http://www.archivum.info/user@struts.apache.org/2006-12/msg00622.html

I have not special interceptors in place.
When no parameters are set, the fileinterceptor is not cleaning the tmp 
files, if the request is coming in well, the fileinterceptor is logging 
as well.


Of course I could seperate the rest of the form from the upload, but I 
am not to sure if this would work either.
I copied all the code over from struts2-showcase-2.0.5 regarding the 
fileupload and it is working most of the times, but not 100%.


The strange thing, is that it mainly happens the first time I submit, 
but not the following times, but sometimes it also happens a second or 
third time.
It never happens after it worked once, so after the form submit worked 
once fine it works fine always.


Any help much appreciated.
Thanks,
Karsten.

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



Re: [s2] Autopopupation of fields fails with "enctype="multipart/form-data" in form

2007-02-04 Thread zafer Mohamed
Thanks Dariusz,

Adding the filter fixed the issue.

Z

- Original Message 
From: Dariusz Wojtas <[EMAIL PROTECTED]>
To: Struts Users Mailing List 
Sent: Sunday, February 4, 2007 1:20:02 PM
Subject: Re: [s2] Autopopupation of fields fails with 
"enctype="multipart/form-data" in form

Hi Zafer,

I would:

1) check the archives of this mailing list from the last 2 weeks,
there was a thread about fileupload issues (parameters are not always
set from such form). One of the hints was to use some magical filter
in front of the application. It is supposed to clear sth.

2) check if you have any custom filter in front of your action - the
multipart parser requires a 'virgin' request object, without accessing
any params in it prior to multiparse analysis. If you try to operate
on the request earlier - multiparser is not able to finish his task.

regards
Dariusz Wojtas

On 2/4/07, zafer Mohamed <[EMAIL PROTECTED]> wrote:
> I have a form with the enctype set to "enctype="multipart/form-data" as I am 
> uploading a file, the form also contains some other fields. On submission the 
> autopopulation of other fields fails, but it works correctly if I remove the 
> enctype="multipart/form-data". Any idea..?
>
> Thanks
> Zafer

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









 

Need Mail bonding?
Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.
http://answers.yahoo.com/dir/?link=list&sid=396546091

Re: [s2] Autopopupation of fields fails with "enctype="multipart/form-data" in form

2007-02-04 Thread Dariusz Wojtas

Hi Zafer,

I would:

1) check the archives of this mailing list from the last 2 weeks,
there was a thread about fileupload issues (parameters are not always
set from such form). One of the hints was to use some magical filter
in front of the application. It is supposed to clear sth.

2) check if you have any custom filter in front of your action - the
multipart parser requires a 'virgin' request object, without accessing
any params in it prior to multiparse analysis. If you try to operate
on the request earlier - multiparser is not able to finish his task.

regards
Dariusz Wojtas

On 2/4/07, zafer Mohamed <[EMAIL PROTECTED]> wrote:

I have a form with the enctype set to "enctype="multipart/form-data" as I am uploading a 
file, the form also contains some other fields. On submission the autopopulation of other fields fails, 
but it works correctly if I remove the enctype="multipart/form-data". Any idea..?

Thanks
Zafer


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



[s2] Autopopupation of fields fails with "enctype="multipart/form-data" in form

2007-02-04 Thread zafer Mohamed
I have a form with the enctype set to "enctype="multipart/form-data" as I am 
uploading a file, the form also contains some other fields. On submission the 
autopopulation of other fields fails, but it works correctly if I remove the 
enctype="multipart/form-data". Any idea..?

Thanks
Zafer




 

Get your own web address.  
Have a HUGE year through Yahoo! Small Business.
http://smallbusiness.yahoo.com/domains/?p=BESTDEAL

Re: Make Struts set form data onto the action in same order as the form's fields

2007-01-26 Thread Célio Cidral Junior

Hi Chris,

2007/1/25, Christopher Schultz <[EMAIL PROTECTED]>:

I agree with Dave: you're trying to do too much in your forms.


I disagree. There are two options that I consider acceptable for me.
One of them is to write getters and setters for each form's field
(just like a form bean). The other one is to write a getter for a
domain bean (like getCustomer(), in the given example) and make the
form read and write values from that bean via OGNL. Indeed, writing
only one getter is much less work than writing a bunch of getters and
setters for each form's field, specially when the form has a large
number of fields. However, there's a semantic dependency between
parameter settings (the customer's id must be set before any other
parameter). As it's not possible to guarantee the ordering of the
parameter setting in a "clean" way, I'm going to stick with the first
option.

Thanks to all for the help/support/suggestions/patience!  ;-)

Célio.

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



Re: Make Struts set form data onto the action in same order as the form's fields

2007-01-25 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Célio,

Célio Cidral Junior wrote:
> The problem happens when the user
> is *altering* an existing customer (creating a new customer works
> fine), more specifically when the user is submitting changes from the
> form to an existing customer object (alongside with an existing id);
> in that case, the id must be set before getCustomer() is called,
> otherwise a new customer will be created with zero id. Loading the
> form with an existing customer works fine. Submitting changes to it is
> where the problem resides. The idea behind getCustomer() is to
> abstract the retrieving of the customer object wherever it's called
> along the action's code so that I don't have to care about whether
> it's an existing customer or not.

I agree with Dave: you're trying to do too much in your forms. You
should try to stick to a form bean that does nothing other than shuttle
data to and from the form. Your action should be invoking database
fetches and things of that nature, copying the form data from the form
bean to your DAOs, etc.

I think you're doing too much at once, and paying the price for it.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFuRdK9CaO5/Lv0PARAvrCAJ49E8WINtd8vt6wfKbXfHcIhUK/zQCeNHWI
Y+X+A0efqwOtHftlT54uj8M=
=P8ks
-END PGP SIGNATURE-

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



Re: Make Struts set form data onto the action in same order as the form's fields

2007-01-25 Thread Tom Schneider

I think your best bet would be to break up the parameter setting into 2
parts.  (A variation on the paramsPrepareParamsStack) The first part would
set all parameters needed to load the data from the data.  Then in the
prepare, you would have the id's needed to load the data from the database.
The next part would set all the rest of the parameters.  This would be the
approach I would take if I needed to load something from the database before
the parameters are set.
Tom

On 1/25/07, Dale Newfield <[EMAIL PROTECTED]> wrote:


Célio Cidral Junior wrote:
> Well, having Struts passing parameters in the order defined by the
> html form would solve my problem.  :-)

While setting parameters in a request struts has no idea what order they
were ordered in the originally generated form--remember that a single
action may be called from multiple forms on multiple pages that all
order the fields differently.  All struts has to work with is the order
in which the fields are present in the request, which is going to be
different for requests coming from different browsers, going through
different proxies, etc.

If you want to guarantee the order in which parameters are pulled from
the request, don't use the parameters interceptor and do all that
processing yourself in your action.  If you want to use the parameters
interceptor, but you want to ensure that a model object is loaded before
  parameters are set, either explicitly pull the key parameter out of
the request during the prepare call (using prepare in the stack before
parameters), or simply use the parameters interceptor both before and
after the prepare interceptor.

Believe us, you're not the first person to have this problem.  Believe
us, this is the simplest solution from among those that are not broken.

-Dale


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




Re: Make Struts set form data onto the action in same order as the form's fields

2007-01-25 Thread Dale Newfield

Célio Cidral Junior wrote:

Well, having Struts passing parameters in the order defined by the
html form would solve my problem.  :-)


While setting parameters in a request struts has no idea what order they 
were ordered in the originally generated form--remember that a single 
action may be called from multiple forms on multiple pages that all 
order the fields differently.  All struts has to work with is the order 
in which the fields are present in the request, which is going to be 
different for requests coming from different browsers, going through 
different proxies, etc.


If you want to guarantee the order in which parameters are pulled from 
the request, don't use the parameters interceptor and do all that 
processing yourself in your action.  If you want to use the parameters 
interceptor, but you want to ensure that a model object is loaded before 
 parameters are set, either explicitly pull the key parameter out of 
the request during the prepare call (using prepare in the stack before 
parameters), or simply use the parameters interceptor both before and 
after the prepare interceptor.


Believe us, you're not the first person to have this problem.  Believe 
us, this is the simplest solution from among those that are not broken.


-Dale


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



Re: Make Struts set form data onto the action in same order as the form's fields

2007-01-25 Thread Célio Cidral Junior

2007/1/25, Tom Schneider <[EMAIL PROTECTED]>:

Unfortunately I don't think that's possible.  The parameters get put into a
map structure, so the original parameter order is lost by the time it gets
to the servlet API.  We've run into several instances where something will
work on one app server, but break on another because we had duplicate
parameters on the url--so depending on how the app server handled it, we
would get one or the other value.  I can't imagine that any java web
framework could do this successfully.


That's sad!  :-(

Célio.

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



Re: Make Struts set form data onto the action in same order as the form's fields

2007-01-25 Thread Tom Schneider

Unfortunately I don't think that's possible.  The parameters get put into a
map structure, so the original parameter order is lost by the time it gets
to the servlet API.  We've run into several instances where something will
work on one app server, but break on another because we had duplicate
parameters on the url--so depending on how the app server handled it, we
would get one or the other value.  I can't imagine that any java web
framework could do this successfully.
Tom

On 1/25/07, Célio Cidral Junior <[EMAIL PROTECTED]> wrote:


2007/1/25, Tom Schneider <[EMAIL PROTECTED]>:
> This is an issue with the typical edit/save scenario.  The problem we
are
> discussing is that the domain model is needed in some form before the
> parameter can be repopulated from the form save.  The technique you are
> using is to reread the data from the database before the parameters are
> set.  An alternative technique would be to put the domain model into a
place
> in the session--so on the save, you can retrieve the the model from the
> session and then allow the parameters interceptor to populate the new
data.
> (This is referred to as detached objects in the Hibernate world)  The
> advantage of putting the model in the session is that if some else
modifies
> the data before you reread the data, but after you have displayed the
edit
> page, you will not have the original model.  This particularly a problem
> with a model where you are dealing with lists of domain objects.  In
this
> case, the edit will fail because you will be trying to set parameters on
> items that might not exist anymore.  (Or you've pulled in data that the
user
> doesn't know about)  Therefore the safer technique is to save off the
> model.  If you're concerned about putting too much into the session, you
can
> store the data in a cache, such as ehcache, that will store items to
disk if
> there are too many things in memory.  (This is the technique that we
> used--we called it a model repository and we created a couple different
> implementations)  I would love to see something like this out-of-the-box
> with struts2, but nothing currently exists.

Thanks, I really appreciate your suggestions. However, I prefer a
stateless approach because (I think) it helps to keep things simple in
this case. Using some kind of cache between page requests is more like
a stateful approach that I would like to avoid here for simplicity
reasons.

Well, having Struts passing parameters in the order defined by the
html form would solve my problem.  :-)

Regards,

Célio.

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




Re: Make Struts set form data onto the action in same order as the form's fields

2007-01-25 Thread Célio Cidral Junior

2007/1/25, Tom Schneider <[EMAIL PROTECTED]>:

This is an issue with the typical edit/save scenario.  The problem we are
discussing is that the domain model is needed in some form before the
parameter can be repopulated from the form save.  The technique you are
using is to reread the data from the database before the parameters are
set.  An alternative technique would be to put the domain model into a place
in the session--so on the save, you can retrieve the the model from the
session and then allow the parameters interceptor to populate the new data.
(This is referred to as detached objects in the Hibernate world)  The
advantage of putting the model in the session is that if some else modifies
the data before you reread the data, but after you have displayed the edit
page, you will not have the original model.  This particularly a problem
with a model where you are dealing with lists of domain objects.  In this
case, the edit will fail because you will be trying to set parameters on
items that might not exist anymore.  (Or you've pulled in data that the user
doesn't know about)  Therefore the safer technique is to save off the
model.  If you're concerned about putting too much into the session, you can
store the data in a cache, such as ehcache, that will store items to disk if
there are too many things in memory.  (This is the technique that we
used--we called it a model repository and we created a couple different
implementations)  I would love to see something like this out-of-the-box
with struts2, but nothing currently exists.


Thanks, I really appreciate your suggestions. However, I prefer a
stateless approach because (I think) it helps to keep things simple in
this case. Using some kind of cache between page requests is more like
a stateful approach that I would like to avoid here for simplicity
reasons.

Well, having Struts passing parameters in the order defined by the
html form would solve my problem.  :-)

Regards,

Célio.

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



Re: Make Struts set form data onto the action in same order as the form's fields

2007-01-25 Thread Tom Schneider

This is an issue with the typical edit/save scenario.  The problem we are
discussing is that the domain model is needed in some form before the
parameter can be repopulated from the form save.  The technique you are
using is to reread the data from the database before the parameters are
set.  An alternative technique would be to put the domain model into a place
in the session--so on the save, you can retrieve the the model from the
session and then allow the parameters interceptor to populate the new data.
(This is referred to as detached objects in the Hibernate world)  The
advantage of putting the model in the session is that if some else modifies
the data before you reread the data, but after you have displayed the edit
page, you will not have the original model.  This particularly a problem
with a model where you are dealing with lists of domain objects.  In this
case, the edit will fail because you will be trying to set parameters on
items that might not exist anymore.  (Or you've pulled in data that the user
doesn't know about)  Therefore the safer technique is to save off the
model.  If you're concerned about putting too much into the session, you can
store the data in a cache, such as ehcache, that will store items to disk if
there are too many things in memory.  (This is the technique that we
used--we called it a model repository and we created a couple different
implementations)  I would love to see something like this out-of-the-box
with struts2, but nothing currently exists.
Tom


On 1/25/07, Célio Cidral Junior <[EMAIL PROTECTED]> wrote:


2007/1/25, Dave Newton <[EMAIL PROTECTED]>:
> From my point of view it seems like your implementation is broken: if
you need to create a Customer from an ID passed via a form or URL then you
either need to implement Preparable or do the DAO operations in the (in your
case) input or save methods.

The DAO operations already do that. The problem happens when the user
is *altering* an existing customer (creating a new customer works
fine), more specifically when the user is submitting changes from the
form to an existing customer object (alongside with an existing id);
in that case, the id must be set before getCustomer() is called,
otherwise a new customer will be created with zero id. Loading the
form with an existing customer works fine. Submitting changes to it is
where the problem resides. The idea behind getCustomer() is to
abstract the retrieving of the customer object wherever it's called
along the action's code so that I don't have to care about whether
it's an existing customer or not.

Implementing Preparable does not seem to solve the problem because the
parameters are set before the prepare() method is invoked.

Célio.

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




Re: Make Struts set form data onto the action in same order as the form's fields

2007-01-25 Thread Célio Cidral Junior

2007/1/25, Dale Newfield <[EMAIL PROTECTED]>:

Célio Cidral Junior wrote:
> Implementing Preparable does not seem to solve the problem because the
> parameters are set before the prepare() method is invoked.

Which is needed in order to know which object to retrieve from the DB.


I think you have not read the code I included in the first email.
Please, read it carefully and you will understand why Preparable
doesn't solve my problem.


This model usually includes including the parameters interceptor twice:
  Once before prepare and once after.


I can't figure out how that would be useful in my case.

Célio.

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



Re: Make Struts set form data onto the action in same order as the form's fields

2007-01-25 Thread Dale Newfield

Célio Cidral Junior wrote:

Implementing Preparable does not seem to solve the problem because the
parameters are set before the prepare() method is invoked.


Which is needed in order to know which object to retrieve from the DB.
This model usually includes including the parameters interceptor twice: 
 Once before prepare and once after.


-Dale


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



Re: Make Struts set form data onto the action in same order as the form's fields

2007-01-25 Thread Célio Cidral Junior

2007/1/25, Dave Newton <[EMAIL PROTECTED]>:

From my point of view it seems like your implementation is broken: if you need 
to create a Customer from an ID passed via a form or URL then you either need 
to implement Preparable or do the DAO operations in the (in your case) input or 
save methods.


The DAO operations already do that. The problem happens when the user
is *altering* an existing customer (creating a new customer works
fine), more specifically when the user is submitting changes from the
form to an existing customer object (alongside with an existing id);
in that case, the id must be set before getCustomer() is called,
otherwise a new customer will be created with zero id. Loading the
form with an existing customer works fine. Submitting changes to it is
where the problem resides. The idea behind getCustomer() is to
abstract the retrieving of the customer object wherever it's called
along the action's code so that I don't have to care about whether
it's an existing customer or not.

Implementing Preparable does not seem to solve the problem because the
parameters are set before the prepare() method is invoked.

Célio.

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



RE: Make Struts set form data onto the action in same order as the form's fields

2007-01-25 Thread Dave Newton
From: Célio Cidral Junior
>   public Customer getCustomer() {
>   if (customer == null)
>   customer = id != 0 ? dao.get(id) : new Customer();
>   return customer;
>   }
> [...]
> The way I built both the action and the view prevents me from writing
> a lot of extra code (like getters and setters for each of the form's
> field), and that's why I would like to know whether there's a way to
> make Struts follow the fields' ordering when submitting the data into
> the action. And if there's not, may the Struts dev team implement
> that, if possible.

That seems extremely unlikely, but they may have a different take on it. 

>From my point of view it seems like your implementation is broken: if you need 
>to create a Customer from an ID passed via a form or URL then you either need 
>to implement Preparable or do the DAO operations in the (in your case) input 
>or save methods.

IMO that functionality does *not* belong in a getter.

Dave

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



Make Struts set form data onto the action in same order as the form's fields

2007-01-25 Thread Célio Cidral Junior

Struts don't set the form data onto the Action in the same order in
which the fields appear in the form. For instance, suppose you have a
form like this:









And its corresponding Action, which is something like:

public class CustomerAction extends ActionSupport {
private int id = 0;
private Customer customer;
private CustomerDao dao;

public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

public Customer getCustomer() {
if (customer == null)
customer = id != 0 ? dao.get(id) : new Customer();

return customer;
}

public String input() throws Exception {
if (getCustomer() == null)
return ERROR;

return INPUT;
}

public String save() throws Exception {
if (getCustomer() == null)
return ERROR;

dao.save(getCustomer());

return SUCCESS;
}
}

You could expected that Struts, when submitting the form, would first
set the id, then customer.name, then finally custumer.phoneNumber.
However, it does not follow that order; actually, it does set the data
in random order. In this case, the order is important because, if the
user is altering an existing customer, its id must be set before
getCustomer() gets invoked. Otherwise, the action will create a new
customer with zeroed id.

The way I built both the action and the view prevents me from writing
a lot of extra code (like getters and setters for each of the form's
field), and that's why I would like to know whether there's a way to
make Struts follow the fields' ordering when submitting the data into
the action. And if there's not, may the Struts dev team implement
that, if possible.

Regards,

Célio.

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



enctype="multipart/form-data" gives null values for other ActionForm properties

2006-11-23 Thread Morten Andersen
When I'm uploading a form I set the enctype to multipart/form-data in 
the jsp file.


In the action receiving the form I want to use the other properties from 
the form, but these are not set.


Example:

ActionForm has the properties:
- name (String) edited in a actionFormImpl.getName(), where actionFormImpl is the actual ActionForm, 
but that method returns null.


Why is autopopulate not working when enctype is set as multipart/form-data?

Regards

Morten Andersen

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



Re: enctype="multipart/form-data" gives null values for ActionForm properties

2006-11-23 Thread Morten Andersen

Sorry I rephrase the question and post as new topic.



Mitchell James skrev:
With most browsers, you cannot autopopulate a file upload field on a 
form.  The reason for this is security.  If such a thing was allowed, 
malicious web sites could have hidden frames that uploaded sensitive 
files.


For the browsers that do allow it, they will prompt and warn the user 
when submit is called.



--
James Mitchell
678.910.8017




On Nov 23, 2006, at 5:29 AM, Morten Andersen wrote:

I want to upload a file as a part of a form. This requires that the 
enctype of the form is set to: multipart/form-data.


When that is set like that the autopopulate thing doesn't work.

How can I make sure that the properties are autopopulated even though 
I use enctype="multipart/form-data".



Thanks

Morten Andersen
www.blobcom.com
Denmark

-
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: enctype="multipart/form-data" gives null values for ActionForm properties

2006-11-23 Thread Mitchell James
With most browsers, you cannot autopopulate a file upload field on a  
form.  The reason for this is security.  If such a thing was allowed,  
malicious web sites could have hidden frames that uploaded sensitive  
files.


For the browsers that do allow it, they will prompt and warn the user  
when submit is called.



--
James Mitchell
678.910.8017




On Nov 23, 2006, at 5:29 AM, Morten Andersen wrote:

I want to upload a file as a part of a form. This requires that the  
enctype of the form is set to: multipart/form-data.


When that is set like that the autopopulate thing doesn't work.

How can I make sure that the properties are autopopulated even  
though I use enctype="multipart/form-data".



Thanks

Morten Andersen
www.blobcom.com
Denmark

-
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]



enctype="multipart/form-data" gives null values for ActionForm properties

2006-11-23 Thread Morten Andersen
I want to upload a file as a part of a form. This requires that the 
enctype of the form is set to: multipart/form-data.


When that is set like that the autopopulate thing doesn't work.

How can I make sure that the properties are autopopulated even though I 
use enctype="multipart/form-data".



Thanks

Morten Andersen
www.blobcom.com
Denmark

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



Saving form data

2006-08-01 Thread Joel Alejandro Espinosa Carra

Hi all

I think this is a common issue, I want to know how to save the form data 
in persistent storage using serialization. I have been made this in my 
2-tier java apps without struts but  I suppose there is another way to 
do it using struts to achieve that.


Kind regards.

p.s. sorry for my english

--
Ing. Joel Alejandro Espinosa Carra
CINVESTAV CTS - Centro de Tecnología de Semiconductores
Tel. +52 (33) 3770-3700 ext. 1049
http://www.cts-design.com 



--
Este mensaje ha sido analizado por MailScanner
en busca de virus y otros contenidos peligrosos,
y se considera que está limpio.
MailScanner agradece a transtec Computers por su apoyo.


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



Re: multipart/form-data and character encoding

2006-05-30 Thread Martin Gainty
Good Morning Antonisis-

If you are sending data which is of UTF-8 characterset then you need to 
configure the request e.g. request.setCharacterEncoding("UTF-8") e.g.
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletRequest.html#setCharacterEncoding(java.lang.String)

If you are receiving data from a UTF-8 configured server then set the response 
as in response.setCharacterEncoding("UTF-8") e.g.
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletResponse.html#setCharacterEncoding(java.lang.String)

Martin -
*
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.



- Original Message - 
From: "Antonis Lebesis" <[EMAIL PROTECTED]>
To: "Martin Gainty" <[EMAIL PROTECTED]>
Cc: "Struts Users Mailing List" 
Sent: Monday, May 29, 2006 8:14 PM
Subject: Re: multipart/form-data and character encoding


> Martin,
> 
> I' m not sure what you mean. In my Action's execute() method I get a
> request, a response and an ActionForm object. Whatever I do to the
> request or response objects, the values from the html form are already
> in the actionForm (encoded in a false way). The only way to alter the
> Strings in the actionForm is to change the method
> 
> getMyString() {
>  return this.myString;
> }
> to
> getMyString() {
>  return new String(this.myString.getBytes(), "UTF-8");
> },
> 
> which I already tried and miserably failed :)
> 
> Antonis
> 
> On 5/30/06, Martin Gainty <[EMAIL PROTECTED]> wrote:
>> Antonis-
>>
>> Did you set the characterEncoding for the response e.g.
>> res.setCharacterEncoding("UTF-8")
>> ???
>> Martin --
>>
>> This email message and any files transmitted with it contain confidential
>> information intended only for the person(s) to whom this email message is
>> addressed.  If you have received this email message in error, please notify
>> the sender immediately by telephone or email and destroy the original
>> message without making a copy.  Thank you.
>>
>> - Original Message -
>> From: "Antonis Lebesis" <[EMAIL PROTECTED]>
>> To: "Struts Users Mailing List" ; "Martin Gainty"
>> <[EMAIL PROTECTED]>
>> Sent: Monday, May 29, 2006 7:26 PM
>> Subject: Re: multipart/form-data and character encoding
>>
>>
>> > Hello Martin,
>> >  I tried your suggestion but there is a difference in my case: The
>> > enctype in my form's declaration is "multipart/form-data" (I have to
>> > support file upload). If I leave it that way, I get the same results
>> > (no greek characters). If I change it to "multipart/form-data;
>> > charset=iso-8859-7", I get a nice exception :(
>> >
>> > javax.servlet.ServletException: BeanUtils.populate
>> > org.apache.struts.util.RequestUtils.populate(RequestUtils.java:497)
>> > org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:798)
>> > org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:205)
>> > org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
>> > org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
>> > javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
>> > javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>> >
>> > root cause
>> >
>> > java.lang.IllegalArgumentException: argument type mismatch
>> > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> > java.lang.reflect.Method.invoke(Method.java:585)
>> > org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1789)
>> > org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.java:1684)
>> > org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:1713)
>> > org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019)
>> > org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
>> > org.apache.struts.util.RequestUtils.populate(RequestUtils.java:495)
>> > org.apa

Re: multipart/form-data and character encoding

2006-05-29 Thread Antonis Lebesis

Martin,

I' m not sure what you mean. In my Action's execute() method I get a
request, a response and an ActionForm object. Whatever I do to the
request or response objects, the values from the html form are already
in the actionForm (encoded in a false way). The only way to alter the
Strings in the actionForm is to change the method

getMyString() {
 return this.myString;
}
to
getMyString() {
 return new String(this.myString.getBytes(), "UTF-8");
},

which I already tried and miserably failed :)

Antonis

On 5/30/06, Martin Gainty <[EMAIL PROTECTED]> wrote:

Antonis-

Did you set the characterEncoding for the response e.g.
res.setCharacterEncoding("UTF-8")
???
Martin --

This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

- Original Message -
From: "Antonis Lebesis" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" ; "Martin Gainty"
<[EMAIL PROTECTED]>
Sent: Monday, May 29, 2006 7:26 PM
Subject: Re: multipart/form-data and character encoding


> Hello Martin,
>  I tried your suggestion but there is a difference in my case: The
> enctype in my form's declaration is "multipart/form-data" (I have to
> support file upload). If I leave it that way, I get the same results
> (no greek characters). If I change it to "multipart/form-data;
> charset=iso-8859-7", I get a nice exception :(
>
> javax.servlet.ServletException: BeanUtils.populate
> org.apache.struts.util.RequestUtils.populate(RequestUtils.java:497)
> 
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:798)
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:205)
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>
> root cause
>
> java.lang.IllegalArgumentException: argument type mismatch
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> java.lang.reflect.Method.invoke(Method.java:585)
> 
org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1789)
> 
org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.java:1684)
> 
org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:1713)
> org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019)
> org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
> org.apache.struts.util.RequestUtils.populate(RequestUtils.java:495)
> 
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:798)
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:205)
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>
> Any ideas?
>
> Thanks,
> Antonis
>
> On 5/29/06, Martin Gainty <[EMAIL PROTECTED]> wrote:
>> Good Afternoon Antonis-
>>
>> This character encoding issue has been addressed
>> http://issues.apache.org/struts/browse/STR-2117 as follows
>>
>> Set your page to use correct character encoding
>> <%@ page ;contentType="text/html" charset=UTF-8"%>
>>
>> Set form to use correct form encoding
>> 
>>
>> Instruct web container to use selected charset when creating request (in
>> server.xml)
>> 
>>
>> HTH,
>> Martin --
>> - Original Message -
>> From: "Antonis Lebesis" <[EMAIL PROTECTED]>
>> To: 
>> Sent: Monday, May 29, 2006 2:07 PM
>> Subject: multipart/form-data and character encoding
>>
>>
>> Hi,
>>  I 've searched the archives but haven't found any solution to my
>> latest problem. I have with a  input and a 
>> input. The problem is that request.getCharacterEncoding() returns null
>> and the text input is considered to be in iso-8859-1 encoding. In the
>> corresponding ActionForm's reset(), I have added the following line:
>>  request.setCharacterEncoding("ISO

Re: multipart/form-data and character encoding

2006-05-29 Thread Martin Gainty

Antonis-

Did you set the characterEncoding for the response e.g.
res.setCharacterEncoding("UTF-8")
???
Martin --

This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

- Original Message - 
From: "Antonis Lebesis" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" ; "Martin Gainty" 
<[EMAIL PROTECTED]>

Sent: Monday, May 29, 2006 7:26 PM
Subject: Re: multipart/form-data and character encoding



Hello Martin,
 I tried your suggestion but there is a difference in my case: The
enctype in my form's declaration is "multipart/form-data" (I have to
support file upload). If I leave it that way, I get the same results
(no greek characters). If I change it to "multipart/form-data;
charset=iso-8859-7", I get a nice exception :(

javax.servlet.ServletException: BeanUtils.populate
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:497)
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:798)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:205)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

java.lang.IllegalArgumentException: argument type mismatch
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1789)
org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.java:1684)
org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:1713)
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019)
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:495)
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:798)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:205)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

Any ideas?

Thanks,
Antonis

On 5/29/06, Martin Gainty <[EMAIL PROTECTED]> wrote:

Good Afternoon Antonis-

This character encoding issue has been addressed 
http://issues.apache.org/struts/browse/STR-2117 as follows


Set your page to use correct character encoding
<%@ page ;contentType="text/html" charset=UTF-8"%>

Set form to use correct form encoding



Instruct web container to use selected charset when creating request (in 
server.xml)



HTH,
Martin --
- Original Message -
From: "Antonis Lebesis" <[EMAIL PROTECTED]>
To: 
Sent: Monday, May 29, 2006 2:07 PM
Subject: multipart/form-data and character encoding


Hi,
 I 've searched the archives but haven't found any solution to my
latest problem. I have with a  input and a 
input. The problem is that request.getCharacterEncoding() returns null
and the text input is considered to be in iso-8859-1 encoding. In the
corresponding ActionForm's reset(), I have added the following line:
 request.setCharacterEncoding("ISO-8859-7");

In forms that don't have a  input, the character set is
correct. The problem occurs only in this form and from what I 've
found it is caused by the fact that in the form declaration I have
added enctype="multipart/form-data".

Has anyone solved this problem?

Thanks,
Antonis

-
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: multipart/form-data and character encoding

2006-05-29 Thread Miguel Galves

Antonis,

I`m glad to know that your problem is solved. If you find
a more official solution, please let me know. But,  as you, I spent
many hours looking for it, and I didn`t find anything at all.

[]s

miguel

On 5/29/06, Antonis Lebesis <[EMAIL PROTECTED]> wrote:


Miguel,

  If you ever come to Greece, remind me to offer you some ouzo and
mousaka ;) It worked just fine! I' ll keep looking for a more
"official" solution, but until then you' ve saved me...

Thank you very very much,
Antonis

On 5/29/06, Miguel Galves <[EMAIL PROTECTED]> wrote:
> Antonis,
>
> we had the same problem with multi part forms. We tried everithing,
> including enctype in the
> form tag, URIEncoding, and request.setEncoding...in reset() method. All
> theses solutions worked
> fine with all kinds of requests, except for the mulipart, which is
handled
> in a different way.
>
> The only solution that really worked for us was to create a subclass of
> TilesRequestProcessor,
> and override the handleRequest method as follows:
>
> public class ScyllaRequestProcessor extends TilesRequestProcessor {
>
> public void process(HttpServletRequest request, HttpServletResponse
> response) throws IOException,
>
> ServletException {
> try {
> request.setCharacterEncoding("UTF-8");
> } catch (UnsupportedEncodingException e) {
> e.printStackTrace();
> }
>
> super.process(request, response);
> }
>
> To use this processor, just change the controller entry in
struts-config.xml
>
> []s
>
> Miguel
>
>
> On 5/29/06, Martin Gainty <[EMAIL PROTECTED]> wrote:
> >
> > Good Afternoon Antonis-
> >
> > This character encoding issue has been addressed
> > http://issues.apache.org/struts/browse/STR-2117 as follows
> >
> > Set your page to use correct character encoding
> > <%@ page ;contentType="text/html" charset=UTF-8"%>
> >
> > Set form to use correct form encoding
> > 
> >
> > Instruct web container to use selected charset when creating request
(in
> > server.xml)
> > 
> >
> > HTH,
> > Martin --
> > - Original Message -
> > From: "Antonis Lebesis" <[EMAIL PROTECTED]>
> > To: 
> > Sent: Monday, May 29, 2006 2:07 PM
> > Subject: multipart/form-data and character encoding
> >
> >
> > Hi,
> > I 've searched the archives but haven't found any solution to my
> > latest problem. I have with a  input and a 
> > input. The problem is that request.getCharacterEncoding() returns null
> > and the text input is considered to be in iso-8859-1 encoding. In the
> > corresponding ActionForm's reset(), I have added the following line:
> > request.setCharacterEncoding("ISO-8859-7");
> >
> > In forms that don't have a  input, the character set is
> > correct. The problem occurs only in this form and from what I 've
> > found it is caused by the fact that in the form declaration I have
> > added enctype="multipart/form-data".
> >
> > Has anyone solved this problem?
> >
> > Thanks,
> > Antonis
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> Miguel Galves - Engenheiro de Computação
> Já leu meus blogs hoje?
> Para geeks http://log4dev.blogspot.com
> Pra pessoas normais
> http://miguelgalves.blogspot.com
>
> "Não sabendo que era impossível, ele foi lá e fez..."
>
>

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





--
Miguel Galves - Engenheiro de Computação
Já leu meus blogs hoje?
Para geeks http://log4dev.blogspot.com
Pra pessoas normais
http://miguelgalves.blogspot.com

"Não sabendo que era impossível, ele foi lá e fez..."


Re: multipart/form-data and character encoding

2006-05-29 Thread Antonis Lebesis

Miguel,

 If you ever come to Greece, remind me to offer you some ouzo and
mousaka ;) It worked just fine! I' ll keep looking for a more
"official" solution, but until then you' ve saved me...

Thank you very very much,
Antonis

On 5/29/06, Miguel Galves <[EMAIL PROTECTED]> wrote:

Antonis,

we had the same problem with multi part forms. We tried everithing,
including enctype in the
form tag, URIEncoding, and request.setEncoding...in reset() method. All
theses solutions worked
fine with all kinds of requests, except for the mulipart, which is handled
in a different way.

The only solution that really worked for us was to create a subclass of
TilesRequestProcessor,
and override the handleRequest method as follows:

public class ScyllaRequestProcessor extends TilesRequestProcessor {

public void process(HttpServletRequest request, HttpServletResponse
response) throws IOException,

ServletException {
try {
request.setCharacterEncoding("UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}

super.process(request, response);
}

To use this processor, just change the controller entry in struts-config.xml

[]s

Miguel


On 5/29/06, Martin Gainty <[EMAIL PROTECTED]> wrote:
>
> Good Afternoon Antonis-
>
> This character encoding issue has been addressed
> http://issues.apache.org/struts/browse/STR-2117 as follows
>
> Set your page to use correct character encoding
> <%@ page ;contentType="text/html" charset=UTF-8"%>
>
> Set form to use correct form encoding
> 
>
> Instruct web container to use selected charset when creating request (in
> server.xml)
> 
>
> HTH,
> Martin --
> - Original Message -----
> From: "Antonis Lebesis" <[EMAIL PROTECTED]>
> To: 
> Sent: Monday, May 29, 2006 2:07 PM
> Subject: multipart/form-data and character encoding
>
>
> Hi,
> I 've searched the archives but haven't found any solution to my
> latest problem. I have with a  input and a 
> input. The problem is that request.getCharacterEncoding() returns null
> and the text input is considered to be in iso-8859-1 encoding. In the
> corresponding ActionForm's reset(), I have added the following line:
> request.setCharacterEncoding("ISO-8859-7");
>
> In forms that don't have a  input, the character set is
> correct. The problem occurs only in this form and from what I 've
> found it is caused by the fact that in the form declaration I have
> added enctype="multipart/form-data".
>
> Has anyone solved this problem?
>
> Thanks,
> Antonis
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


--
Miguel Galves - Engenheiro de Computação
Já leu meus blogs hoje?
Para geeks http://log4dev.blogspot.com
Pra pessoas normais
http://miguelgalves.blogspot.com

"Não sabendo que era impossível, ele foi lá e fez..."




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



Re: multipart/form-data and character encoding

2006-05-29 Thread Antonis Lebesis

Hello Martin,
 I tried your suggestion but there is a difference in my case: The
enctype in my form's declaration is "multipart/form-data" (I have to
support file upload). If I leave it that way, I get the same results
(no greek characters). If I change it to "multipart/form-data;
charset=iso-8859-7", I get a nice exception :(

javax.servlet.ServletException: BeanUtils.populate
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:497)

org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:798)

org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:205)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

java.lang.IllegalArgumentException: argument type mismatch
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)

org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1789)

org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.java:1684)

org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:1713)
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019)
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:495)

org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:798)

org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:205)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

Any ideas?

Thanks,
Antonis

On 5/29/06, Martin Gainty <[EMAIL PROTECTED]> wrote:

Good Afternoon Antonis-

This character encoding issue has been addressed 
http://issues.apache.org/struts/browse/STR-2117 as follows

Set your page to use correct character encoding
<%@ page ;contentType="text/html" charset=UTF-8"%>

Set form to use correct form encoding


Instruct web container to use selected charset when creating request (in 
server.xml)


HTH,
Martin --
- Original Message -
From: "Antonis Lebesis" <[EMAIL PROTECTED]>
To: 
Sent: Monday, May 29, 2006 2:07 PM
Subject: multipart/form-data and character encoding


Hi,
 I 've searched the archives but haven't found any solution to my
latest problem. I have with a  input and a 
input. The problem is that request.getCharacterEncoding() returns null
and the text input is considered to be in iso-8859-1 encoding. In the
corresponding ActionForm's reset(), I have added the following line:
 request.setCharacterEncoding("ISO-8859-7");

In forms that don't have a  input, the character set is
correct. The problem occurs only in this form and from what I 've
found it is caused by the fact that in the form declaration I have
added enctype="multipart/form-data".

Has anyone solved this problem?

Thanks,
Antonis

-
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: multipart/form-data and character encoding

2006-05-29 Thread Miguel Galves

Antonis,

we had the same problem with multi part forms. We tried everithing,
including enctype in the
form tag, URIEncoding, and request.setEncoding...in reset() method. All
theses solutions worked
fine with all kinds of requests, except for the mulipart, which is handled
in a different way.

The only solution that really worked for us was to create a subclass of
TilesRequestProcessor,
and override the handleRequest method as follows:

public class ScyllaRequestProcessor extends TilesRequestProcessor {

   public void process(HttpServletRequest request, HttpServletResponse
response) throws IOException,

ServletException {
   try {
   request.setCharacterEncoding("UTF-8");
   } catch (UnsupportedEncodingException e) {
   e.printStackTrace();
   }

   super.process(request, response);
   }

To use this processor, just change the controller entry in struts-config.xml

[]s

Miguel


On 5/29/06, Martin Gainty <[EMAIL PROTECTED]> wrote:


Good Afternoon Antonis-

This character encoding issue has been addressed
http://issues.apache.org/struts/browse/STR-2117 as follows

Set your page to use correct character encoding
<%@ page ;contentType="text/html" charset=UTF-8"%>

Set form to use correct form encoding


Instruct web container to use selected charset when creating request (in
server.xml)


HTH,
Martin --
- Original Message -
From: "Antonis Lebesis" <[EMAIL PROTECTED]>
To: 
Sent: Monday, May 29, 2006 2:07 PM
Subject: multipart/form-data and character encoding


Hi,
I 've searched the archives but haven't found any solution to my
latest problem. I have with a  input and a 
input. The problem is that request.getCharacterEncoding() returns null
and the text input is considered to be in iso-8859-1 encoding. In the
corresponding ActionForm's reset(), I have added the following line:
request.setCharacterEncoding("ISO-8859-7");

In forms that don't have a  input, the character set is
correct. The problem occurs only in this form and from what I 've
found it is caused by the fact that in the form declaration I have
added enctype="multipart/form-data".

Has anyone solved this problem?

Thanks,
Antonis

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





--
Miguel Galves - Engenheiro de Computação
Já leu meus blogs hoje?
Para geeks http://log4dev.blogspot.com
Pra pessoas normais
http://miguelgalves.blogspot.com

"Não sabendo que era impossível, ele foi lá e fez..."


Re: multipart/form-data and character encoding

2006-05-29 Thread Martin Gainty
Good Afternoon Antonis-

This character encoding issue has been addressed 
http://issues.apache.org/struts/browse/STR-2117 as follows

Set your page to use correct character encoding 
<%@ page ;contentType="text/html" charset=UTF-8"%>

Set form to use correct form encoding 


Instruct web container to use selected charset when creating request (in 
server.xml)


HTH,
Martin --
- Original Message - 
From: "Antonis Lebesis" <[EMAIL PROTECTED]>
To: 
Sent: Monday, May 29, 2006 2:07 PM
Subject: multipart/form-data and character encoding


Hi,
 I 've searched the archives but haven't found any solution to my
latest problem. I have with a  input and a 
input. The problem is that request.getCharacterEncoding() returns null
and the text input is considered to be in iso-8859-1 encoding. In the
corresponding ActionForm's reset(), I have added the following line:
 request.setCharacterEncoding("ISO-8859-7");

In forms that don't have a  input, the character set is
correct. The problem occurs only in this form and from what I 've
found it is caused by the fact that in the form declaration I have
added enctype="multipart/form-data".

Has anyone solved this problem?

Thanks,
Antonis

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



multipart/form-data and character encoding

2006-05-29 Thread Antonis Lebesis

Hi,
I 've searched the archives but haven't found any solution to my
latest problem. I have with a  input and a 
input. The problem is that request.getCharacterEncoding() returns null
and the text input is considered to be in iso-8859-1 encoding. In the
corresponding ActionForm's reset(), I have added the following line:
request.setCharacterEncoding("ISO-8859-7");

In forms that don't have a  input, the character set is
correct. The problem occurs only in this form and from what I 've
found it is caused by the fact that in the form declaration I have
added enctype="multipart/form-data".

Has anyone solved this problem?

Thanks,
Antonis

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



RE: How to retain form data when disabling input in html:text

2006-02-21 Thread Wang, Hansen
That is display problem. You can use css to make the field gray or red
etc. 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 21, 2006 3:57 PM
To: Struts Users Mailing List
Cc: [EMAIL PROTECTED]; Struts Users Mailing List
Subject: Re: How to retain form data when disabling input in html:text

Thanks Craig:
I worked for what I wanted to achieve.
Only with read-only property setting, it does not grey out input
text field.
I have to find out what to set so that it changes appearance
when read-only property is set.
Thanks.
Digant




"Craig McClanahan" <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED]
02/21/2006 05:14 PM
Please respond to "Struts Users Mailing List"

 
To: "Struts Users Mailing List" 
cc: 
    Subject:Re: How to retain form data when disabling input
in html:text


On 2/21/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
wrote:
>
> I have  I

> populate html:text with data from DB.
> I want to disable input for this property, but when I get form data 
> back in Action form bean does not have data for
this
> property "bucketName"
>
> How do i retain data after disabling input in html:text.


Short answer ... you cannot.  By defintion in HTML, disabled fields are
not sent to the server, so the server has no opportunity to keep them
for you.
On the other hand, if you make the field read only instead of disabled,
the value *will* be sent to the server ... but the user will not be able
to edit it.

Thanks.


Craig


This communication is for informational purposes only. It is not
intended
> as an offer or solicitation for the purchase or sale of any financial 
> instrument or as an official confirmation of any transaction. All 
> market prices, data and other information are not warranted as to 
> completeness or accuracy and are subject to change without notice. Any

> comments or statements made herein do not necessarily reflect those of

> JPMorgan Chase & Co., its
subsidiaries
> and affiliates
>
>
>




This communication is for informational purposes only. It is not
intended as an offer or solicitation for the purchase or sale of any
financial instrument or as an official confirmation of any transaction.
All market prices, data and other information are not warranted as to
completeness or accuracy and are subject to change without notice. Any
comments or statements made herein do not necessarily reflect those of
JPMorgan Chase & Co., its subsidiaries and affiliates.


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



Re: How to retain form data when disabling input in html:text

2006-02-21 Thread Michael Jouravlev
On 2/21/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I have 
> I populate html:text with data from DB.
> I want to disable input for this property, but
> when I get form data back in Action form bean does not have data for this
> property "bucketName"
>
> How do i retain data after disabling input in html:text.

Use session-scoped form or reload this value each time from the database.

Michael.

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



Re: How to retain form data when disabling input in html:text

2006-02-21 Thread digant . k . joshi
Thanks Craig:
I worked for what I wanted to achieve.
Only with read-only property setting, it does not grey out input 
text field.
I have to find out what to set so that it changes appearance when 
read-only property is set.
Thanks.
Digant




"Craig McClanahan" <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
02/21/2006 05:14 PM
Please respond to "Struts Users Mailing List"

 
To: "Struts Users Mailing List" 
cc: 
    Subject:Re: How to retain form data when disabling input in 
html:text


On 2/21/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> 
wrote:
>
> I have 
> I populate html:text with data from DB.
> I want to disable input for this property, but
> when I get form data back in Action form bean does not have data for 
this
> property "bucketName"
>
> How do i retain data after disabling input in html:text.


Short answer ... you cannot.  By defintion in HTML, disabled fields are 
not
sent to the server, so the server has no opportunity to keep them for you.
On the other hand, if you make the field read only instead of disabled, 
the
value *will* be sent to the server ... but the user will not be able to 
edit
it.

Thanks.


Craig


This communication is for informational purposes only. It is not intended
> as an offer or solicitation for the purchase or sale of any financial
> instrument or as an official confirmation of any transaction. All market
> prices,
> data and other information are not warranted as to completeness or
> accuracy and
> are subject to change without notice. Any comments or statements made
> herein
> do not necessarily reflect those of JPMorgan Chase & Co., its 
subsidiaries
> and affiliates
>
>
>




This communication is for informational purposes only. It is not intended
as an offer or solicitation for the purchase or sale of any financial
instrument or as an official confirmation of any transaction. All market prices,
data and other information are not warranted as to completeness or accuracy and
are subject to change without notice. Any comments or statements made herein 
do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries 
and affiliates.

  1   2   >