Re: How to take object from the Action to jsp

2002-04-15 Thread rob

.jsp pages have access to the a reference named application from which you can gain 
access to
objects stored in your servlet context.  I believe you should use the following method 
to access
context scoped objects within your jsp pages.

You can extract the reference to your treemodel with the following.

%
Node root = (Node) application.getAttribute(treemodel);
%
%= new DirectoryModel(root) %

Or your way

%= new DirectoryModel((Node)application.getAttribute(treemodel)) %



At 06:36 PM 4/3/2002, you wrote:
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(treemodel) %.

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]




How to take object from the Action to jsp

2002-04-03 Thread Konstantina Stamopoulou

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(treemodel) %.

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






RE: How to take object from the Action to jsp

2002-04-03 Thread Enrique Rodriguez

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]




Re: How to take object from the Action to jsp

2002-04-03 Thread Konstantina Stamopoulou

Thanx,
It finally  worked by using bean.

Konstantina
- Original Message -
From: Enrique Rodriguez [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Wednesday, April 03, 2002 4:50 PM
Subject: RE: How to take object from the Action to jsp


 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]




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