This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Servlets and the fly likes Could Java class instantiate in jsp scriplet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Could Java class instantiate in jsp scriplet" Watch "Could Java class instantiate in jsp scriplet" New topic
Author

Could Java class instantiate in jsp scriplet

Gopi Krishna
Greenhorn

Joined: Jan 25, 2001
Posts: 10
Hi ,
can we instantiate a java class in a jsp page like
<% MyClass mc = new MyClass();
mc.getConnection();
%>
Asuthosh Borikar
Ranch Hand

Joined: Sep 29, 2000
Posts: 75
Gopi,
I don't see why not. I do it all the time and it never gives me any problem. But, it is preferrable to use JavaBeans in place of java classes,going by the MVC pattern.
HTH.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Could Java class instantiate in jsp scriplet