Sandeep Gabhale

Greenhorn
+ Follow
since Nov 10, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Sandeep Gabhale

Nayanish,

class variables

are nothing but instance variables which stays in heap.

Correct me if i'm wrong for the below statement

variables declared inside initializer blocks

, these variables are like local variables as good as declared in class methods, which stays in stack as they are specific to the methods/blocks for that thread.

variables declared in static initializer block

are also treated as local variables and stays in Non-Heap Memory.

Refer to this link http://javapapers.com/core-java/java-jvm-memory-types/. It will be useful
12 years ago
Hi Sidhartha,

Pop-up a light-box on the call of send-mail.jsp.
Keep the .gif image on the light-box till all the mails sent. With this it gives a feeling of processing mails and at the same-time the previous page will be in-active as required.

12 years ago
Hi Sidhartha,

You can give Ajax call to send-mail.jsp from the current JSP page by giving a hyperlink or button like "Send Mail".
Provide and empty div tag in the current JSP page and once clicked on the link/button (Send Mail) fill the div with loading.gif image and the image will be displayed till all the mails been sent.
Once all the mails been sent then display the message "Mail sent successfully" and give a link for home page.

As I've used this kind of loading.gif for Ajax call and most developers use Ajax call and show up loading till the request is processing.

Hope this will help you!
12 years ago
Hi Julien,

The Error clearly states the action mapped is not able to search at the "Default" namespace which is declared in the struts.xml.

Your struts.xml contains package namespace="/", which means the struts2 Filter will search for the center.jsp in the default namespace and your default namespace is where you've placed your index.jsp.

So, either place your center.jsp where your index.jsp exists and remove "/pages" from the result tag or make the package namespace="/pages" by keep the center.jsp as it is and try it.

Hope you came to know where you made mistake.
12 years ago

Bear Bibeault wrote:

Sandeep Gabhale wrote:I've also added the jstl.jar, jsp-api, servlet-api and ojdbc6.jar.


If by this you mean that you have moved or copied jsp-api and servelt-api to WEB-INF/lib, remove them. They will cause nothing but trouble there. The container provides these, not you!



Your right Bear, but even after removing the above mentioned jars didn't helped..

It would be great if you could guide me with the above mention issue.
12 years ago
JSP
Hi All,

Below is the JSP file code which works fine in Tomcat v7, but fails in JBoss 5.1.0 server.
The method

getContactBridge

for which it gives error!
I've also added the jstl.jar, jsp-api, servlet-api and ojdbc6.jar.





The error message is
[org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/Nucleus_ManageDB].[jsp]] (http-127.0.0.1-8080-2) Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /jsp/CfgAreaType.jsp(14,5) The function getContactBridge must be used with a prefix when a default namespace is not specified
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
at org.apache.jasper.compiler.Validator$ValidateVisitor$1FVVisitor.visit(Validator.java:1478)
at org.apache.jasper.compiler.ELNode$Function.accept(ELNode.java:129)
at org.apache.jasper.compiler.ELNode$Nodes.visit(ELNode.java:200)
at org.apache.jasper.compiler.ELNode$Visitor.visit(ELNode.java:242)
at org.apache.jasper.compiler.ELNode$Root.accept(ELNode.java:56)
at org.apache.jasper.compiler.ELNode$Nodes.visit(ELNode.java:200)
at org.apache.jasper.compiler.Validator$ValidateVisitor.validateFunctions(Validator.java:1503)
at org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:1140)
at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:820)
at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1530)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2359)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2409)
at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:635)
at org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1178)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2359)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2409)
at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:839)
at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1530)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2359)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2409)
at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2415)
at org.apache.jasper.compiler.Node$Root.accept(Node.java:495)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2359)
at org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1735)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:184)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:333)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:313)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:300)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:585)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:312)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:183)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:95)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:451)
at java.lang.Thread.run(Thread.java:619)

Quick reply is highly appreciated.
12 years ago
JSP

LinkedHashMap, on the other hand, will store items in insertion order. So if you sort by value, as you've shown here, then insert into a LinkedHashMap in sorted order, they'll stay that way.


Hi Ernest,

Thanks for the update!
This is basic, but very valuable information about all the Maps
12 years ago
To decouple your code from a specific implementation of the interface.
When you use
List<String> names = new ArrayList<String>();
the rest of your code knows that datatype is of type List<String>, which gives you flexibility to switch between different implementation of List interface.
Like, there may be a case when your required to use LinkedList<String> instead of ArrayList<String> in future for faster
insertion and deletion of data from List then at that time your code simply need the small change.
List<String> names = new LinkedList<String>();
and still rest of your code work as it is of datatype as List<String>.
12 years ago
Thanks to all!
12 years ago

Campbell Ritchie wrote:Hints

  • 1: Don’t do it.
  • 2: Optimisation is a bad idea
  • 3: You can introduce bugs or even worsen performance
  • 4: There is some really useful stuff in this interview with Brian Goetz


  • Hi Campbell,

    Thanks for your valuable suggestions.

    I read the article of Mr. Brian Goetz.
    From the article, I understood that write simple code using basic OOPs Concept.
    Also, got some exposure to new features of JDK 6.
    12 years ago
    Hi,

    Does anyone help me out with code optimization tips and suggestions.

    I searched on Google... but couldn't got good examples/tips.

    Its would be great, if someone have done code optimization in his/her project then please share it!

    12 years ago
    Im planning to appear for SCJP, I prepared for SCJP 5, but is it ok to give SCJP 5 or i should study for SCJP 6 and then appear for the same i.e. SCJP 6?
    Also , let me know how much the certification voucher cost in india.