Compiling a jsp code in comand prompt
i wan to know in how many ways can we compile the jsp codein comand prompt
haha this was the most fun topic on a board i've seen in a while
Similar Messages
-
Compiling and running jsp-code on the fly.
I am intending to use jsp as a report engine. The 'templates' should be jsp-code stored in the db, loaded and executed as if they where inside a plain jsp-file in the application. I cannot write new files on the file system since this is prohibited on the production env - so I would like to compile and execute the jsp-code directly in memory.
Was hoping this could be done with the jee standard stack.
Does anybode know how to to this, if possible?If you just want to run java applications, you just need the JRE: J2SE 5.0 JRE
If you want to compile java source code, you need the JDK: J2SE 5.0 JDK
It includes also the JRE. Recommended is also the J2SE 5.0 Documentation that contains the javadoc API that describes all the Java classes.
To start develeoping I recommend the Java Tutorial: http://java.sun.com/docs/books/tutorial/ -
How to compile and deploy JSP code from Unix server command line?
I am new to JSP technology. We are thinking to modify some of JSP code to meet our need. But I am not sure what I should do after I change JSP code. How can I compile the changed code? How to deploy? How to publish on the web?
All files are regenerated if changed.
That goes for the .java and the .class files that are created. The jsp server checks to see if the current version is the latest. If it is, nothing gets changed or recompiled. If things are different, programs are recompiled.
Youll notice that if you have a new jsp it always takes longer the first time. Or even when you change a jsp, the first time takes the longest for the page to come up in a browser. This is because of recompiling.
Does this make any sense?
Adam -
Hello world/ comand prompt
Hi im trying to use comand prompt to compile helloworld tatourial
package je3.basics
public class hello {
public static void main(string[] args {
system.out.printin("Hello world");
I typed in the file name as the instructions stated
in the comand prompt
PROMPT: helloworld.java // the file i saved it in
It returned
i helloworld:
Is this right
I tried it with a simple frame class but it did not display the frame
I am confedent that the code was right
is there somthing i must do after comand promp returns
i helloworld // or has something gone wrong?
Many thanksI am confedent that the code was right
Really? The code above does not compile, there are lots of errors in it:
- You need a ";" after "package je3.basics"
- It is "String", not "string" (Java is case-sensitive)
- It is "System", not "system"
- The method you want to call is not called "printin", but "println"
- You should save this is a file called "hello.java", not "helloworld.java", because the class is called "hello"
- You should save this file in a subdirectory "je3\basics" because of the package statement
Then you compile it like this (assuming you saved the file in C:\MyProject\je3\basics):
C:\MyProject> javac je3\basics\hello.java
And you run it like this:
C:\MyProject> java je3.basics.hello
See the Hello World tutorial on Sun's website. -
JSP codes for running a JAVA program
hello...
does anyone know the JSP codes for running a Java program from my web page?? i mean i already have my java program compiled... and i just want this java program to run in the background when I click on a button or a link...
Any idea about this?
plz advice..
aviyes... u r somewhat right... but this runs on Jakarta Tomcat...
i'm using the Apache Http Server together with the ServletExec AS which enable the Apache server to run JSP..
I've created a package where i've put my classes...
WEB-INF/classes/tbd(package name)/my classes
and i've added.. package name.. in my java program..
and then in jsp... i've written..
<%@ page import="tdb.*"%>
<jsp:useBean id="exec" class="tdb.textdb" />
<%exec.convert_data();%>
but when i run the page it says the package does not exist...
can anyone tell where to place the folder WEB-INF so that it can run fine?
thx
avi -
I have a database content driven website, and I would like to know how to get jsp code to work inside the database content field.
Here is the code I use to get the content and return it to the browser:
rs = stmt.executeQuery ("select * from pages where pageid = " + spid);
out.println (rs.getString ("pagecontent"));Here is a example of jsp code that I want to include into the database content field:
<% out.println ("inside html"); %>Currently any jsp code gets treated as text. I would like the jsp to get compiled. Does anyone know how to handle this?
Thanks in advance for any answers.
DavidUsually, the way you do this is by separating the JSP code from the DB code.
Create a Java Bean that gets the page content. Then create a JSP that calls the required method on that Java Bean. Then the JSP only needs to be compiled once by the container, and the database calls are made when needed.
Example:
class DbAccess {
public String getContent() {
... DB access code here ...
}JSP page:
<%= DbAccess.getContent() %>Manuel Amago. -
Jsp code not being executed in browser
Even though my applications deploy and redeploy, I can see .html files but not .jsp files. The server presents the path, i.e. http://localhost:7001/ITDC/index.jsp, but the jsp code is either not being compiled and exceuted in a client browser or the .jsp is being compiled but not executed in the client broswer.
Akilah <[email protected]> wrote:
>Even though my applications deploy and redeploy, I can see .html files
>but not .jsp files. The server presents the path, i.e. http://localhost:7001/ITDC/index.jsp,
>but the jsp code is either not being compiled and exceuted in a client
>browser or the .jsp is being compiled but not executed in the client
>broswer.
How about you tell us exactly what happens, and what you expected to happen. I
can't tell if you're getting error messages, or whether you just don't see what
you expect on the screen.
Note that JSP code is not ever executed in the browser. It's only ever executed
in the appserver, and the generated output is viewed in the browser.
-
Interpreting JSP code in Java code
Hi,
I am writing a scheduler to generate emails based on certain events.
The email body constructed using HTML. I was constructing the HTML string
for the body using string concats. Its quickly becoming untenable to
maintain the code whenever I have to make changes to email body.
I thinking of using JSP based templates. [ I have access to all the tomcat jar files in my program]
I have following question in this context:
Can I parse/compile the JSP file in the java code and invoke the
resultant class with my input variable's) to get a output stream?
E.g.: Lets say I have a JSP template as shown below:
<HTML>
<TABLE >
<TR>
<TD>Name:</TD>
<TD>Telephone number:</TD>
</TR>
<%
for ( int i = 0; i < input.size(); i++)
%>
<TR>
<TD>
<%=(Contacts)input.getName()%>
</TD>
<TD>
<%=(Contacts)input[i].getTelephonenumber()%>
</TD>
</TR>
<%
%>
</TABLE >
</HTML>
I want to execute the JSP with some input in my java method and get the resultant HTML string.
Is its possible to do this? Or is there a better way of doing this?
Thanks
mgSorry didn't read that properly.
If you are sending emails using javamail, you can specify a URL datasource:
Can't promise this code will work out of the box, but it may give a couple of ideas...
I was sending an attachment with this mail, and I've chopped that bit out.
// Create message
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress("[email protected]"));
InternetAddress addr = new InternetAddress();
message.addRecipients(Message.RecipientType.TO, email);
message.setSubject(mailSubject);
Multipart multipart = new MimeMultipart();
// The important part - reading the body of the message from a URL.
URL url = new URL("http://urlToGenerateTheEmailAutomatically");
DataSource source = new URLDataSource(url);
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setDataHandler(new DataHandler(source));
multipart.addBodyPart(messageBodyPart);
// send message.
message.setContent(multipart);
transport.sendMessage(message, message.getAllRecipients()); -
Hiding JSP code during deploynment in tomcat5
I have developed a JSP application using JSP pages,Servlets and JavaBeans and i would reaaly like to hide my JSP code.
Since JSP pages have to be converted to Java Sources and then to classes, is there a way i can deploy only the class files sumped by my tomcat? Please assist because i am desperate with this solutionHi
This thing can be done. Let me give u an example
suppost i have a context named Test in webapps directory. it contains
a jsp named hello.jsp.Now start Tomcat, access the hello.jsp file
eg:
http://localhost:8080/Test/hello.jsp
Now it will compile the jsp and the servlet version of the jsp will be created in work\Catalina\localhost\Test\ . inside this directory the servlet of the corresponding JSP gets created with following package
org.apache.jsp.hello_jsp.java
inside org/apache/jsp directory u will find the hello_jsp.java and hello_jsp.class File.We will require only class file.Delete the .java file
make a jar of org.apache.jsp.hello_jsp say test.jar
Now copy test.jar to webapps/Test/web-inf/lib
edit the web.xml like this
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<servlet>
<servlet-name>HelloServlet</servlet-name>
<servlet-class>org.apache.jsp.hello_jsp</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<url-pattern>/hello.jsp</url-pattern>
</servlet-mapping>
</web-app>now delete the hello.jsp start Tomcat and try acess the jsp
Hope everything will work fine...
regards
Suvendu -
Unable to compile JAVAFX source code.
Hi there,
I am beginner of JAVFX Tech. i uses eclipse (Version: 3.4.0) as a IDE, and javafx sdk 1.2. i compiling following basic code,
import javafx.stage.Stage;
import javafx.scene.Scene;
Stage {
title : "MyApp"
scene: Scene {
width: 200
height: 200
content: [
and Following errors occurs:
1) cannot access javafx.lang.Builtins class file for javafx.lang.Builtins not found
2) cannot find symbol symbol : class Stage location: class secondjfx
3) Multiple markers at this line
- Invalid assignment
- cannot find symbol symbol : class Scene location: class secondjfx.Scene$anon1
etc. I install plug-ins successfully and path is also correctly set, still errors occurs,
if any one knows the cause of error please inform me.
Thanks in advance,
Regards,Yes, I am able to open the JSP file in the NitroX editor. All of the tabs you reference above are present and functional. I don t know if this is meaningful or not, but I ve tried deploying the application as both an ear file and using WebLogic s Split Directory deployment technique. The results were the same in both cases (as described above).
The ear file deployment has three components: A war file, an ejb jar file and an exploded APP-INF directory structure. The ejb jar file is pretty standard and the APP-INF directory structure contains mostly class files and jar files, not JSP files or anything weird. Architecturally, the application makes heavy use of struts.
The deployed war file has the following directory structure:
Meta-inf
Resources
--Common
--Css
--Customers
----Images
----Scripts
----Style
--Images
--Jsp
----Common
----Online
--Scripts
--Templates
--XML
--Web-inf
----Classes
------Customers
--------Properties
----Lib
----Tlds
The breakpointed JSP file resides in the resources/jsp/online directory. It contains relative references to components elsewhere in the structure. As described above, it all works fine in both a straight BEA deployment and in the NitroX run time environment. Set breakpoints are caught. It s the IDE functionality that I m struggling with once the breakpoint is caught.
Are there any other diagnostics that I could capture and send your way? Just ask and I ll do what I can to accommodate. Much thanks. -
I'm using Orion as my server. I've got an app with a couple of JSP's. One JSP is welcome.jsp and runs JSP code fine. The other is navigation.jsp and it doesn't have ANY JSP code at all, but it still produces an internal 500 error when I browse to it....
Any suggestions?A 500 error code usually indicates that there was some problem with the server itself. For example, Tomcat will report 500 if it is unable to find the Java compiler it needs.
I'm not at all familiar with Orion, and never heard of it before today, but you may want to see if they included some sample JSP code, and if so, test to see if that code works. You might also double check that you've followed all of the instructions they set forth. In particular, pay attention to where to find error messages (usually in a log file).
One potential gotcha that seems to plague lots of developers is spaces in file names. If you installed Orion in something other than the default directory, and your preferred directory has a space somewhere in the path name, it's possible that the Orion developers didn't take that into account and as a result, some of their stuff works correctly and some doesn't. -
Help on jsp code to display data in same page using using ajax ?
Is there any jsp code to display in same page using using ajax ?
Re: need help on how to display data in same jsp page. Locking.
-
Is there a way of embedding JSP code in VBScript?
I am launching MS Excel using VBScript in the JSP Page. I want to populate the spread sheet with the values coming from a Java Bean. I am not sure how I can embed JSP code in VBScript.
ThanksI tried doing that with Javascript but it gives me error..
here is the code I was testing..
<script language="JavaScript">
function test(){
var name = <%=(bean.getName())%>;
alert(name);
</script>
<input type="button" name="Button" value="test" onClick=javascript:test()>
Error : Object Expected
If I do a similar thing with VBScript, it doesnt work either.
here is the test code for VBScript
<SCRIPT LANGUAGE="VBScript">
sub button1_onclick()
dim name = <%=(bean.getName())%>
' Launch Excel
dim app
set app = createobject("Excel.Application")
' Make it visible
app.Visible = true
set rng2 = wb.Activesheet.Range("A1").Resize(2,2)
rng2.value = name
' Give the user control of Excel
app.UserControl = true
end sub
</SCRIPT> -
How to access a JAVA Script variable in JSP Code
How to access a JAVA Script variable in JSP Code. I have been unable todo this.
Plz Suggest a way.
Thanks
Soumyatry to do this code
String s=request.getParameter("javascriptvariablename"); -
Error While running the JSP Code
This is the error message:
A java exception has occurred during the processing of this request.
Error occurred in JSP element starting at line number 20
javax.servlet.jsp.JspTagException: I/O Error: java.net.SocketException: Connection reset
at desisoft.jsp.tagext.SendMail.doAfterBody(SendMail.java:213)
at desisoft_jsp_SendMail_jsp1139292195218._jspService(desisoft_jsp_SendMail_jsp1139292195218.java:111)
at desisoft.server.JspBaseClass.service(JspBaseClass.java:48)
The JSP code:
<%@ taglib prefix="blx" uri="/blx.tld" %>
<HTML>
<BODY>
<%
// Get username.
String email = request.getParameter( "email" );
%>
<% if ( email == null || email.equals( "" )) { %>
Please enter an email address.
<% } else { %>
<blx:email host="mail.xxx.com" from="[email protected]">
<blx:emailTo><%= email %></blx:emailTo>
Thank you for registering with us. You registered the
following name: <%= request.getParameter( "username" ) %>
Your registration was received at <%= new java.util.Date() %>
Attached, please find a contents file.
</blx:email>
<!-- Also write out some HTML -->
Thank you. A confirmation email has been sent to <%= email %>
<% } %>
</BODY>
</HTML>This is the error message:
A java exception has occurred during the processing of this request.
Error occurred in JSP element starting at line number 20
javax.servlet.jsp.JspTagException: I/O Error: java.net.SocketException: Connection reset
at desisoft.jsp.tagext.SendMail.doAfterBody(SendMail.java:213)
at desisoft_jsp_SendMail_jsp1139292195218._jspService(desisoft_jsp_SendMail_jsp1139292195218.java:111)
at desisoft.server.JspBaseClass.service(JspBaseClass.java:48)
The JSP code:
<%@ taglib prefix="blx" uri="/blx.tld" %>
<HTML>
<BODY>
<%
// Get username.
String email = request.getParameter( "email" );
%>
<% if ( email == null || email.equals( "" )) { %>
Please enter an email address.
<% } else { %>
<blx:email host="mail.xxx.com" from="[email protected]">
<blx:emailTo><%= email %></blx:emailTo>
Thank you for registering with us. You registered the
following name: <%= request.getParameter( "username" ) %>
Your registration was received at <%= new java.util.Date() %>
Attached, please find a contents file.
</blx:email>
<!-- Also write out some HTML -->
Thank you. A confirmation email has been sent to <%= email %>
<% } %>
</BODY>
</HTML>
Maybe you are looking for
-
so i changed my apple id since it was attached to an email i don't use and forgot to log out of my iPad before doing so. i don't use it often so this was probably two months ago and now i notice the old apple id that always will come up invalid user
-
External Drive Reformatted Itself
I have an external drive that used to be a 3TB USB 2.0 WD MyBook. A while ago I upgraded my MBP to a 2012 model that has USB 3 so I bough an USB 3 external drive case, took apart the MyBook and swapped the drive to the new case. It worked flawlessly
-
Video streamed from YouTube using the Apple Composite AV Cable
I used to have video streamed from YouTube on my iPad to my TV using the Apple Composite AV Cable, this was in previous versions till the iOS 6 release, then YouTube no longer streams video through this cable :'( Very annoying really to miss a featur
-
Uninstalling trial version of Lightroom 3.
I installed a Lightroom 3 disc, then bought the new version of Lightroom 4. I want to get rid the catalogue I created practicing in Lightroom 3. I dragged it to trash and it is still showing in my applications, but no pictures come up in Lightroom 4,
-
Looking for phone with the right PIM functionality
Hello, newbie here. I'm looking for a phone that can synchronise with Outlook 2003. Specifically I want to keep the notes I add to a meeting in Outlook. These often include an agenda which I need to run the meeting, or a number for a conferencing fac