aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes When you are using EL, do we HAVE to explictly write servlet code? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "When you are using EL, do we HAVE to explictly write servlet code?" Watch "When you are using EL, do we HAVE to explictly write servlet code?" New topic
Author

When you are using EL, do we HAVE to explictly write servlet code?

Swagato Bhatta
Ranch Hand

Joined: Nov 08, 2008
Posts: 72
When you are using EL, do we HAVE to have servlets?


I mean is it possible to go from HTML page directly to jsp page that has EL and get things done without having to EXPLICTLY write a single line of servlet code, scripting or Standard Actions?

I mean. I wish to go from a form of a HTML page directly to jsp page. That I think can be done. In the JSP page, I do not want any scriptings, Standard actions or do not want to write any servlets. I just want EL. And just print the value from the form. Is that possible?

Let us say we have the following index file (index.jsp) that takes data from form and passes it via post to chosing.jsp

Now let us take a look at the following abstract Person.java class


And Employee.java class


And employeeCar.java class



In chosing I wish to display the value of car name , empID and name. How do I do that without using scripting, directive, servlet...But just wish to use only EL? Possible?
I tried the following.. but doesnt work!


Working on my SCWCD so I can be a J2EE consultant earning millions of dollars and showing everyone I can
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9302
    
  17

Yes it is definitely possible. EL is just a way to access scoped attributes and other stuff. You can get request parameters through EL, or access bean style properties on different objects like ${pageContext.request.contextPath} to get the context path. You don't need any servlet code for all these. You can add scoped attributes using jsp:useBean tag, so you don't need to use any servlet for those too...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Swagato Bhatta wrote:When you are using EL, do we HAVE to have servlets?

As Ankit said , not required . but I suggest you to use servlet , you *set* something in servlet . and read(get) in jsp using EL(read only)

Swagato Bhatta wrote:I mean is it possible to go from HTML page directly to jsp page that has EL


why you want to do this? . I guess , this is for learning purpose
Swagato Bhatta
Ranch Hand

Joined: Nov 08, 2008
Posts: 72
Seetharaman Venkatasamy wrote:
Swagato Bhatta wrote:When you are using EL, do we HAVE to have servlets?

As Ankit said , not required . but I suggest you to use servlet , you *set* something in servlet . and read(get) in jsp using EL(read only)

Swagato Bhatta wrote:I mean is it possible to go from HTML page directly to jsp page that has EL


why you want to do this? . I guess , this is for learning purpose


You are right. Just learning curve...

And thanks everyone

Page 382 (of Bert's book) has the answer

Following the code.. if ever anyone comes across this forum post :-)

Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Swagato Bhatta wrote: thanks everyone


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: When you are using EL, do we HAVE to explictly write servlet code?