Charles Philip

Greenhorn
+ Follow
since Feb 26, 2011
Merit badge: grant badges
For More
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 Charles Philip

I tried the codes in the link but it did not work. I wrote a .bat file and it solved my problem.

Thanks anyway!
13 years ago
JSP
I put tools.jar in my build path in order to use javac and the error(HTTP Status 500) is:


org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 468 in the jsp file: /CodeGenerator.jsp
com.sun.tools.javac.Main cannot be resolved to a type
465:
466: String javacArguments[] = new String[1];
467: javacArguments[0] = "SimApplet.java";
468: com.sun.tools.javac.Main.compile(javacArguments);

Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


Charles
13 years ago
JSP
Thanks for your reply,

The server generates an applet code which does not do the same thing each time. This means that my .java file(which contains the applet) is different each time. How to compile this file on the server? I tried this code below but it did not work even though I imported what was needed. I get an error saying that it could not compile.

13 years ago
JSP
If I understand well, you want to display 10 more records each time you click i.e. if you had 20 records and click, 10 records should append to the existing.


So this you can do it through innerHtml (on client side) i.e. you take the codes which are between your <table> tag and add the code replied by the server(responseText).

What I mean is this: Populate a string of the records which you want to add on server side. This string should contain your <tr><td><input type=text id="newCount" value="hereYouMakeTheServerWriteTheDataYouQueried">...

(Also include name and id attribute if you have to use it on client side)
Loop 10 times and make your string variable append each new record.
After looping, you should get a string which contains all your tags for the rows, the textboxes,value in the textboxes etc.

Then you make the server send this string. When the client receives this string(responseText), you use JS to append the server's reply with the existing code.

Make sure that your table is within a div.

If you don't understand AJAX, this won't be easy to explain you all the steps.



............

There's another alternative to AJAX which is not so nice(because it will require refreshing your page):

Store in a session the number of records.

Make your client request 10 new records:

1) Use the div tag to hide your text box, form. Set your text box value to 10 by default.
2) When you click, a request is sent and the server reads the value in the session.
3)You add this value to 10.Then you return to your page(refresh), read the new session value and Loop this number of times to populate your table.

AJAX is worth learning...
Hi!

I have a JSP page which generates a java file. This java file contains the code for an applet. I have been using java to compile the .java file itself by this code:





But now I would like to compile my .java file through my JSP page itself. I tried to import tools and use javac but it did not work...

Thanks!
13 years ago
JSP