File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes EL s not running Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "EL s not running " Watch "EL s not running " New topic
Author

EL s not running

Abhra Kar
Ranch Hand

Joined: May 22, 2008
Posts: 122
I hava to class in package foo.
package foo;
public class Person {
public String name;
public Dog dog;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Dog getDog(){
return dog;
}
public void setDog(Dog dog){
this.dog=dog;
}}
package foo;
public class Dog{
public String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}}
and a servlet
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class s1 extends HttpServlet {
public void doGet(HttpServletRequest req,HttpServletResponse res)
throws IOException,ServletException{

foo.Person p = new foo.Person();
p.setName("Evan");

foo.Dog dog=new foo.Dog();
dog.setName("Spike");
p.setDog(dog);
req.setAttribute("person",p);
RequestDispatcher view =req.getRequestDispatcher("result.jsp");
view.forward(req,res);
}}

now when I use this- Dog's name is : ${person.dog.name} in result.jsp then I get the output
Dog's name is : ${person.dog.name} instead of getting "spike"
but this is working fine --
<%= ((foo.Person) request.getAttriute("person")).getDog().getName() %>
Why ?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

You probably did not set your web.xml properly. Check this FAQ, especially this section (servlets 2.4)


[My Blog]
All roads lead to JavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EL s not running
 
Similar Threads
El property not found problem
EL Execution Problem
Getting wrong result ,but why?
EL doesn't work
Compiling java file