You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Kris Schneider <kr...@dotech.com> on 2003/12/02 03:55:14 UTC

Re: JSTL and DynaValidatorForm

I'm sorry, I sort of lost track of this thread. Do you ever get this 
working?

Alexander Kirsch wrote:

> Hallo all!
> 
> Kris Schneider wrote:
> 
>> Are you using a JSP 2.0 container (like Tomcat 5)? If not, you can't 
>> use JSTL
>> 1.1, you have to use JSTL 1.0. For a quick sanity check, what do you 
>> get with
>> the following:
> 
> 
> I'am using the JSP 2.0 Container Tomcat 5.0.14
> 
>>
>> <h1>JSTL: <c:out value="${lvform.map.method}"/></h1>
>> <h1>Struts: <bean:write name="lvform" property="method"/></h1>
> 
> 
> The Struts-Tags work, but not the JSTL-Tags!
> 
>>
>> If you really are using a JSP 2.0 container, you can also try:
>>
>> <h1>JSP: ${lvform.map.method}</h1>
>>
>> Also make sure you're using a Servlet 2.4 deployment descriptor:
>>
>> <web-app xmlns="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/web-app_2_4.xsd"
>>          version="2.4">
>>   ...
>> </web-app>
> 
> 
> Since I change the deployment discriptor, there is a exception in all 
> JSTL Tags.
> 
> javax.servlet.jsp.el.ELException: Unable to find a value for "map" in 
> object of class "org.apache.struts.validator.DynaValidatorForm" using 
> operator "."
> org.apache.commons.el.Logger.logError(Logger.java:481)
> org.apache.commons.el.Logger.logError(Logger.java:498)
> org.apache.commons.el.Logger.logError(Logger.java:611)
> org.apache.commons.el.ArraySuffix.evaluate(ArraySuffix.java:340)
> org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
> org.apache.commons.el.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:263) 
> org.apache.commons.el.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:190) 
> 
> org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:936) 
> 
> org.apache.jsp.pages.lv_jsp._jspx_meth_html_html_0(lv_jsp.java:143)
> org.apache.jsp.pages.lv_jsp._jspService(lv_jsp.java:101)
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:856) 
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311) 
> 
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:856) 
> org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1014) 
> 
> org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:417) 
> org.apache.struts.action.RequestProcessor.processActionForward(RequestProcessor.java:390) 
> 
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:271) 
> 
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292)
> org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
> 
>>
>> Quoting Alexander Kirsch <Al...@t-online.de>:
>>
>>
>>> Hallo all,
>>>
>>> I have some problems with the JSTL 1.1 (From SUN jwsdp 1.3) Tags 
>>> together
>>> with
>>> Struts 1.1 DynaValidatorForms.
>>>
>>> I have defined the following DynaValidatorForm:
>>>
>>> <form-bean name="lvForm"
>>> type="org.apache.struts.validator.DynaValidatorForm">
>>>     ...
>>>     <form-property name="method" type="java.lang.String"/>
>>>     ...
>>> </form-bean>
>>>
>>> The Form is populated by an Action:
>>>
>>> public ActionForward execute(ActionMapping mapping, ActionForm form,
>>> HttpServletRequest request, HttpServletResponse response) {
>>>     DynaValidatorForm lvform = (DynaValidatorForm) form;
>>>     ...
>>>     lvform.set("method", "add");
>>>     ...
>>>     request.setAttribute(mapping.getAttribute(), lvform);
>>>     return mapping.findForward("continue");
>>> }
>>>
>>> After this the Fields in the Form-JSP are filled correct.
>>>
>>> Depending on what method I use I want to output different messages.
>>>
>>> For this I tried to use these JSTL-Tags:
>>>
>>> <c:choose>
>>>     <c:when test="${lvForm.map.method == 'update'}">
>>>         <h1><bean:message key="lvform.update"/></h1>
>>>     </c:when>
>>>     <c:when test="${lvForm.map.method == 'delete'}">
>>>         <h1><bean:message key="lvform.delete"/></h1>
>>>     </c:when>
>>>     <c:otherwise>
>>>         <h1><bean:message key="lvform.add"/></h1>     
>>>     </c:otherwise>   
>>> </c:choose>
>>>
>>> But I allways run into the otherwise tree.
>>>
>>> I also tries this without success:
>>>
>>> <c:when test="${lvForm.map['method'] == 'update'}">
>>>    <h1><bean:message key="lvform.update"/></h1>
>>> </c:when>
>>>
>>> So I hope that anybody can help me to solve this problem.
>>>
>>> Kind Regards and thank you very much
>>>
>>> Alexander Kirsch
>>
>>
>>
> 
> Kind Regards and thank you very much
> 
> Alexander Kirsch

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>



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