Best websites with JSP and Servlets
I would like to see some examples of the best well-known websites realised with jsp & servlets.(if it's possible some awarded ones)
thx
This forum is using JSPs. I can see post.jsp in the URL as I type this. Famous enough?
I believe eBay is 100% J2EE:
http://www.theserverside.com/home/thread.jsp?thread_id=8906
MOD
Similar Messages
-
Help with jsp and servlets(litterature)
I'm planning on converting a asp website to jsp and I need to figure out the following:
1: servlet that gives out connection objects from a pool and manages "lost" connections to a mysql db
2: a bean that has getConnection and closeConnection that is used on every jsp page.
3: servlet/bean that can check size/dimesions/filetype on a remote url image
4: Figure out what users are logged in at every given moment. result: x users are on, these are user1, user2, user3. automatic removal when session runs out. probably need a servlet for this.
I got these books:
deitel java how to program 3rd edition
deitel advanced java 2 platform how to program
The last book has a servlet and jsp section ut I suspect that java has evolved since then so thats why I'm asking if you have any other suggestions that offer more than 2 chapters. Its really basic the stuff i have :)
Its been 3 years since I've touched java so i hope you guys can recomend jsp/servlet books that can answer these questions for me and help me get started with this project?
Thanks :)1. apache dbcp commons library.
http://jakarta.apache.org/commons/dbcp/
2. tomcat DataSource, which already has the dbpc logic incorporated into it.
http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
3. no idea, google may help
4. HttpSessionBindingListener. This allows you to monitor when a bean (such as a User bean) is added to the session and when it is removed from the session. This way you can track yourself which users are online.
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpSessionBindingListener.html -
New Bie - Starting with JSP and Servlets
Hello fellow members,
It's my pleasure to be a part of such a wonderful forum. Today, I am here to learn JSP, Servlets, and related tech/frameworks.
I'd be thankful to any member who can guide me in the right direction.
I have good working knowledge of Core java.
I have a licensed copy of weblogic 9.2, though I have no idea how it works :).
Looking forward for some good pointers to start with. If anyone can hand hold me and tell me exercises I should do every day, there is nothing like that. I can dedicate in excess of 6 hrs daily to learn these new technologies.
Thanks in advance,Sonia_31 wrote:
I planned to start with tomcat. Tomcat is a good choice.
I am using my cousins laptop which already has BEA weblogic 9.2 installed. He used to work as software engineer. So I thought it was better start with weblogic, than going for something else.Apparently his company is using Weblogic.
As I am serious about the whole thing weblogic is a better option. You have application servers and application servers. When I say that Weblogic is commonly only used in "real" production environments, I do not mean that "real" production environments only use Weblogic. You can use any self-respected application server to your taste. Either freeware or payware. That you're using a payware one to start with just made my eyebrows raise.
Looking for some info to get started. I have downloaded the pdf you have mentioned and started studying. I'll post my questions soon.Good luck. -
Delete data dynamically with JSP and servlet (Very Urgent)
Hi,
I am new with servlets and JSP. On my jsp page I am populating customer names in a drop box from database and I have 3 buttons ADD, DELETE and EDIT.
Now when I press DELETE buttong I am calling delete function which is writen in Javascript on my jsp file only,now I want to pass these selcted values ehich I have stored in an array to be pass to servlet,so I can write Delete query for it and delete.
Could anyone help with sample code>
Here what I am trying to say:
<HTML>
<HEAD>
<script language="JavaScript" type="text/javascript">
<!--
function remove()
var u = confirm("Are you sure you want to Delete Selected names?")
if (u==true)
var selectedArray = new Array();
var selObj = document.getElementById('CUSTOMER_NAME');
var i;
var count = 0;
for (i=0; i<selObj.options.length; i++) {
if (selObj.options.selected) {
selectedArray[count] = selObj.options[i].value;
count++;
alert("names to be deleted are:"+selectedArray);
// selectedArray has the selected items stored
alert("Items Deleted!")
else
alert("No data were deleted!!You pressed Cancel!")
//-->
</script>
</HEAD>
<BODY>
//calling servlet on action tag of form
<FORM METHOD= 'POST' ACTION='Remove_Customer'>
<form ><INPUT TYPE='submit' NAME='DELETE' VALUE='DELETE' onclick="remove()"></TD></form>
<form><INPUT TYPE='submit' NAME='MODIFY' VALUE='MODIFY' onclick="modification()" ></TD></form>
</BODY>
</HTML>
PLEASE HELPME,it's very urgent.
Since the selected Array is in javascrip language , I don't know how can I pass that to servlet.
request.getParameter is not working,since it's an array
Many thanks in Advance.Hey,
I am having problem deleting multiple values.
If I just select one value,it deletes it
But for multiple values the code is not working right.
If there 2 values selcted then the last value gets deleted,if there are more than 2 values selected none values delete.
Could plese check the code,and let meknow what mistake am I doing?
Please help
String delName="";
int pos = tStr.indexOf(",");
System.out.println(pos);
if (pos != -1)
delName = tStr.substring(0, tStr.indexOf(","));
tStr = tStr.substring(tStr.indexOf(",") + 1 );
System.out.println("DElName:"+delName);
System.out.println("tStr::"+tStr);
delName = tStr;
delete_Customer(delName);
Thanks
ASH -
Problem with JSP and servlet in Tomcat
hello all,
I have made a simple hello world in Eclipse and Tomcat, it works well on my localhost, but now that I try to run it on the server in our lab I got this exception:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Implementing class
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:272)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.IncompatibleClassChangeError: Implementing class
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClass(ClassLoader.java:620)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1815)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:869)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1322)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1201)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:127)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:65)
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
java.lang.Class.getDeclaredConstructors0(Native Method)
java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)
java.lang.Class.getConstructor0(Class.java:2640)
java.lang.Class.newInstance0(Class.java:321)
java.lang.Class.newInstance(Class.java:303)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:148)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
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:802)
I have transfered the web.xml file and lib and classes folder in a WEB-INF folder and also all the JSP files. I can see he JSP file, but the 'hello worl' does not work and gives this exception!
Does any one have any idea what could be the problem?
thanks a lot
Mitraseems the web Server code previously loaded a class only when it was used rather than when it was referenced,
ask your question in the tomcat-user mailing ! !!! -
Hi,
How would I create an editable JSP form from JDBC?
I know how to retrieve the data from JDBC, but I'm still trying to figure out how to take that table data and format it into a tabluar format that user can make changes to it.
Thanks,
Tom
Message was edited by:
bztom_33
Message was edited by:
bztom_33CreateConnection();
logger.info("Database connection opened in Testimonials");
String queryText = "LOCK TABLE testimonials WRITE,posting_table WRITE";
int numOfRows = st.executeUpdate(queryText);
rs = st.executeQuery(SELECT_QUERY_FROM_TESTIMONIALS);
logger.info("Query executed postingVeiw");
String queryText1 = "UNLOCK TABLES";
int numOfRow = st.executeUpdate(queryText1);
while(rs.next())
ClientData client = new ClientData();
client.setName(rs.getString("name"));
client.setTestimonial(rs.getString("testimonial"));
client.setCompany(rs.getString("company"));
clientList.add(client);
RequestDispatcher disp = null;
req.setAttribute("clientlist", clientList);
String error1 = req.getParameter("");
disp = req.getRequestDispatcher("testimonial.jsp");
disp.forward(req,res);
And call this arraylist from the jsp page
Cheers
Varun Rathore -
Help with JSP and logic:iterate
I have some queries hope someone can help me.
I have a jsp page call request.jsp:
====================================
<%@ page import="java.util.*" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<html>
<body>
<%@ page import="RequestData" %>
<jsp:useBean id="RD" class="RequestData" />
<%Iterator data = (Iterator)request.getAttribute("Data");%>
<logic:iterate id="element" name="RD" collection="<%=data%>">
<jsp:getProperty name="RD" property="requestID" />
<%=element%><br>
</logic:iterate>
</body>
</html>
And I have the RequestData.java file:
======================================
private int requestID = 1234;
public int getRequestID() { return requestID; }
The jsp page display:
======================
0 RequestData@590510
0 RequestData@5b6d00
0 RequestData@514f7f
0 RequestData@3a5a9c
0 RequestData@12d7ae
0 RequestData@e1666
Seems like the requestID is not returned. Does anybody know this?
I have done the exact one using JSP and servlets, trying to learn using JSP and custom tags. The one with JSP and servlet looks like:
============================================
<%@ page import="RequestData" %>
<%Iterator data = (Iterator)request.getAttribute("Data");
while (data.hasNext()) {
RequestData RD = (RequestData)data.next();
out.println(RD.getRequestID() );
}%>Oh think I got it...
but one thing I'm not sure is...
If I use "<jsp:useBean id="RD" class="RequestData" />", do I still need "<%@ page import="RequestData" %>"?
I tried without and it gives me error... -
How to upload a file into server using j2ee jsp and servlet with bean?
How to upload a file into server using j2ee jsp and servlet with bean? Please give me the reference or url about how to do that. If related to struts is more suitable.
Anyone help me please!u don't need j2ee and struts to do file uploading. An example is as such
in JSP. u use the <input> file tag like
<input type="file"....>You need a bean to capture the file contents like
class FileUploadObj {
private FormFile srcFile;
private byte[] fileContent;
// all the getter and setter methods
}Then in the servlet, you process the file for uploading
* The following loads the uploaded binary data into a byte Array.
FileUploadObj form = new FileUploadObj();
byte[] byteArr = null;
if (form.signFile != null) {
int filesize = form.srcFile.getFileSize();
byteArr = new byte[filesize];
ByteArrayInputStream bytein = new ByteArrayInputStream (form.srcFile.getFileData());
bytein.read(byteArr);
bytein.close();
form.setFileContent(byteArr);
// Write file content using Writer class into the destination file in the server.
... -
Urgent: problem with sharing HttpSession object between Jsp and servlets.
Hi,
We are using weblogic 6.0 sp2.
I m setting a particular object in session in a servlet using
session.setAttribute() but when i try to retrieve that object using
session.getAttribute() in a jsp page the value of that object is null. Is
there any way to configure HttpSession in weblogic so that jsps and servlet
can share the same session? Or any workaround for this problem.
Any help in this regard is appreciated.
Thanks
-Shree
Just a guess, but it sounds like you have cookies turned off and are not
using encodeURL. Try enabling cookies and see if that solves the problem.
Also, it is generally good practice to use encodeURL to protect yourself
from users who disable session cookies.
Here's how we use encodeURL in our Servlets:
gotoPage("/jsp/someJSP.jsp");
private void gotoPage( String address,
HttpServletRequest request,
HttpServletResponse response )
throws ServletException, IOException
RequestDispatcher dispatcher =
etServletContext().getRequestDispatcher( response.encodeURL( address ));
dispatcher.forward( request, response );
"Shree Unde" <[email protected]> wrote in message
news:[email protected]..
> Hi,
> We are using weblogic 6.0 sp2.
> I m setting a particular object in session in a servlet using
> session.setAttribute() but when i try to retrieve that object using
> session.getAttribute() in a jsp page the value of that object is null. Is
> there any way to configure HttpSession in weblogic so that jsps and
servlet
> can share the same session? Or any workaround for this problem.
> Any help in this regard is appreciated.
> Thanks
> -Shree
>
>
-
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). -
A customer login's to my website using Enterprise login. I am supposed to have a link on my website to this other website(that also uses our Enterprise login details but hosted by other vendor/company on their server), and when I click this link the customes should automatically get logged in to this other website and get a welcome page(instead of login page).
Below are the sequence of steps that the other website wants me to perform to get to his welcome page(i.e bypass his login page).
FYI, I am planning to build a jsp page with a link to this other website. Can some body tell me how should I build the application(i.e) how jsp and servlets be build to interact to perform these operations. Any hep is greatly appreciated.
1.When a user clicks on to other website link(available on my website), the browser generates an HTTP GET request to the Other website's session servlet. User's name is one of the parameters of this request.
2.Other website receives the HTTP request and generates a unique session identifier for this user. An HTTP response to the end-user is then sent. The user's name and the session identifier are passed back as parameters in the redirect URL.
3.The browser sends the HTTP request (GET) to the Verification Service that was specified in the redirect message. The parameters (user name and/or session id) will be passed as URL parameters.
4.The Verification Service(of other website) authenticates the user. A redirect URL to it's sigon servlet(with parameter's User id and key) is then sent back to the user's browser.
5.The end-user's browser will perform the redirect (performing an HTTP get operation to Other website's signon servlet with the username and the digest key).
6.The other website will check if the parameter's passed is the same as the one passed earlier, if the user is who he says he is then he is redirected to the main page of the application.
7.The browser will then redirect the user to Other website's main page (welcome.jsp).
There seems's to be many calls to this other website that needs to be performed behind the scenes once a user clicks the link on my website.
Please suggest and help me out.........
Edited by: 836726 on Feb 21, 2011 3:41 PMWhy are you trying to build a whole federated single sign on framework from scratch when you can just use/buy an existing and proven solution instead? There are a lot of security implication and trust issues involved for this so unless you already understand all of those I'd advise you not to re-invent the wheel. There are a lot of products available that do this. Try searching for '<vendor name> Access Manager' or OpenSSO.
-
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 -
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 -
JSP and Servlets? What's the difference?
I've got this book, and it's mixing servlet with jsp and then jsp with servlet. Can we just use one and still make a web application? What is the difference between the both? Can anyone give me a basic idea behind these 2 J2ee technologies.
hi,
Both use server-side Java to dynamically generate web pages. The source code to a JSP looks like HTML, with Java embedded inside
(a) normal HTML tags, (b) JSP tags like <jsp:include>, (c) custom tags, (d) scriptlets (Java code surrounded with <% and %>).
The source code to a servlet looks like Java, with HTML embedded in out.print(...) statements. Both use the Servlet API to communicate with the web server and the client. In fact, a JSP gets compiled into a servlet, so they're almost identical in terms of expressive power. The choice is, whether you're more comfortable coding your pages in Java or in JSP-style HTML; and since you can call a JSP from a Servlet and vice versa, you don't have to make an either-or decision.
Karthick PalaniChamy -
Load balancing for JSPs and servlets
Hi:
I am using IIS as the proxy server, with the WLS plug-in, to a WLS
cluster. This provides round robin load balancing just fine. Will it
provide weight based load balancing if I set 'weblogic.system.weight'
differently on each server, or is that not relevant for clustering JSPs
and servlets?
Sincerely,
Ashish
Currently the plugins ( for NES, IIS and Apache) just use the round robin
algorithm. the property
weblogic.system.weight is used only be weblogic's replica aware clusterable
RMI/EJB stubs.
To use this property for your JSP/Servlet load balancing you have to use
weblogic server as proxy fron-ending your weblogic cluster.
--Viresh Garg
Ashish Vimal wrote:
> Hi:
> I am using IIS as the proxy server, with the WLS plug-in, to a WLS
> cluster. This provides round robin load balancing just fine. Will it
> provide weight based load balancing if I set 'weblogic.system.weight'
> differently on each server, or is that not relevant for clustering JSPs
> and servlets?
> Sincerely,
> Ashish
Maybe you are looking for
-
Problem in creation of target with the generated target message
Hi, Im doing File-to-File content conversion scenario. Im able to see successful message in SXMB_MONI. Target message also created (Request Message Mapping) according the requirement. Im using lastfieldOptional option in source content conversion.
-
Is there a way to open page with a new Tabular Form row?
Hi All, I have a (non-manual) Tabular Form that works great. My requirement is to have the new page to open with a new row already added. I tried onLoad="onLoadProcess()"; <script language="JavaScript" type="text/javascript"> function
-
Why do some black-and-white photos disappear in Mac Preview and Safari?
I sent a PDF to a colleague recently only to discover that he uses Mac Preview to view PDFs and not Adobe Reader. The unfortunate part is that, although full-color photos all appeared, small black-and-whites were inconsistent: some appeared and other
-
How to connect iphone to Pioneer receiver
Tryng to connect my iphone to watch videos on our Pioneer Receiver. Can get sound but no picture using the HDMI cable. Receiver is a VSX-23TXH and says it is iphone compatible.
-
Hi all, My question is : How to know the purchase orders which are open , that is the purchase orders which are not invoiced or which does not have entry in invoice tables. Is there any flag in PO to know whether it is invoiced or not? Regards, Sande