Thursday, December 24, 2009

Re: [Java] Guidance on Struts 1.3

 

Dear....
 
the Text Property must be exist in ActionForm as you write
Name: <html:text property="name" />
the property name exist in Father ActionForm becuse the struts framework make
corresponding between the property value in textfiled and the attribute in ActionForm
 
 
package sample;

import java.util.*;
import org.apache.actions. *;

public class Father extends ActionForm{

private String name;
private String childName;
private String childAge;

//....Getters and setters..../ /
}
**********************************************************
<html:form action="fatherActio n">
Name: <html:text property="name" /><br/>
<b>Child details</b>< br/>
Only child name: <html:text
property="childName"/>< !--?????? ??--><br/ >
Only child age: <html:text
property="childAge"/><! ----????? ???????-- ->
</html:form
 
********************************************************************************************
*********************************************************************************************
If you have many child you do that in class Father

 
package sample;

import java.util.*;
import org.apache.actions. *;

public class Father extends ActionForm{

private String name;
private ArrayList<Child> childs; 

//....Getters and setters..../ /
}

Take a values from textarea checklist and so on..................
 
Best Regards

Ahmed Mabrouk

 

From: Thiago Santana <thiagoecatia@gmail.com>
Subject: [Java] Guidance on Struts 1.3
To: Java_Official@yahoogroups.com, "Java EE (J2EE) Programming with Passion!" <java-ee-j2ee-programming-with-passion@googlegroups.com>
Date: Tuesday, December 22, 2009, 9:52 AM

 

Hello,

My previous use of Struts was on a very very simple application and I was
able to do well with it. But now I am have a more complex model which I am
not being able to get around with as I have to build a html form whose
property maps to the attribute of an attribute of the ActionForm. My doubt
relies on how to access this "sub-attribute" on teh html form?

In case this is not to clear, I have the following, very unreal scenario:

package sample;

import java.util.*;
import org.apache.actions. *;

public class Father extends ActionForm{

private String name;
private Child onlyChild;

//....Getters and setters..../ /
}

------------ --------- --------- --------- --------- ---------

package sample;

import java.util.*;
import org.apache.actions. *;

public class Child extends ActionForm{

private String name;
private int age;

//...Getters and setters...//
}

------------ --------- --------- --------- --------- --------- -

page.jsp

(...)

<html:form action="fatherActio n">
Name: <html:text property="name" /><br/>
<b>Child details</b>< br/>
Only child name: <html:text
property="onlyChild .name"/>< !--?????? ??--><br/ >
Only child age: <html:text
property="onlyChild .age"/><! ----????? ???????-- ->
</html:form>

(...)

------------ --------- --------- --------- --------- --------- -

When I try it like the example above I get error as it the
onlyChild.whatever does not exist, does no map to a known attribute it is
null.... Please let me know how to achieve that... Your help is much
appreciated. ..

Merry Xmas in advance!!!

--
Thank you,
TS
+55 21 7524-9415

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]

__._,_.___
Visit http://aiaiai.com or http://jgame.org for more groups to join.
Java Official Group is created for the following topics: Java 2 Enterprise Edition - J2EE, Java 2 Standard Edition - J2SE, Java 2 Micro Edition - J2ME, XML, XSL, XSD, XPATH, Web Services, Jini, JXTA for all type of Java Geeks.
Whoever posts spam / ads / job related message will be BANNED IMMEDIATELY
.

__,_._,___

No comments:

Post a Comment