Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!

Nupur Gupta

Ranch Hand
+ Follow
since Aug 02, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nupur Gupta

Thank you so much Maneesh! It worked - it is a very big help!!!
12 years ago
Hi,
Thanks a LOT for your help. However , it is not working.. I don't quite understand. So this is what I have done...

I have a JFrame, to which is added a JPanel(tsPanel). The Grid Layout of tsPanel is set, and I add some components to it. After each component, I add

gbc.weightx=1.0;
gbc.weighty=1.0;
gbc.gridy++;
JLabel test = new JLabel(" ");
gbl.setConstraints(test, gbc);
tsPanel.add(test,gbc);

So next, I open my frame, and I resize it to occupy the full screen(I am not yet using the Java APIs to set full screen mode). I find that my components have gone awry, that is the size and orientation that I had in my un-resized window is not maintained.
Any pointers? Would be much appreciated. Thanks
12 years ago
It's not about resizing....I had coded the application to run in a smaller screen....now if I set it to large full screen..everything goes haywire....e.g. I had just two rows..now 2 rows take up the whole screen...and it just looks plain bad.
Thanks so much for your help
12 years ago
Nate..thanks for replying.. I am using GridBagLayout...
Maybe I am not doing so correctly...hmmm
12 years ago
I have written a swing application using a JFrame and now realise it should have been in full screen mode. But resizing it now is going to cause all the components to go haywire... is there any way I can use full screen maintaining my current proportions?
12 years ago
Thanks Mahesh... yes I know it interacts... but how? I mean, what are the useful things that are done... i mean i looked up the sessioncontext api, and it didnt look very functional....
In an EJB, how is a SessionContext useful?

Thanks a lot.
I have read that stateless session beans 'can maintain state (that is, use instance variables) for data and references that apply to bean functionality, or to all clients as opposed to a specific client'

How does this work?

Help MUUUUCHHH appreciated.. I have to appear in an interview..
I am a newbie..if several clients are serviced by the same instance of a stateless session bean(SSB) isnt there any data interference? How many instances of a SSB can be created by a container - is it the same as the number of clients?
Thanks a lot.
Oh, I see, so only classes derived from Servlet classses. I was trying to extend other classes just to learn the functionality, I have been following a book, and thought I would try the directive. Thanks a lot.
12 years ago
JSP
Hi all,
I am using JBoss and have made a simple jsp file which extends another class. I tried first with my own classes and got error(as described below), so I tried java classes next. My jsp page is as -

<!doctype html public "-//w3c/dtd HTML 4.0//en">
<%@ page extends = "java.lang.Thread" %>
<%!
public void run(){
System.out.println("In run");
}
%>

On invoking the page, this is the error I get -

org.apache.jasper.JasperException: Unable to compile class for JSP
C:\jboss-3.0.3\catalina\work\MainEngine\localhost\myjsp\directives2$jsp.java:54: Incompatible type for method. Explicit cast needed to convert org.apache.jsp.directives2$jsp to javax.servlet.Servlet.
pageContext = _jspxFactory.getPageContext(this, request, response,
^
1 error

at org.apache.jasper.compiler.Compiler.compile(Compiler.java:285)
at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:548)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:176)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:188)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
at java.lang.Thread.run(Thread.java:479)




Any ideas? Thanks
12 years ago
JSP
Thanks a lot for your help Shailesh.But I really dont understand.

"Instances of PreparedStatement contain an SQL statement that has already been compiled. This is what makes a statement "prepared" "

"A CallableStatement object provides a way to call stored procedures in a standard way for all RDBMSs. A stored procedure is stored in a database; the call to the stored procedure is what a CallableStatement object contains."

So both of them seem to be the same thing. Both of them seem to consist of SQL statements which are already compiled, and hence faster to execute. What is the difference?

Would much appreciate any feedback.
Hi,
I have read that the J2EE container takes care of security, transactions, and threading issues. Does that mean that the container by itself implements these functions? Or does the programmer coding the beans have to ensure that these functions are implemented in the code?
Thanks a lot.
Hi,
What is the difference between a PreparedStatement and a CallableStatement?

I have searched a lot on the internet for it, and all the replies are confusing, contradictory.

This is what I have gleaned so far -

Prepared statement is a set of SQL queries(or a call to a stored procedure). This is precompiled on the database. One can call it again and again, specifying different paramaters each time.

Callable Statement is also a call to a stoerd procedure, but it is permanently precompiled, and is called again and again , passing different parameters.

So it seems to be the difference between 'precompiled' and 'permanently precompiled'. What does this mean? Are they not both a set of SQL queries, ie a stored procedure? Further I read that a Callable Statement is a subclass of a Prepared statement . so the plot just gets thicker. Hmm..
Help much appreciated.
I can't believe it, I got the answer from the net.. the problem was with the <!DOCTYPE> tag... it should read

<!DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">

and then it works.....
12 years ago
JSP