You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by CB Thomas <th...@hotmail.com> on 2002/08/31 17:02:21 UTC
Using the template tag library with parameters like jsp:param
With jsp:include, I can pass parameter values to the included page by using
jsp:param.
Can I get this functionality using the Struts template tag library? If so,
can I use request.getParameter to retrieve values in the included page?
_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Using the template tag library with parameters like jsp:param
Posted by jw <jw...@cox.net>.
Hi All
Sorry for the bother - but, who knew - i.e., The issue was apparently
related to the struts "version" I was using (i.e.,
"jakarta-struts-1.0.2")...
Apparently, the examples will work only with jakarta-struts-1.1-b2.....At
least in my current environment (winXP/j2sdk1.4.0_01/jakarta-tomcat-4.0.4)
Thanks!
jw
----- Original Message -----
From: "jw" <jw...@cox.net>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Saturday, August 31, 2002 1:28 PM
Subject: Re: Using the template tag library with parameters like jsp:param
Hi All!
I've seen a number of posts looking for help/info on the this type of error
message (i.e., "javax.servlet.ServletException: Exception creating bean of
class ???.???.xxxForm: java.lang.ClassNotFoundException: ???.???.xxxForm")
that occurs when they attempt to test their "struts" application.
I have not seen a solution/ explanation, thus far, as to why this occurs.
Any help or insight as to why this happens, would be much appreciated.
Once again, I'm cutting and pasting a code example - that theoretically
should work "out-of-the-box", and once again its not working (whaddya gonna
do?)..
Here is the information/example code that I'm trying to get working when
this error occurs... (NOTE: I'm using jakarta-tomcat-4.0.4,
j2sdk1.4.0_01, jakarta-struts-1.0.2)
*** SubmitForm.java***
package hansen.playground;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.*;
public final class SubmitForm extends ActionForm {
/* Last Name */
private String lastName = "Hansen"; // default value
public String getLastName() {
return (this.lastName);
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
/* Address */
private String address = null;
public String getAddress() {
return (this.address);
}
public void setAddress(String address) {
this.address = address;
}
/* Sex */
private String sex = null;
public String getSex() {
return (this.sex);
}
public void setSex(String sex) {
this.sex = sex;
}
/* Married status */
private String married = null;
public String getMarried() {
return (this.married);
}
public void setMarried(String married) {
this.married = married;
}
/* Age */
private String age = null;
public String getAge() {
return (this.age);
}
public void setAge(String age) {
this.age = age;
}
}
*** SubmitAction.java ***
package hansen.playground;
import javax.servlet.http.*;
import org.apache.struts.action.*;
public final class SubmitAction extends Action {
public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {
SubmitForm f = (SubmitForm) form; // get the form bean
// and take the last name value
String lastName = f.getLastName();
// Translate the name to upper case
//and save it in the request object
request.setAttribute("lastName", lastName.toUpperCase());
// Forward control to the specified success target
return (mapping.findForward("success"));
}
}
*** submit.jsp***
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<html>
<head><title>Submit example</title></head>
<body>
<h3>Example Submit Page</h3>
<html:errors/>
<html:form action="submit.do">
Last Name: <html:text property="lastName"/><br>
Address: <html:textarea property="address"/><br>
Sex: <html:radio property="sex" value="M"/>Male
<html:radio property="sex" value="F"/>Female<br>
Married: <html:checkbox property="married"/><br>
Age: <html:select property="age">
<html:option value="a">0-19</html:option>
<html:option value="b">20-49</html:option>
<html:option value="c">50-</html:option>
</html:select><br>
<html:submit/>
</html:form>
</body>
</html>
*** struts-config.xml ***
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts
Configuration 1.0//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">
<struts-config>
<!-- ========== Form Bean Definitions
=================================== -->
<form-beans>
<form-bean name="submitForm" type="hansen.playground.SubmitForm">
</form-bean>
</form-beans>
<!-- ========== Global Forward Definitions
============================== -->
<global-forwards>
</global-forwards>
<!-- ========== Action Mapping Definitions
============================== -->
<action-mappings>
<action path="/submit"
type="hansen.playground.SubmitAction"
name="submitForm"
input="/submit.jsp"
scope="request">
<forward name="success" path="/submit.jsp"/>
<forward name="failure" path="/submit.jsp"/>
</action>
</action-mappings>
</struts-config>
*** ***
jw
*** error that I receive ***
javax.servlet.ServletException: Exception creating bean of class
hansen.playground.SubmitForm: java.lang.ClassNotFoundException:
hansen.playground.SubmitForm
at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:471)
at org.apache.jsp.submit$jsp._jspService(submit$jsp.java:485)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:201)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:243)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:190)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
46)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:170)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170
)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
1027)
at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125
)
at java.lang.Thread.run(Thread.java:536)
root cause
javax.servlet.jsp.JspException: Exception creating bean of class
hansen.playground.SubmitForm: java.lang.ClassNotFoundException:
hansen.playground.SubmitForm
at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:568)
at org.apache.jsp.submit$jsp._jspService(submit$jsp.java:101)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:201)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:243)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:190)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
46)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:170)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170
)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
1027)
at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125
)
at java.lang.Thread.run(Thread.java:536)
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Using the template tag library with parameters like jsp:param
Posted by jw <jw...@cox.net>.
Hi All!
I've seen a number of posts looking for help/info on the this type of error message (i.e., "javax.servlet.ServletException: Exception creating bean of class ???.???.xxxForm: java.lang.ClassNotFoundException: ???.???.xxxForm") that occurs when they attempt to test their "struts" application.
I have not seen a solution/ explanation, thus far, as to why this occurs.
Any help or insight as to why this happens, would be much appreciated. Once again, I'm cutting and pasting a code example - that theoretically should work "out-of-the-box", and once again its not working (whaddya gonna do?)..
Here is the information/example code that I'm trying to get working when this error occurs... (NOTE: I'm using jakarta-tomcat-4.0.4, j2sdk1.4.0_01, jakarta-struts-1.0.2)
*** SubmitForm.java***
package hansen.playground;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.*;
public final class SubmitForm extends ActionForm {
/* Last Name */
private String lastName = "Hansen"; // default value
public String getLastName() {
return (this.lastName);
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
/* Address */
private String address = null;
public String getAddress() {
return (this.address);
}
public void setAddress(String address) {
this.address = address;
}
/* Sex */
private String sex = null;
public String getSex() {
return (this.sex);
}
public void setSex(String sex) {
this.sex = sex;
}
/* Married status */
private String married = null;
public String getMarried() {
return (this.married);
}
public void setMarried(String married) {
this.married = married;
}
/* Age */
private String age = null;
public String getAge() {
return (this.age);
}
public void setAge(String age) {
this.age = age;
}
}
*** SubmitAction.java ***
package hansen.playground;
import javax.servlet.http.*;
import org.apache.struts.action.*;
public final class SubmitAction extends Action {
public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {
SubmitForm f = (SubmitForm) form; // get the form bean
// and take the last name value
String lastName = f.getLastName();
// Translate the name to upper case
//and save it in the request object
request.setAttribute("lastName", lastName.toUpperCase());
// Forward control to the specified success target
return (mapping.findForward("success"));
}
}
*** submit.jsp***
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<html>
<head><title>Submit example</title></head>
<body>
<h3>Example Submit Page</h3>
<html:errors/>
<html:form action="submit.do">
Last Name: <html:text property="lastName"/><br>
Address: <html:textarea property="address"/><br>
Sex: <html:radio property="sex" value="M"/>Male
<html:radio property="sex" value="F"/>Female<br>
Married: <html:checkbox property="married"/><br>
Age: <html:select property="age">
<html:option value="a">0-19</html:option>
<html:option value="b">20-49</html:option>
<html:option value="c">50-</html:option>
</html:select><br>
<html:submit/>
</html:form>
</body>
</html>
*** struts-config.xml ***
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">
<struts-config>
<!-- ========== Form Bean Definitions =================================== -->
<form-beans>
<form-bean name="submitForm" type="hansen.playground.SubmitForm">
</form-bean>
</form-beans>
<!-- ========== Global Forward Definitions ============================== -->
<global-forwards>
</global-forwards>
<!-- ========== Action Mapping Definitions ============================== -->
<action-mappings>
<action path="/submit"
type="hansen.playground.SubmitAction"
name="submitForm"
input="/submit.jsp"
scope="request">
<forward name="success" path="/submit.jsp"/>
<forward name="failure" path="/submit.jsp"/>
</action>
</action-mappings>
</struts-config>
*** ***
jw
*** error that I receive ***
javax.servlet.ServletException: Exception creating bean of class hansen.playground.SubmitForm: java.lang.ClassNotFoundException: hansen.playground.SubmitForm
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:471)
at org.apache.jsp.submit$jsp._jspService(submit$jsp.java:485)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
at java.lang.Thread.run(Thread.java:536)
root cause
javax.servlet.jsp.JspException: Exception creating bean of class hansen.playground.SubmitForm: java.lang.ClassNotFoundException: hansen.playground.SubmitForm
at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:568)
at org.apache.jsp.submit$jsp._jspService(submit$jsp.java:101)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
at java.lang.Thread.run(Thread.java:536)
Re: Using the template tag library with parameters like jsp:param
Posted by Eddie Bush <ek...@swbell.net>.
There is also Tiles for this sort of thing.
David Geary wrote:
> CB Thomas wrote:
>
>> With jsp:include, I can pass parameter values to the included page by
>> using jsp:param.
>>
>> Can I get this functionality using the Struts template tag library?
>
> Yes. Use the direct attribute, like this:
Tiles is a more feature-rich version of the template mechanism in
Struts. It supports this as well.
> <template:put name='title' content='Templates' direct='true'/>
>
> Then in your template, you can access that value; for example, like this:
>
> <html><head><title><template:get name='title'/></title></head>...</html>
>
> Normally, the <template:get> tag will include content associated with
> the named parameter, but if you
> specify direct='true' with <template:put>, the <template:get> tag will
> just retrieve the value.
>
> See
> http://www.javaworld.com/javaworld/jw-09-2000/jw-0915-jspweb_p.html
> for more information about templates and the direct attribute.
>
> btw, if at all possible, I suggest that you use Tiles instead of
> templates. The former, which is an extension of the latter, has more
> functionality.
>
>> If so, can I use request.getParameter to retrieve values in the
>> included page?
>
> No, but you can use <template:get> as illustrated above.
>
> david
Regards,
Eddie
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Using the template tag library with parameters like jsp:param
Posted by David Geary <sa...@earthlink.net>.
CB Thomas wrote:
> With jsp:include, I can pass parameter values to the included page by
> using jsp:param.
>
> Can I get this functionality using the Struts template tag library?
Yes. Use the direct attribute, like this:
<template:put name='title' content='Templates' direct='true'/>
Then in your template, you can access that value; for example, like this:
<html><head><title><template:get name='title'/></title></head>...</html>
Normally, the <template:get> tag will include content associated with
the named parameter, but if you
specify direct='true' with <template:put>, the <template:get> tag will
just retrieve the value.
See http://www.javaworld.com/javaworld/jw-09-2000/jw-0915-jspweb_p.html
for more information about templates and the direct attribute.
btw, if at all possible, I suggest that you use Tiles instead of
templates. The former, which is an extension of the latter, has more
functionality.
> If so, can I use request.getParameter to retrieve values in the
> included page?
No, but you can use <template:get> as illustrated above.
david
>
>
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>