tmonteit
asked on
How to Display Struts Data with Tags
I'm not sure if I'm propertly using struts. There's data I want to display on my JSP.
I'm getting confused by all these tag libs: nested, c:out, bean:write
Seems I'm inconsistently using them all over the place, but none really quite work right.
What's the easiest most maintainable, proper way to display this data? Note: my JSP is not dialog form.
1. From Servlet
ABCForm myForm = new ABCForm
form.setData("my data string");
2. My STRUTS SETUP
<form-bean name="abcForm"
type="com.myPath.ABCForm"/ >
< ... >
<action path="/trainMe"
type="com.myPath.ABCAction "
name="abcForm"
scope="session"
validate="false">
<forward name="success" path="/jsp/success.jsp"/>
</action>
3. How do I display propertly the form tags on my JSP? using JSTL...
I'm getting confused by all these tag libs: nested, c:out, bean:write
Seems I'm inconsistently using them all over the place, but none really quite work right.
What's the easiest most maintainable, proper way to display this data? Note: my JSP is not dialog form.
1. From Servlet
ABCForm myForm = new ABCForm
form.setData("my data string");
2. My STRUTS SETUP
<form-bean name="abcForm"
type="com.myPath.ABCForm"/
< ... >
<action path="/trainMe"
type="com.myPath.ABCAction
name="abcForm"
scope="session"
validate="false">
<forward name="success" path="/jsp/success.jsp"/>
</action>
3. How do I display propertly the form tags on my JSP? using JSTL...
I agree with boonleng completely.
The struts team recommend the usage of JSTL over the logic library anyway so it's better to replace as much as you can with JSTL.
The struts team recommend the usage of JSTL over the logic library anyway so it's better to replace as much as you can with JSTL.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Nowaday, I don't even use <c:out> to display data unless I want the application to be compatible with J2EE 1.3, I directly use EL since Im using JSP 2.0.
To display propertly of the form using JSTL, just form bean name follow by the property name.
Example:
<c:out value="${abcForm.data}"/>