Sure. Here it's the code:

ERROR [ParametersInterceptor] ParametersInterceptor - [setParameters]:
Unexpected Exception catched: Error setting expression 'age' with value
'[Ljava.lang.String;@73327332' 
ERROR [ParametersInterceptor] ParametersInterceptor - [setParameters]:
Unexpected Exception catched: Error setting expression 'firstName' with
value '[Ljava.lang.String;@72747274' 
ERROR [ParametersInterceptor] ParametersInterceptor - [setParameters]:
Unexpected Exception catched: Error setting expression 'lastName' with value
'[Ljava.lang.String;@72d472d4' 

Here they are the 2 class e o ficheiro struts-form.xml: 

PersonPOJO. java : 
package form.model; 

import com.opensymphony.xwork2.ActionSupport; 

public class PersonPOJO extends ActionSupport { 

String firstName; 
String lastName; 
String age; 
String message; 
int ageDays; 

// GETTERS and SETTERS 
public String getAge() { 
return age; 
} 

public void setAge(String age) { 
this.age = age; 
} 

public int getAgeDays() { 
return ageDays; 
} 

public void setAgeDays(int ageDays) { 
this.ageDays = ageDays; 
} 

public String getFirstName() { 
return firstName; 
} 

public void setFirstName(String firstName) { 
this.firstName = firstName; 
} 

public String getLastName() { 
return lastName; 
} 

public void setLastName(String lastName) { 
this.lastName = lastName; 
} 

public String getMessage() { 
return message; 
} 

public void setMessage(String message) { 
this.message = message; 
} 

PersonAction.java 

package form.action; 

import com.opensymphony.xwork2.ActionSupport; 


import form.model.*; 


public class PersonAction extends ActionSupport{ 

private PersonPOJO personPOJO; 


public String execute(){ 

this.personPOJO = new PersonPOJO(); 

if( personPOJO.getAge() != null && personPOJO.getFirstName() != null &&
personPOJO.getLastName()!=null){ 
personPOJO.setAgeDays(Integer.parseInt(personPOJO.getAge())*365); 
System.out.print("PASSOU!!!!!! --------------------------------"); 
personPOJO.setMessage("Sucesso! Esta mensagem foi gerada na Action"); 
return SUCCESS; 
} 
else{ 
personPOJO.setMessage("Erro! Esta mensagem foi gerada na Action"); 
return ERROR; 
} 
} 
} 

struts-form.xml :
<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE struts PUBLIC 
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" 
"http://struts. apache .org/dtds/struts-2.0.dtd"> 

<struts> 
<package name="batatas2" namespace="/pages" extends="struts-default"> 
<action name="PersonAction_GO" class="form.action.PersonAction"> 
<result name="error" type="dispatcher">/pages/erro.jsp</result> 
<result name="success" type="dispatcher">/pages/sucesso.jsp</result> 
</action> 
</package> 
</struts> 

PersonForm.jsp 
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="UTF-8"%> 
<%@ taglib prefix="s" uri="/struts-tags"%> 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd";> 

<html> 
<head> 

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 
<title>Dados Pessoais</title> 
</head> 

<body> 
<div align="center"> 
<s:form name="form" action="PersonAction_GO"> 
<s:textfield id="firstName" label="First Name" name="firstName"/> 
<s:textfield id="lastName" label="Last Name" name="lastName"/> 
<s:textfield id="age" label="Age" name="age"/> 
<s:submit value="OK"/> 
</s:form> 
</div> 
</body> 
</html> 

Please give me an ideia.
Thx


Jeff Amiel-2 wrote:
> 
> On 6/14/07, l1nk <[EMAIL PROTECTED]> wrote:
>>
>> Hi.
>>
>> I have done a simple application to learn struts2. The user only insert
>> is
>> name and hit "OK" button. The result is the error.jsp or success.jsp with
>> a
>> message that was set on the class.
>>
>> This class have the execute() method and all gets and sets need to
>> capture
>> the values introduce by the user.
>>
>> Now i want to create a class POJO and other with the execute().
>> My problem is that now this dont work because all the values introduce by
>> the user are lost (null). How can i solve this?
> 
> Does your action extend ActionSupport or is it really a POJO?
> Can you post the code for your action class and jsp for review?
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

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


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

Reply via email to