Raja Kannappan

Ranch Hand
+ Follow
since May 08, 2002
Merit badge: grant badges
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 Raja Kannappan

I found a solution to this myself.

There is no direct method to set the number of items in SWT list. But, you can indirectly control it by setting the heightHint in the GridData (if you are using GridLayout) for that component. So, the solution is to have the layout help in controlling the size of SWT list.
15 years ago
I have 200 items in my list and all the items show up on the screen. But, I want only to have 10 items to be visible and then have vertical scrollbar. How do I achieve this? I tried setting the bounds but that did not work. I'm using SWT inside eclipse forms. Below is my code. Any suggestions?

final Label myLabel = this.toolkit_.createLabel(myComposite, "Label: ", SWT.BEGINNING);

gridData = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);

myLabel.setLayoutData(gridData);

this.myList_ = new org.eclipse.swt.widgets.List(myComposite, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);

Point prefSize = this.myList_.computeSize(SWT.DEFAULT, SWT.DEFAULT);

Rectangle reqBounds = this.myList_.computeTrim(0, 0, prefSize.x, this.myList_.getItemHeight() * 10);

this.myList_.setBounds(10, 10, reqBounds.width, reqBounds.height);

gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);

this.myList_.setLayoutData(gridData);

this.toolkit_.adapt(this.myList_, true, true);

Thanks in advance,

- Raja.
15 years ago
Thanks for the response.

I'm writing the exact same object.

Also, I'm not using serialization. I'm writing manually to the stream.

Any ideas?
16 years ago
I'm writing some data to a file and this writing is done by a method called write(Object obj, OutputStream os). All this method does is query the object and write certain parts of the object into the stream. write(Object obj, OutputStream os) method constructs BufferedOutputStream and uses it.

I am calling this write() from two different places and it takes much longer when I call from one place. When I call from one part of our application it takes around 0.3 seconds but when I call the same method from a different part, it takes around 240 seconds. I couldn't understand why there is such a big difference. Both places construct output stream like this to pass: os = new FileOutputStream(new File(fileName)); and I pass the same filename and same object.

Any ideas on why it would take much longer when I call the same write method from a different part of the application? Thanks.
16 years ago
Thanks Garrett. That helps!
[ February 17, 2008: Message edited by: Raja Kannappan ]
16 years ago
I tried that before and it worked, but I had problems converting my input replacement string (coming from user) to the desired format. Previously, I tried replacement = replacement.replaceAll("\\", "\\\\"); but it gave me error. Now, i tried replacement = replacement.replaceAll("\\\\", "\\\\\\\\"); and it works fine.

The problem is solved but I don't understand why we have to put four slashes. I understand that we put two back slashes instead of one backslash as a escape
construct so that second backslash is actually taken as a character. But, I don't understand why we have to use four slashes. Can anyone please explain?

Thanks.
16 years ago
When I use String replaceAll() method, it removes all the backslashes in my replacement string. The matcher class in jdk explicity removes all the backslashes. Is there any way to avoid this?

when I do str.replaceAll("xyz", "c:\\temp\\xyz"); it replaces xyz with ctempxyz instead of c:\temp\xyz.

Does anyone know how to replace the string without replacing slashes? Any help is greatly appreciated. Thanks.
[ February 15, 2008: Message edited by: Raja Kannappan ]
16 years ago
I'm using Netbeans 5.5 and this is the example which came with Netbeans 5.5 and even all the classpath and libraries are set in this example. I don't understand why it has problem with JSP 2.0 examples.

Thanks.
17 years ago
JSP
I've got JSTL in my classpath. These are the libraries I have in my classpath: jstl.jar, standard.jar, jdk 1.5 and the bundled tomcat (5.5.17). Am i missing anything? The puzzling thing is, this is a Netbeans example program to illustrate JSP. I couldn't understand how it could be wrong. Any ideas are greatly appreciated. Thanks.
17 years ago
JSP
I am new to JSP and I just downloaded Netbeans 5.5 and I'm using the bundled tomcat (5.5.17) that came with Netbeans as my server. I created the project by doing File->New Project->Samples->Web->Tomcat JSP Example. I can run this project and from the samples page I'm able to run the JSP 1.2 examples in there. But if I try to run any of the JSP 2.0 examples, then I get the following exception. Am I missing anything? I did not modify the project and I'm just running the project as it is in Netbeans. Any ideas on fixing this is greatly appreciated. Thanks.

HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: javax.servlet.jsp.tagext.TagInfo.<init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljavax/servlet/jsp/tagext/TagLibraryInfo;Ljavax/servlet/jsp/tagext/TagExtraInfo;[Ljavax/servlet/jsp/tagext/TagAttributeInfo;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljavax/servlet/jsp/tagext/TagVariableInfo;Z)V
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:272)
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)


root cause

java.lang.NoSuchMethodError: javax.servlet.jsp.tagext.TagInfo.<init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljavax/servlet/jsp/tagext/TagLibraryInfo;Ljavax/servlet/jsp/tagext/TagExtraInfo;[Ljavax/servlet/jsp/tagext/TagAttributeInfo;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljavax/servlet/jsp/tagext/TagVariableInfo;Z)V
org.apache.jasper.compiler.TagLibraryInfoImpl.createTagInfo(TagLibraryInfoImpl.java:435)
org.apache.jasper.compiler.TagLibraryInfoImpl.parseTLD(TagLibraryInfoImpl.java:248)
org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:162)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:423)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:492)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1552)
org.apache.jasper.compiler.Parser.parse(Parser.java:126)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:211)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:155)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.


--------------------------------------------------------------------------------

Apache Tomcat/5.5.17
17 years ago
JSP
I'm running Tomcat 4.0.1. I've a simple html page which executes a jsp page upon pressing submit. I'm getting status 500 internal server error, upon pressing submit. It shows the following exception:

javax.servlet.ServletException: sun/tools/javac/Main
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:484)
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)

Any ideas on what is causing this? Any help is greatly appreciated.

Thanks.
[ September 24, 2006: Message edited by: Raja Kannappan ]
17 years ago
I found the problem. I was trying to access the html page directly like c:\tomcat....\index.html. Instead, I used it via the localhost and it now executes the jsp page. But the problem now is I'm getting tomcat error 500 and it displays the following exception:

javax.servlet.servletexception: sun/tools/javac/main

Any idea on what is causing this? Thanks for the help.
17 years ago
JSP
I reference the JSP like this. The jsp and html page are in the same directory. I also tried using method="post", but still I'm getting the same behavior.

<form action="show_entry.jsp" method="get">
....
....
</form>

It detects the file jsp file, but somehow tries to save it instead of executing it.

Thanks in advance.
[ September 24, 2006: Message edited by: Raja Kannappan ]
17 years ago
JSP
I've a simple html page and when user clicks on the Ok button, it tries to execute the JSP page. But when I click "OK", instead of executing the JSP, it tries to save the JSP. I'm using tomcat server and it is running. Is there a reason why it is trying to save the JSP instead of executing it?
Any help is greatly appreciated.
17 years ago
JSP
Hi,

In JFileChooser, I need to replace the normal approve button with a split button (like the one in microsoft applications). I can write my own split button. But I don't see a way to replace the JButton with my component. Is there a way to accomplish this?

Any help is greatly appreicated,

Thanks,

- Raja.
[ March 15, 2006: Message edited by: Raja Kannappan ]
18 years ago