Hi Constantina,

Instead of servlet.getServletContext().setAttribute("treemodel",root);

I use request.setAttribute("treemodel",root);

In the JSP, instead of
DirectoryModel((Node)servlet.getServletContext().getAttribute("treemodel")
%>.

I use <bean:write name="treemodel" property="propertyOfNodeClass" /> to
wirte one propierty into the generated html code,

or <% DirectoryModel((Node)this.pageContext.getAttribute("treemodel"));

Hope That Help, Enrique.

_____________________________
Enrique Rodriguez Lasterra



> -----Mensaje original-----
> De: Konstantina Stamopoulou [mailto:[EMAIL PROTECTED]]
> Enviado el: miercoles, 03 de abril de 2002 10:37
> Para: Struts Users Mailing List
> Asunto: How to take object from the Action to jsp
>
>
> Hello,
> My question might sound naive but I really eed your answer.
>
> I'm storing an object in ServletContext with the following code :
>
>    servlet.getServletContext().setAttribute("treemodel",root);
> where root is an object of type Node(myclass).
>
> In my jsp I want to retrieve this object from the Servletontext
> so I do the following:
>
> <%= new
> DirectoryModel((Node)servlet.getServletContext().getAttribute("tre
emodel") %>.
>
> I'm wondering why I get the Exception:
>
> org.apache.jasper.compiler.ParseException:
> C:\jakarta\jakarta-tomcat-3.2.3\webapps\teach\main_menu.jsp(77,99)
>  Attribute treemodel has no value
>       at
> org.apache.jasper.compiler.JspReader.parseAttributeValue(JspReader
> .java:519)
>       at
> org.apache.jasper.compiler.JspReader.parseTagAttributes(JspReader.
> java:635)
>       at org.apache.jasper.compiler.Parser$Tag.accept(Parser.java:798)
>
> My problem is that I cannot handle this object as a javabean
> since I want to use the object as it is and not to get the values
> of its properties.
>
> I would really appreciated your help.
>
> Thank you,
> Konstantina
>
>
>
>


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

Reply via email to