XML and Servlets!!
Hi all,
I am very new to Java/XML. I need to get text data delimted by eg tabs, from a textbox in a java servlet into an XML format and was wondering if anyone had or knew of any sites that had code that already does this. Also, if no code is available I would be very grateful if someone could direct me the
best starting point for doing this.
thanks a lot
www.jdance.com
www.ibm.com and go to the developer section.
java.sun.com/xml
javaworld.com
oreilly.com
good luck with servlets and xml. xml ignores whitespaces and u will have to code a bit to get the tabs
Similar Messages
-
Toplink xml binding session.xml and servlet
I made a project with toplink-jaxb mapping
with simple pojo object it works fine.
I made another project with servlet
and the same session.xml and java classes
but when my process start it throw an exception :
jaxbexception : Provider oracle.toplink.ox.jaxb.JAXBContextFactory could not be instantiated:
It is like the process could not read the session.xml files, but this file and two xml file for the mapping are in the classpath (in WEB-INF/classes).
Have i to put these files in another place ?
Thanks.Hi,
thank you for your response but
here is the code :
javax.xml.bind.JAXBContext jaxbContext = javax.xml.bind.JAXBContext.newInstance(
"fr.cnav.cramse.pgpe.contactsnationaux"),this.getClass().getClassLoader());
but i still got the same exception :
05/03/01 08:24:33 exceptionProvider oracle.toplink.ox.jaxb.JAXBContextFactory could not be instantiated: java.lang.NoSuchMethodError: oracle.toplink.publicinterface.Session oracle.toplink.tools.sessionmanagement.SessionManager.getSession(oracle.toplink.tools.sessionconfiguration.XMLSessionConfigLoader, java.lang.String, java.lang.ClassLoader, boolean, boolean)
I have also a stange message in the log window in jdev :
Cutting log (size: 101767, max: 100000)Component returned failure code: 0x80470002 (NS_BASE_STREAM_CLOSED) [nsIFileOutputStream.write]Component returned failure code: 0x80470002 (NS_BASE_STREAM_CLOSED) [nsIFileOutputStream.write]Component returned failure code: 0x80470002 (NS_BASE_STREAM_CLOSED) [nsIFileOutputStream.write]Cutting log (size: 101866, max: 100000)Error cleaning up log: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISeekableStream.seek]
Thank you for your help. -
Web service and servlets in the same project...web.xml?
Hello, I have a problem with my web service.
I have a server, which displays a web service. I programmed this service with JAXRPC.
I have a client, in another directory. I succeded in compiling, deploying and running the web service.
The problem is that after I tried to integrate this service in an existing project. This project contains servlets. In these servlets, I'm using sessions.
These servlets are on the same side as the server of the web service. Because of the implementation of my code, I'd like to use in the class that represents the server of the service, the same session as the one I'm using in the servlets.
But of course, it's not working by itself. I know there's something to do with the web.xml files.
The thing is that I created a web.xml file for the service, and another for the servlets.
I was thinking of joining both of them in one xml file, but everything crashes then...
Could someone tell me how to create a project with a web service and servlets, and mostly how to configure the xml file??
Thanks for any help
PhilippeHello, I have a problem with my web service.
I have a server, which displays a web service. I programmed this service with JAXRPC.
I have a client, in another directory. I succeded in compiling, deploying and running the web service.
The problem is that after I tried to integrate this service in an existing project. This project contains servlets. In these servlets, I'm using sessions.
These servlets are on the same side as the server of the web service. Because of the implementation of my code, I'd like to use in the class that represents the server of the service, the same session as the one I'm using in the servlets.
But of course, it's not working by itself. I know there's something to do with the web.xml files.
The thing is that I created a web.xml file for the service, and another for the servlets.
I was thinking of joining both of them in one xml file, but everything crashes then...
Could someone tell me how to create a project with a web service and servlets, and mostly how to configure the xml file??
Thanks for any help
Philippe -
Servlet produced XML and Cocoon 2
Hello,
I have just over one years experience with using servlets, and have a good understanding of the way that they operate.
I am currently trying to dynamically produce XML from a servlet and pipe this through Cocoon 2, however I have had no success so far, and have trawled through all of the Cocoon mailing list.
I am aware that (and indeed have utilised) XSP and JSP can be used in the Cocoon pipeline, but I have not found many resources regarding the use of servlets. I believe that I have to create a generator, but the Cocoon 2 API is a bit sparce to say the least :-)
If anyone can provide me with links, info, examles, or just a good kick in the right direction I will be much appreciatve.
Thanks in advance,
WillAs I understand Cocoon it is all abot performance and oriented that all the element do not just generate XML as text but do pipline that generates events, so that system starts processing the document before its end loaded. And servlets knows nothing about pipeline so I think it is not easy to make it integrated in Cocoon.
-
Deploying a WAR file containing .jsp and servlets (also uses JNI)
Deploying a WAR file containing .jsp and servlets (also uses JNI) on Windows 2000
We had problems making it initially work on Sun ONE Web Server 6.0 Service Pack 1 because of lack of good iPlanet Web
Server documentation on deploying such files.
This is how we went about it:
1) Make one of the servlet and JSP (must call another Java Class) web application (.war) examples work with iPlanet Web
Server.
C:\iPlanet\Servers\plugins\servlets\examples\web-apps\HelloWorld\HelloWorld.war
and
C:\iPlanet\Servers\plugins\servlets\examples\web-apps\jakarta-examples\jarkarta-examples.war
a) Go to your Web Server Administration to deploy the application using GUI Web Application Deploy.
(We usually use command line, we experienced some issues with the GUI version, but maybe it is fixed in the new Web Server
service packs)
From browser, open http://yourserver:8888/
Click on Select a Server:Manage
Click on Virtual Server Class
Click on https-yourserver
Click on the Web Applications Tab
Then, click on Deploy Web Application
Enter the following -
WAR File On: Local
WAR File Path: C:\iPlanet\Servers\plugins\servlets\examples\web-apps\jakarta-examples\jarkarta-examples.war
Application URI: /jakarta
Installation Directory: c:\iPlanet\examples\jakarta-examples
By clicking on OK it deployed the application.
I can verify that it is deployed by selecting "Edit Web Applications" and I see the following entry:
Edit /jakarta c:/iPlanet/examples/jakarta-examples
Also, c:/iPlanet/examples/jakarta-examples should have the similar following directory structure ..
- [images]
- [jsp]
- index.html
- [servlets]
- [META-INF]
- [WEB-INF]
- [classes]
- [tlds]
- web.xml
- index.html
I restarted the server and accessed it using the following URL from my IE browser:
http://yourserver/jakarta/index.html
Then I clicked on the JSP Examples and tried some JSP examples.
b) Alternatively, you can also deploy the same example from the command-line.
Make sure C:\iPlanet\Servers\bin\https\httpadmin\bin\ is in your path
wdeploy deploy -u /jakarta
-i yourserver
-v https-yourserver
-d c:\iplanet\examples\jakarta-examples
C:\iPlanet\Servers\plugins\servlets\examples\web-apps\jakarta-examples\jarkarta-examples.war
Restart the web server (I don't think you have to restart, but .. might as well).
2)Deploy your web-application
My Foo.war has the following structure.
You can use jar tf Foo.war to look at the file contents from command line (assuming you have JDK installed and the bin is
in your PATH)
Foo.war
- [META-INF]
- [WEB-INF]
- web.xml
- [classes]
- Bar.class
- MoServlet.class
- [lib]
- ThirdParty.jar
- [natlib]
- extlib.dll
- foo.jsp
Here is our application scenario:
foo.jsp uses a class call Bar (it is not in any package). The Bar java class uses classes from ThirdParty.jar. The
ThirdParty.jar in turn uses JNI to load library extlib.dll. foo.jsp also calls /servlet/Mo as well.
Now to deploy it, do the following:
(a) Make sure that within foo.jsp, you import the Bar class ( I don't know why you have to do it, but if you don't you get
JSP compile error).
<%@page language="java" import="Bar" contentType="text/html"%>
(b) Check web.xml (for Servlets)
Within web.xml, make sure you have the following mappings:
<servlet>
<servlet-name> MoLink </servlet-name>
<servlet-class> MoServlet </servlet-class>
</servlet>
<servlet-mapping>
<servlet-name> MoLink </servlet-name>
<url-pattern> /servlet/Mo </url-pattern>
</servlet-mapping>
(c) Deploy the application
Using command line:
wdeploy deploy -u /foo
-i yourserver
-v https-yourserver
-d c:\iplanet\examples\foo-dir
Foo.war
(d) Change web-apps.xml file (for picking up ThirdParty.jar)
It is located in
C:\iPlanet\Servers\https-yourserver\config
You should see something similar to following after successful deployment.
<web-app uri="/foo" dir="C:\iPlanet\examples\foo-dir" enable="true"/>
Change it to look like following to pick up the ThirdParty.jar
<web-app uri="/foo" dir="C:\iPlanet\examples\foo-dir" enable="true">
<class-loader reload-interval="300"
classpath="C:/iPlanet/examples/foo-dir/WEB-INF/lib/ThirdParty.jar"
delegate="false"/>
</web-app>
(e) Change jvm12.conf file (for JNI)
It is located in
C:\iPlanet\Servers\https-yourserver\config
Add or uncomment the following lines:
#optional - just helps with instrumenting the jsp and servlet code
jvm.include.CLASSPATH=1
jvm.enableDebug=1
nes.jsp.enabledebug=1
jvm.trace=7
jvm.verboseMode=1
#required for JNI
java.compiler=NONE
jvm.classpath=.;C:\JDK1.3.1\lib\tools.jar;C:/iPlanet/Servers/plugins/servlets/examples/legacy/beans.10/SDKBeans10.jar;
jvm.option=-Xrs
jvm.option=-Xnoagent
# not sure if this is needed for iPlanet web server
jvm.option=-Djava.library.path=C:/iPlanet/examples/foo-dir/natlib/ -Djava.compiler=NONE
(f) Change magnus.conf file (for JNI)
We HAD to change this file in order for ThirdParty.jar file to pick up the native C++ code using JNI. Apparently, the
iPlanet Web Server doesn't pick the Environment Variable Path. Because when we had the directory containing the DLL just
in Path, it didn't work.
Change Extrapath directive:
ExtraPath C:/iPlanet/Servers/bin/https/bin;${NSES_JRE_RUNTIME_LIBPATH}
to
ExtraPath c:/iPlanet/examples/foo-dir/natlib;C:/iPlanet/Servers/bin/https/bin;${NSES_JRE_RUNTIME_LIBPATH}
(g) Apply changes from the Web Server Administration Console and Restart the web server.
You should be able to see the behaviour that you want from your application.
http://yourserver/foo/foo.jsp
Hope this was helpful!!!
SonuDeploying a WAR file containing .jsp and servlets (also uses JNI) on Windows 2000
We had problems making it initially work on Sun ONE Web Server 6.0 Service Pack 1 because of lack of good iPlanet Web
Server documentation on deploying such files.
This is how we went about it:
1) Make one of the servlet and JSP (must call another Java Class) web application (.war) examples work with iPlanet Web
Server.
C:\iPlanet\Servers\plugins\servlets\examples\web-apps\HelloWorld\HelloWorld.war
and
C:\iPlanet\Servers\plugins\servlets\examples\web-apps\jakarta-examples\jarkarta-examples.war
a) Go to your Web Server Administration to deploy the application using GUI Web Application Deploy.
(We usually use command line, we experienced some issues with the GUI version, but maybe it is fixed in the new Web Server
service packs)
From browser, open http://yourserver:8888/
Click on Select a Server:Manage
Click on Virtual Server Class
Click on https-yourserver
Click on the Web Applications Tab
Then, click on Deploy Web Application
Enter the following -
WAR File On: Local
WAR File Path: C:\iPlanet\Servers\plugins\servlets\examples\web-apps\jakarta-examples\jarkarta-examples.war
Application URI: /jakarta
Installation Directory: c:\iPlanet\examples\jakarta-examples
By clicking on OK it deployed the application.
I can verify that it is deployed by selecting "Edit Web Applications" and I see the following entry:
Edit /jakarta c:/iPlanet/examples/jakarta-examples
Also, c:/iPlanet/examples/jakarta-examples should have the similar following directory structure ..
- [images]
- [jsp]
- index.html
- [servlets]
- [META-INF]
- [WEB-INF]
- [classes]
- [tlds]
- web.xml
- index.html
I restarted the server and accessed it using the following URL from my IE browser:
http://yourserver/jakarta/index.html
Then I clicked on the JSP Examples and tried some JSP examples.
b) Alternatively, you can also deploy the same example from the command-line.
Make sure C:\iPlanet\Servers\bin\https\httpadmin\bin\ is in your path
wdeploy deploy -u /jakarta
-i yourserver
-v https-yourserver
-d c:\iplanet\examples\jakarta-examples
C:\iPlanet\Servers\plugins\servlets\examples\web-apps\jakarta-examples\jarkarta-examples.war
Restart the web server (I don't think you have to restart, but .. might as well).
2)Deploy your web-application
My Foo.war has the following structure.
You can use jar tf Foo.war to look at the file contents from command line (assuming you have JDK installed and the bin is
in your PATH)
Foo.war
- [META-INF]
- [WEB-INF]
- web.xml
- [classes]
- Bar.class
- MoServlet.class
- [lib]
- ThirdParty.jar
- [natlib]
- extlib.dll
- foo.jsp
Here is our application scenario:
foo.jsp uses a class call Bar (it is not in any package). The Bar java class uses classes from ThirdParty.jar. The
ThirdParty.jar in turn uses JNI to load library extlib.dll. foo.jsp also calls /servlet/Mo as well.
Now to deploy it, do the following:
(a) Make sure that within foo.jsp, you import the Bar class ( I don't know why you have to do it, but if you don't you get
JSP compile error).
<%@page language="java" import="Bar" contentType="text/html"%>
(b) Check web.xml (for Servlets)
Within web.xml, make sure you have the following mappings:
<servlet>
<servlet-name> MoLink </servlet-name>
<servlet-class> MoServlet </servlet-class>
</servlet>
<servlet-mapping>
<servlet-name> MoLink </servlet-name>
<url-pattern> /servlet/Mo </url-pattern>
</servlet-mapping>
(c) Deploy the application
Using command line:
wdeploy deploy -u /foo
-i yourserver
-v https-yourserver
-d c:\iplanet\examples\foo-dir
Foo.war
(d) Change web-apps.xml file (for picking up ThirdParty.jar)
It is located in
C:\iPlanet\Servers\https-yourserver\config
You should see something similar to following after successful deployment.
<web-app uri="/foo" dir="C:\iPlanet\examples\foo-dir" enable="true"/>
Change it to look like following to pick up the ThirdParty.jar
<web-app uri="/foo" dir="C:\iPlanet\examples\foo-dir" enable="true">
<class-loader reload-interval="300"
classpath="C:/iPlanet/examples/foo-dir/WEB-INF/lib/ThirdParty.jar"
delegate="false"/>
</web-app>
(e) Change jvm12.conf file (for JNI)
It is located in
C:\iPlanet\Servers\https-yourserver\config
Add or uncomment the following lines:
#optional - just helps with instrumenting the jsp and servlet code
jvm.include.CLASSPATH=1
jvm.enableDebug=1
nes.jsp.enabledebug=1
jvm.trace=7
jvm.verboseMode=1
#required for JNI
java.compiler=NONE
jvm.classpath=.;C:\JDK1.3.1\lib\tools.jar;C:/iPlanet/Servers/plugins/servlets/examples/legacy/beans.10/SDKBeans10.jar;
jvm.option=-Xrs
jvm.option=-Xnoagent
# not sure if this is needed for iPlanet web server
jvm.option=-Djava.library.path=C:/iPlanet/examples/foo-dir/natlib/ -Djava.compiler=NONE
(f) Change magnus.conf file (for JNI)
We HAD to change this file in order for ThirdParty.jar file to pick up the native C++ code using JNI. Apparently, the
iPlanet Web Server doesn't pick the Environment Variable Path. Because when we had the directory containing the DLL just
in Path, it didn't work.
Change Extrapath directive:
ExtraPath C:/iPlanet/Servers/bin/https/bin;${NSES_JRE_RUNTIME_LIBPATH}
to
ExtraPath c:/iPlanet/examples/foo-dir/natlib;C:/iPlanet/Servers/bin/https/bin;${NSES_JRE_RUNTIME_LIBPATH}
(g) Apply changes from the Web Server Administration Console and Restart the web server.
You should be able to see the behaviour that you want from your application.
http://yourserver/foo/foo.jsp
Hope this was helpful!!!
Sonu -
Cannot view PDF created by passing xml and XSL-FO using UTL_HTTP
Hi,
Using UTL_HTTP Iam trying to contact a servlet which uses the input XML and XSL/FO to produce a PDF.However, when I run the procedure , I get the following error 'File does not begin with -%PDF' ? I checked the output on the console and the blob values does not start with %PDF . Below is the sample from my code , please let me know if Iam commiting a mistake somewhere. I confirmed that the servlet itself is working fine by confirming with test webpage that takes xml and stylesheet input and generates a PDF when 'submitted' to servlet on the click of a button.
INSERT INTO TESTPDF ( PDF_REPORT ) VALUES ( Empty_Blob() ) RETURNING PDF_REPORT INTO vBlobRef;
vReportURL :='/rufop/fop?xml='||xmldoc||'&xsltRPath=../../test/PAXSL.xsl';
req := UTL_HTTP.BEGIN_REQUEST (url=>vReportURL, method=>'POST');
resp := utl_http.get_response(req);
loop
begin
Utl_Http.read_raw(resp, vData);
Dbms_Lob.writeAppend ( lob_loc => vBlobRef , amount => Utl_Raw.length(vData) , buffer => vData );
exception
when utl_http.end_of_body then
exit;
end;
end loop;
Utl_Http.end_response(resp);
owa_util.mime_header('application/pdf',false);
htp.p('Content-Disposition: inline; filename="test.pdf"');
htp.p('Content-Length: '|| dbms_lob.getlength(vBlobRef));
owa_util.http_header_close;
wpg_docload.download_file(vBlobRef);
Thanks in advance,
JenHello guys! I have been assigned the same task,i.e to generate pdf through xml using xsl stylesheet.
I have a procedure which is creating the xml and the stylesheet. But I have no idea how to write the procedure which passes this xml to fo engine. I am very new to this. Can anyone please share your thoughts with me so as how to accomplish this? By reading blogs on internet I figured I would have to use UTIL_HTTP but don't know how.
Sunny
Edited by: 887252 on May 29, 2012 1:24 AM -
Mime-type tag in web.xml and attachment download
i have set a mime-type in web.xml as below:
<mime-mapping>
<extension>xls</extension>
<mime-type>application/vnd.ms-excel</mime-type>
</mime-mapping>
And i have a simple jsp that only shows a table and i am making this jsp to get downloaded as an excel attachment. To make it possible i have written the following line in the JSP:
response.setHeader( "content-disposition", "attachment; filename=myexcel.xls" );
But i am not setting the content type first by writing:
response.setContentType( "application/vnd.ms-excel" );
since i have already mentioned the appropriate mime-type for excel files in web.xml.
I am using both mozilla and IE. Both are showing file download dialog. But IE is able to correctly identify the type of the attachment and opens it up with Microsoft Excel whereas mozilla fails to identify the type, assumes it to be an HTML document and opens it up in a new window of IE.
mozilla works fine only when i set the content type in the JSP itself. But IE works in all conditions even without having the mime-type tag in web.xml.
If i have already specified the mime-type for particular type of file in web.xml, is there any requirement to set the content type again in the JSP/servlet?
Please help. I even changed the mime-type for .xls (excel) files in web.xml and made it text/plain, but still the same thing is happening. IE is always showing the correct file type where as mozilla is taking it as an HTML document.
i am using weblogic server 8.1.the web xml mime type setting are for static files served by the server...
if you print a file directly to the output of the servlet, you must set the mime type, so DO write :
response.setContentType( "application/vnd.ms-excel" );
IE "works fine" because it also uses the file extension to decide the mime type... but in the absolute, it's a wrong behaviour -
Implement SSL in JSP and servlets
hi there,
i needed some help in implementing ssl in JSPs and servlets. My idea was to have a login page and also use it where sensitive data is being sent. I have used the basic socket programming (socket.class and serverSocket.class) in GUI applications using threads to listen and send simultaniously and understand how it works but how do I implement it in JSP and servlets and where do i store the certificate?
i do know that using SSL sockets is very much the same as using the normal sockets.
can anyone tell me any useful links or give me a step by step guide how to implement it and which classes to use
your help would be very much appreciated.
manihi,
soory for late reply.
i think you need to use keytool program in your JDK to generate a certificate signature file and you need to configure the server.xml to open and use the HTTPS port. I have not had any additional info on this but i would assume that you simply enter https:// on the file you wish to load in your form and it should use the HTTPS port provided it can find the certificate which must be stored somewhere in your tomcat web server. i would recommend you see tomcat website or search on google for "ssl support in tomcat".i hav not had time to look into this but i will as soon as i am free from my work load.
mani -
Database updation using XML and stored Procedure?
Hello,
I want to perform updation in multiple tables using XML files.Please suggest can I do updation using xml and stored procedure.
If yes then which is more efficient and takes less time.
1.Updation using xml files only
2.Updation using xml files with stored procedure.
3.Stored procedure alone.
If direct xml and stored procedure communication is possible.then please write how.
Thanks in advance for any help.Here's a sample. The next code drop of the XSQL Servlet will make the easy-to-do from within XSQL Pages:
package package1;
import org.w3c.dom.*;
import java.sql.*;
import oracle.jdbc.driver.*;
import oracle.xml.sql.query.OracleXMLQuery;
public class Class1 extends Object {
public static void main( String[] arg ) throws Exception {
Connection conn = getConnection();
CallableStatement ocs = conn.prepareCall("begin ? := App.HotItems('PAUL'); end;");
ocs.registerOutParameter(1,OracleTypes.CURSOR);
ocs.execute();
ResultSet rs = ((OracleCallableStatement)ocs).getCursor(1);
OracleXMLQuery oxq = new OracleXMLQuery(conn,rs);
System.out.println(oxq.getXMLString());
oxq.close();
rs.close();
ocs.close();
conn.close();
public static Connection getConnection() throws Exception {
String username = "scott";
String password = "tiger";
String dburl = "jdbc:oracle:thin:@localhost:1521:xml";
String driverClass = "oracle.jdbc.driver.OracleDriver";
Driver d = (Driver)Class.forName(driverClass).newInstance();
return DriverManager.getConnection(dburl,username,password);
null -
Basic jsp and servlet question (JSP Model 2)
Hi
I want to make an website where i use JSP Model 2 architecture. However I got a basic question
1. I need to separate business logic from presentation with the use of jsp and servlets. Meaning I want no html code in the servlet. Can you give a simple example of how this can be done? If I map my implementation of httpServlet to a jsp page in web.xml and override doPost() and doGet(). The calls to the jsp page comes to the servlet as it should. I want to process some methods (calling sessionbeans or similar which in turn calls entitybeans) and then show the jsp page.
How do I show the jsp page without mixing html in the servlet as I've done below:
doGet(HttpServletRequest req, HttpServletResponse res)
PrintWriter p = response.getWriter();
p.print("<html><body>Hello world</body></html>"); //I dont want to do //this, I want to display the JSP site
doPost(HttpServletRequest req, HttpServletResponse res)
//doSomething
}Message was edited by:
CbbLeYou should treat your servlet class much like a controller, where you can then use JSP as the view. The way you achieve this is to use the forward() method in RequestDispatcher.
Say you've got a servlet class org.yoursite.controller.YourController:
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
//Set some value for use in the JSP file associated wth me
req.setAttribute("greeting", "Hello world!");
//Done with our business logic, off we go to the JSP file
ServletContext app = getServletContext();
RequestDispatcher disp;
disp = app.getRequestDispatcher("/some/jsp/file.jsp);
disp.forward(req, resp);
}Now in your JSP file:
<h1>Example</h1>
<div>
I just want to say <%= request.getAttribute("greeting") %>
</div>Going to that servlet now executes business logic and then points to the JSP file for the view. You can forward from servlet to servlet too if needs be. The string you pass to forward() is whatever would be in the URI of the request so any <servlet-mapping> configurations in web.xml are used ;)
There is some pretty in-depth documentation on the J2EE blueprints website, namely service-to-worker and front-controller patterns. I dare say if you're looking for this sort of code you'll want to look at the composite view pattern too (also on blueprints). -
Third-party jars not visible to EJB's and servlets.
Hi, This is an unanswered post in an newsgroup which exactly displays our
current problem,
Extract Begins -->
"I've got a WebApp with classloading issues while running WebLogic 5.1.
According to the JSDK 2.2 API, if I include third-party classes in
WEB-INF/lib, my EJBs and servlets should be able to load any jar'ed classes
inside. In practice, however, it seems to make no difference. My EJB always
comes back with a NoClassDefFound error for xerces.jar that's in WEB-INF/lib
(and I've even tried adding it to the EJB JAR itself with no change).Of
course, if I put Xerces in the server's classpath, there are no problems but
that's a road I don't want to go down.How can I tell my EJB's to load
third-party classes from the WEB-INF/lib directory of the WAR file? I'd
appreciate your insight. <-- End
We are busy migrating one of our apps from 5.1 to 6.1, What we have done
thus far and fairly successfully is the following,
We packaged all the jsps, WEB-INF, html, images into a WAR file and then
packed all EJB's, META-INF and classes to which the ejbs refer, into an EAR
file.
EMARKET_APPS/
+myjsp.jsp
+myhtml.html
+images
+WEB-INF/+
|
+classes/+
|
+myclass1.class
+myclass2.class
|
+lib/+
|
+OReily.jar
+jts.jar
+xerces-1_4_1.jar
+junit.jar
+jcschart110Kwl.jar
|
+web.xml
+weblogic.xml
+META-INF/+
|
+applications.xml
+ejbs/+
|
+myejb1.jar
+myejb2.jar
+lib/+
|
+classes.jar
Please advise.
Rgs RolyHave you tried to include the jars in the Class path entry in the manifest file.
That should work eventhough I haven't tried it yet (fighting with ear deployement
and I must say WLS seems to be winning). I'll get back to when I've tried it.
There is a VERY good article on theserverside.com regarding class loaders and
EAR/WAR/EJBs at http://www.theserverside.com/resources/articles/J2EE-Deployment/chapter.html
Good luck
/erik -
hi to all... i've configured my tomcat 6.0 for the deployment of servlet but i always get a 404 error, servlet not available...
environment variables:
classpath has been pointed to servlet-api.jar ans jsp-api.jar
java_home set to point to jdk folder
configuration of tomcat:
conf/web.xml: uncomment servlet/* and its corresponding servlet mapping
conf/context.xml: set reloadable="true"
still when i do all of this nothing works! even my html pages! error page not found...
whats the problem?
plz help with the configuration of tomcat
heartful thxI am having the same problem. I tried exactly like an example of a book.
Then i read this thread and I tried to load the examples that come with tomcat.
http://localhost:8080/servlet-examples/servlet/HelloWorldExample
And it�s not working. It works only .html files, for example:
http://localhost:8080 -> opens the tomcat homepage
http://localhost:8080/jspbook/index.html ->opens my example
my project looks like this(inside the webapps) /jspbook/ WEB-INF ; build.xml ; index.html
/jspbook/WEB-INF/ web.xml ; classes
/jspbook/WEB-INF/classes/com/jspbook/HelloWorld.java
My web.xml got:
<servlet>
<servlet-name>HelloWorld</servlet-name>
<servlet-class>com.jspbook.HelloWorld</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
<url-pattern>/hello</url-pattern>
</servlet-mapping>
Then I try to acess it
http://localhost:8080/jspbook/hello
and I get 404. the resource is no available
Who can help me? -
Am I correct in assuming that JSP is an extention of servlets and that to learn JSP in effect means learning about servlets? My point is, is JSP the superior technology a bit like learning JDK1.4 is now a pointless excercise as it has been superceded by 1.5 ?
thanksAm I correct in assuming that JSP is an extention of
servletsYes.
and that to learn JSP in effect means
learning about servlets? No. This isn't necessary, as a matter of fact, it is one of the reasons why JSP exists - so people with little or no Java knowledge can build dynamic web sites using Servlet containers, assuming they have Java programmers behind them to build the tags / glue to the web app.
Still, I say having basic understanding of Servlets (at least) will help you out.
My point is, is JSP the
superior technology No. JSP has a different role. It makes display easier to code for non-Java programmers (looks more like HTML/XML), and easier to support and understand later on.
JSP does horribly bad at complex application control, data selection and manipulation, or as an interface to external resources. Java and Servlets are better at these tasks (but conversly, are horrible to work with for display purposes).
They are different, JSPs and Servlets, in what task they do. J2EE is far superior when you use them both appropriately.
a bit like learning JDK1.4 is now
a pointless excercise as it has been superceded by
1.5 ?No.
JSP is a newer technology, but should not be used to replace Servlets, but used along side Servlets to provide a better designed and manageable application.
Let the servlets control what pages the user sees when, to gather data, to talk with external resources. Then forward to a JSP which simply displays what the Servlet did all the work in getting.
>
thanks -
Hi all,
Can somebody help me to give the tutorial about building XML using servlet ?
I need an servlet which can generate XML before send it back to the client (in this case I use MIDlet as the client).
So far I use kXML as the parser, and it works.
I don�t think to use XSL because the target is not HTML based or web page.
Thank You,
Best Regards,
CHiichiwan wrote:
all of those links are using XSLT or DOM approach.
I want the similar tutorial but without involving XSLT or DOM.
In other words, only pure servlet that able to generate xml tagsWell that is simple to do.. If u know writing servlets and know about xml typos, just use that knowldge to generate your xml file.
What u need to do is in your response u have to write the xml data. This is how...
response.setContentType ("text/xml;charset=UTF-8");
PrintWriter out = response.getWriter ();
out.println ("<?xml version="1.0" encoding="ISO-8859-1"?>");
out.println ("<CATALOG>");
for (int i=0; i<dataVector0.size(); i++) {
out.println ("<CD>");
out.println ("<TITLE>"+dataVector0.elementAt (i)+"</TITLE>");
out.println ("<ARTIST>"+dataVector1.elementAt (i)+"</ARTIST>");
out.println ("<COUNTRY>"+dataVector2.elementAt (i)+"</COUNTRY>");
out.println ("<COMPANY>"+dataVector3.elementAt (i)+"</COMPANY>");
out.println ("<PRICE>"+dataVector4.elementAt (i)+"</PRICE>");
out.println ("<YEAR>"+dataVector5.elementAt (i)+"</YEAR>");
out.println ("</CD>");
out.println ("</CATALOG>");
out.close ();You should have corresponding data in the Vectors dataVector0 thru dataVector5... The resulting response will look something like >> http://www.w3schools.com/xml/cd_catalog.xml
Hope this helps...
SD+ -
Hi,
Can anyone recommend a good, recently published book on JSPs and Servlets?Things on the Internet may be up to date, but they
aren't necessarily as usable as a book.
For example. I am just trying to learn Ant. There's
the Ant user manual at http://ant.apache.org/manual/
for a start. But to find anything you have to click on
a link, then on another link, then on another link.
And it doesn't have an index so even if you know what
you are looking for, you still have to start at the
beginning and click randomly until you find it. And
you can't easily browse through looking for
interesting things.
Not to mention that it doesn't give you any
suggestions on what to do and why. It simply describes
the various XML elements used by Ant. For example it
may be possible to have an element which is like a
subroutine, so you can call the same code from
multiple targets. But if it is, I haven't found out
how yet.
Sometimes a book is better. In this case it would be.I agree with DrClap. Books do have a shelf life in IT, but they're definitely worth having.
MOD
Maybe you are looking for
-
Simple credit check - value need to be blocked from particular sales order to be post in f.35
Dear Expert, I have a case here to find, the client uses simple credit check , we have different order types ( Example 6 order types), out of which we want to restrict the value of one order type to be posted in f.35 i.e the value should not effect c
-
Hi, My DBA did the linux installation of SOA 10.1.3.1, then applied patches to upgrade it to 10.1.3.3.1. I deployed a process, but failed to run it. When i checked the DBAdapter version, it's still in 10.1.3.1. All others are in correct version. Have
-
Mterial Number mandatory for Purcahse Resuisition except for Nonstockable I
Hi All, The requirement is like material number should be mandatory except for Non Stockable items (likePen, Stationery Items) while creating a Purchase Requisition. I know in SPRO Settings, "Define Screen Layout at Documnet Level" in Purchase Requ
-
Hi, I was using java script code in my JSP itself.This was working fine.but when i moved the code in .js file,it stopped working.!!!. Please suggest how to make it work. Cheers: Akash.
-
Magic Mouse accessibility problem
Have discovered an accessibility problem with the Magic Mouse. My right hand middle (right click) finger is heavily bandaged at the moment. Mouse will not accept right clicks, even all the way on the edge. Interprets them as left/single button click.