About jsp visit servlet in .war
I use tomcat to develop web app
there is a posttopic.jsp in root folder and a servlet TopicPost in root/web-inf/classes;
web.xml's content that in web-inf is:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Welcome to Tomcat</display-name>
<description>
Welcome to Tomcat
</description>
<servlet>
<servlet-name>TopicPost</servlet-name>
<servlet-class>TopicPost</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TopicPost</servlet-name>
<url-pattern>/TopicPost</url-pattern>
</servlet-mapping>
</web-app>
when I use post in posttopic.jsp to send parameter to TopicPost,that's ok;
but when I pack them to test.war;problem is coming;
posttopic.jsp cant find TopicPost;
I know maybe should correct "<servlet-mapping>" and "<a href=/TopicPost>post</a>";
but I dont know how to do;
thanks for helping me!
Stop cross posting! http://forum.java.sun.com/thread.jsp?forum=45&thread=565440&tstart=0&trange=15
Similar Messages
-
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 -
How to cluster the war file conatining the jsp and servlet by using wl6.0sp1?
There three wlsever6.0 sp1.
One is admin server and doesn't join the cluster.
Two servers are cluster server.
I use the admin console to deploy the war file and the war file conatains
the jsp and servlet.
How to config the one of the clustered servers as the primary one, so that
the client can request the jsp?
If the one of the clustered servers is closed, can the client be redirected
to another clustered server?
Does the proxy server need to be exist?
There three wlsever6.0 sp1.
One is admin server and doesn't join the cluster.
Two servers are cluster server.
I use the admin console to deploy the war file and the war file conatains
the jsp and servlet.
How to config the one of the clustered servers as the primary one, so that
the client can request the jsp?
If the one of the clustered servers is closed, can the client be redirected
to another clustered server?
Does the proxy server need to be exist?
-
Hi friends,
[please forgive me if i am posting this in the wrong forum, all seems same to a fresher]
Now, to my problem..i need a suggestion, a way or a method to implement the following!
I am supposed to create a servlet that reads data from oracle database. Once i retrive the data (for example: 6 rows of a table having 4 attributes), i am supposed to pass this data to a JSP page where the data has to be formatted and displayed properly. If i call the same servlet from a different JSP, i should be able to access the data in that JSP and format it in a different way. How do i pass the data to JSP? what method i can use to achieve this task?
Note: I already know about PrintWriter pw = response.getWriter(); and then printing the formated HTML page..but i want to keep the formatting to JSP part and send only the data part that i can access in JSP
Thanks in adavancearun_ramachandran wrote:
[please forgive me if i am posting this in the wrong forum, all seems same to a fresher]Then you should learn to be more observant - after all, we have JSP and Servlet fora, further down the list. :)
I am supposed to create a servlet that reads data from oracle database. Once i retrive the data (for example: 6 rows of a table having 4 attributes), i am supposed to pass this data to a JSP page where the data has to be formatted and displayed properly. If i call the same servlet from a different JSP, i should be able to access the data in that JSP and format it in a different way. How do i pass the data to JSP? what method i can use to achieve this task? You can store the data in your session object. You can even use JavaBeans and the jsp:usebean tag.
[http://java.sun.com/products/jsp/tags/11/syntaxref11.fm14.html]
Note: I already know about PrintWriter pw = response.getWriter(); and then printing the formated HTML page..but i want to keep the formatting to JSP part and send only the data part that i can access in JSPA wise approach - I wish more prople woiuld be as thoughtful. -
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.
... -
Deploying web applications - jsp generated servlet's may be written over the same file!
Hi, I have made the following test:
Created two simple web applications with one jsp page, and deployed it
with different context names, in weblogic.properties I have:
weblogic.httpd.webApp.weirdApp=\java\weblogic\myserver\weirdApp.war
weblogic.httpd.webApp.weirdAppTwo=\java\weblogic\myserver\weirdAppTwo.war
(Note: I have used two diferent war files, because I have a different
implementation of the jsp page, I could have used the same warfile, and
deployed it two times with the same different names I have used)
These two applications have a jsp named myHomePage.jsp
If I access the first application, like this:
http://myServer:7001/weirdApp/myHomePage.jsp
the servlet for myHomePage is created in
/java/weblogic/myserver/WEB-INF/_tmp_war/jsp_servlet/_myhomepage.class
If I access the second application, like this:
http://myServer:7001/weirdAppTwo/myHomePage.jsp
the servlet for myHomePage is created in
/java/weblogic/myserver/WEB-INF/_tmp_war/jsp_servlet/_myhomepage.class
It overrides the first one! Because the servlets are keeped in memory by
a different class loader this seems to not affect the other servlet, but
I am wondering what may happen with this strange beaver from weblogic!
Bruno Antunes,
Java Software Engineer
email: mailto:[email protected]
Phone: +351.21.7994200
Fax : +351.21.7994242
WhatEverSoft - Java Center
Centro de Competencia Java
Praca de Alvalade, 6 - Piso 4
1700-036 Lisboa - Portugal
URL: http://www.whatevernet.com
****************** Internet Mail Footer ****************************
A presente mensagem pode conter Informação considerada Confidencial.
Se o receptor desta mensagem não for o destinatário indicado, fica
expressamente proibido de copiar ou endereçar a mensagem a terceiros.
Em tal situação, o receptor deverá destruir a presente mensagem e
por gentileza informar o emissor de tal facto.
Privileged or Confidential Information may be contained in this
message. If you are not the addressee indicated in this message,
you may not copy or deliver this message to anyone. In such case,
you should destroy this message and kindly notify the sender by
reply email.I have a separate java class that gets my data and returns a Result object. Do you mean java.sql.ResultSet?
In my main servlet I do the following:
request.setAttribute("supporttracker",
supporttracker.findsupporttracker(monthYear));
and then in my JSP I can iterate through the Result
like the following with no problems:
<c:forEach var="supporttracker" begin="0"
items="${supporttracker.rows}" varStatus="counter">
My problem is that I can only iterate through this
once in the page whereas I have no problem doing
multiple forEach loops through other types of
lists/collections such as an ArrayList. Right, because a ResultSet is a database cursor and doesn't act the same way that an ArrayList does. It's more like an InputStream - once you read it, you close it. If you want to re-read it, you have to re-initialize it again.
Iterators behave that way, too. Once you walk through them, you have to re-initialize them.
I've looked
on the web and in a couple of books, I first thought
it may be scope or some attribute in forEach that I
was missing but I'm stumped. It seems like it's
because the pointer to the result set is at the end
of the result set when trying the second iteration,
but I thought by using the begin="0" would put the
pointer at the first row again, on my second
iteration I'm getting no rows/data outputed.
Please help and thanks in advance!The better thing to do is for your method to return a List of objects, one per row, that represent what the ResultSet returns. Have that method iterate through the ResultSet, loading the rows into the List, and close it before you leave in a finally block. A database cursor is a scarce resource, so it's a good idea to close it as soon as you can.
% -
Hi,
Can anyone show me how to convert my jsp to servlet. Then, from servlet to classes. Thanks.
cheers,well, jsp pages are converted at run-time to servlets, e.g. if you are using tomcat as jsp engine, you will find the servlet java files somewhere under $TOMCAT_HOME/work/localhost. you can compile these java files to class files.
PS: There is a forum in here for JSP, and I would recommend that you post your questions there in the JSP forum (this one is about databases) -
Re: capturing screen resolution in JSP or servlet
"Mike Tickle" <[email protected]> wrote ...
> Is it possible to capture screen resolution in JSP or a Servlet? I can
> currently do it in JavaScript and write the result in to a cookie that a
> servlet can read, but is there a better solution.
> Is it possible to get the time zone of a visitor using JSP or servlets?
> Can JSP or servlets determine if a visitor has scrolled the page to view
all
> of it?
You seem to be very confused about what servlets and JSPs are. These are
things that run on the server and generate HTML. They can't possibly know
if a user has scrolled the page, because the user hasn't seen the page yet
when they are run. If they tried to read screen resolution, they'd get the
screen resultion for the graphics subsystem on the server, or an exception
if one isn't available (eg, there is no X display set).
For these kinds of client interaction tasks, JavaScript is probably still
your best option.
Chris Smith
Hey all you non-ASP programmers, here's the deal. Microsoft has a Browser
Capabilities component and they have defined a special way for you to
populate a specially named cookie on the client side that will then allow
the component to pick up what you sent it. In the ASP script, you then use
the component. Behind the scenes, it works exactly like what you guys
imagine, but Microsoft provides the format for sending the information and
the parsing.
The client side script does need to be written to include the information
you want, but it would typically be written once and hidden by the lead
programmer in a common include file where most programmers never had to
think about it and thus might think it happened automatically.
If you're really curious, here's an MSDN link to the details:
http://msdn.microsoft.com/library/psdk/iisref/comp1vol.htm.
Rick Joi, former ASP developer
[email protected]
www.rickanddonna.com/ips
"Chris Smith" <[email protected]> wrote in message
news:[email protected]...
> "Mike Tickle" <[email protected]> wrote ...
> > > You seem to be very confused about what servlets and JSPs are.
> >
> > I am quite familiar with servlets as I have been using them for 6 months
> as
> > part of a uni project. I had the presentation yesterday and the
moderator
> > asked why I used JavaScript to determine time zone and screen res. I
said
> > JSP/Servlets can not do it as they are server side and he seemed
confused.
>
> Okay. Apologies if I was condescending. Such things happen in newsgroups
> where I have no idea what your background is.
>
> > Apparently ASP can do it. So against my better judgement I thought I
> would
> > ask in case I was wrong.
>
> I'm surprised if ASP can do it... I can't imagine how that occurs. I
agree
> with Jeff, especially after reading the URL he provided; it appears the
> moderator was just plain wrong, or that there are only very non-portable
> solutions for IE only.
>
> > I currently write the time zone and screen resolution in to a session
> cookie
> > so that it can be read every time the servlet is run. Is there a better
> way
> > than this?
>
> Seems to me like the best way to me.
>
> Chris Smith
>
>
>
-
Should I use JSP,JSTL,SERVLETs without a framework?
Hi Guys
I'm making a multi player browser game. The game will have some forms to setup data into the database and the player will be able to check other players data.
I will load the players data from the DB into a Bean when the application starts and then just get the other players information from DB when and if asked.
I'm planing on doing it as MVC2 using JSP, JSTL, SERVLETs, BEANs
Would you recommend me to use Struts for example? should I just use it without any framework?
I read a lot about Struts and can't really see what it can bring to an application like mine. I can use the i18n easily with JSTL and for few validation of forms I don't know if it's worth it.
What do you think? (-:
Thanks in advance
(-:If your going to use MVC2 then I would use a framework, otherwise where are you going to get your MVC from, were you planning on writing an MVC yourself?
-
Oracle 10g XE in tomcat 5.5 through JSP or Servlet
Hello iam very new user of tomcat,oracle 10g .Will you please guide how to set environment variables and any other modifications to be done to run a JSP or Servlet including JDBC(oracle 10gXE) connection in tomcat5.5 for windows Xp.
Please tell me in detail........................................I am sure that one can set up SELinux 'properly'.
Everyone I talk to about SELinux tells me that it has become more detailed and much more 'secure' in that past years, and that probably explains why Oracle worked easily in FC3 and not so easily now. The added power also requires added configuration, which some have described to me as 'somewhat more involved than sendmail.cf'
The documentation is at http://www.nsa.gov/selinux/ for those who wish to learn about the configuration capabilities. I'm sure that Google will also provide tutorials. -
Help,JSP and SERVLETS!
hello:
i've downloaded ECLIPSE 3.2,TOMCAT 5.5 .
i tried to build simples examples o servlets but i failed could you please tell me how to proceed?i'm new at this plus i've got a project to do with all this so plz can you give some links to go,i tried but no links was clear.
i've got to give to my professor an examples executed (servlets,jsp)
thank youHISSO wrote:
i wil give up on talking about stupid gossip
you must act professional and i you can't help it's ok
so plz i juste want help
i'm so busy finishing my studies
when it comes to talk about development with tomcat and eclipse together i'm new so i need some advices,so plz let's be serious!
i'm working hard to finish my project!Try to communicate less like a monkey with electrodes attached to it's genitals. This means stop using words like "plz" and write "please" instead.
If you want specific help with a specific problem then you should ask a specific question. "help, JSP and SERVLETS" is not a specific question. And you should also note that if your specific question is about Tomcat specifically or Eclipse specifically then you are in the wrong place to begin with.
So do you want to try again? -
Pls help
I am studing about JSP
if we write code in scriptlet tag i.e. < % %>
code goes into service() method of servlet ,which is automatically created by jsp Engine
if we write code in declaration tag i.e. <%! %>
code goes outside service() method of servlet ,which is automatically
created by jsp Engine means at class level.
is their any tag so that jsp code goes into init() method of servlet ,which is automatically created by jsp Engine for that jspsimple and straight u need to code init() method using <%! %> tags.. but in case JSP it has to be jspInit() method.
The jspInit method is called by the container once and only once for a servlet instance. As you might guess from its name it is used to do initial once only setup such as getting resources and initialising variables that are used in the JSP page. The jspInit method can be overridden within a JSP page with code like the following.
<%!
public void jspInit(){
/*getServletConfig is inherited */
ServletConfig config= getServletConfig();
%>REF : http://www.examulator.com/moodle/mod/resource/view.php?id=380
REGARDS,
RaHuL -
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 -
SQLJ JSP and SERVLETS which Environment?
Hello,
I am attempting to run the samples on Chapter 5 of the
following documents with partial success.
http://technet.oracle.com/docs/products/oracle8i/doc_library/817_
doc/java.817/a83726/oraext2.htm
http://download-west.oracle.com/otndoc/oracle9i/901_doc/java.901/
a90208/oraext.htm#1015820
1. Do I need the Apache+Jserv environment to run SQLJ and JSP?
2. What do I need to do run SQLJ on oc4j if possible?
3. I dont know how to load(?) and/or run this .sqljsp file.
<%@ page language="sqlj"
import="sqlj.runtime.ref.DefaultContext,oracle.sqlj.runtime.Oracl
e" %>
<HTML>
<HEAD> <TITLE> The SQLJQuery JSP </TITLE> </HEAD>
<BODY BGCOLOR="white">
<% String empno = request.getParameter("empno");
if (empno != null) { %>
<H3> Employee # <%=empno %> Details: </H3>
<%= runQuery(empno) %>
<HR><BR>
<% } %>
<B>Enter an employee number:</B>
<FORM METHOD="get">
<INPUT TYPE="text" NAME="empno" SIZE=10>
<INPUT TYPE="submit" VALUE="Ask Oracle");
</FORM>
</BODY>
</HTML>
<%!
private String runQuery(String empno) throws
java.sql.SQLException {
DefaultContext dctx = null;
String ename = null; double sal = 0.0; String hireDate = null;
StringBuffer sb = new StringBuffer();
try {
dctx = Oracle.getConnection("jdbc:oracle:oci8:@", "scott",
"tiger");
#sql [dctx] {
select ename, sal, TO_CHAR(hiredate,'DD-MON-YYYY')
INTO :ename, :sal, :hireDate
FROM scott.emp WHERE UPPER(empno) = UPPER(:empno)
sb.append("<BLOCKQUOTE><BIG><B><PRE>\n");
sb.append("Name : " + ename + "\n");
sb.append("Salary : " + sal + "\n");
sb.append("Date hired : " + hireDate);
sb.append("</PRE></B></BIG></BLOCKQUOTE>");
} catch (java.sql.SQLException e) {
sb.append("<P> SQL error: <PRE> " + e + " </PRE> </P>\n");
} finally {
if (dctx!= null) dctx.close();
return sb.toString();
%>
I named above file as test2.sqljsp then I tried these procedures:
a) $ ojspc test2.sqljsp --these created all the files
b) $ loadjava -u -v scott/tiger _test2.class -resolve
this generated:
initialization complete
loading : _test2
creating : _test2
resolver :
resolving: _test2
errors : _test2
ORA-29521: referenced name test2$_jsp_StaticText could not
be found
ORA-29521: referenced name test2SJProfileKeys could not be
found loadjava: 2 errors
c) listed the directory and both these files are there but it
cannot resolve or find it?
d) I recall reading something about publishjsp command but I have
to establish a session shell with OSE? this part is very
confusing and am not sure what to do here.
e) not sure if i need to publish the loaded class (create a
procedure? so it can be known to the rest of plsql?)
A step by step procedure is very much appreciated. fyi.. I
have Oracle 8.1.7, + oc4j, I can run sqlj from command line
and class files generated I can run. I can also run JSP and
servlets on the oc4j accessing the database. It is this SQLJ
that throws me off balance. If you include Jdeveloper steps
ro run SQLJ thats also welcome.
Thanks in advance for kind responses posted.In many Model-View-Controller web applications implemented using J2EE, servlets are as controllers to direct the flow between the model and view. While servlets can output HTML code directly, it is much better to use JSPs for the most part. JSPs contain HTML and possibly Java scriptlets. The J2EE container will typically compile JSPs into servlets. While you could use a JSP as a controller, there are drawbacks to that approach. To minimize the amount of Java code in your JSPs, you can either use the tags provided by the JSP spec or use tag libraries written by someone else or yourself. See the JSTL for one such example.
Also see:
http://wiki.java.net/bin/preview/Javapedia/MVC
http://wiki.java.net/bin/view/Javapedia/JavaServerPages -
How to track the same session using both jsp and servlets
Hello, guys:
"how to use jsp and servlet to track the same session",
it seems to me my logoff.jsp never realize the session I established in my servlets.
Here is how I set my session in my servlets:
" HttpSession session = req.getSession(true);
session.setAttribute("userid",suserid);"
Here is how I invalidate my session in my logoff.jsp
" <%@ page language= "java" %>
<%@ page import="javax.servlet.http.HttpSession" %>
<%@ page session="false"%>
Our Session id is : <%= session.getId() %>
<% session.removeAttribute("userid");
session.invalidate();
%>
Our Session id is : <%= session.getId() %>"
but when I try to logoff using the logoff.jsp
I always get following error message.
"/home/jiao/jsp_webserver/tomcat/work/Standalone/localhost/syllabus/htmls/logoff_jsp.java:50: cannot resolve symbol
symbol : variable session
location: class org.apache.jsp.logoff_jsp
out.print( session.getId() );"
T.I.A.
[Edited by: jiveadmin on Jun 18, 2003 10:32 AM]
[Edited by: jiveadmin on Jun 18, 2003 10:33 AM]So,
<%@ page session="false"%>
That means the jsp never instantiates the build in session object.
<%@ page session="true"%>
means jsp will instantiates a session object if there are no existing ones
how about I just delete the line,
does that mean the jsp will find the existing session object for me?
So I can do something like
Our Session id is : <%= session.getId() %>
<% session.removeAttribute("userid");
session.invalidate();
%>
directly.
T.I.A.
Maybe you are looking for
-
Material Order status report - Closed PO's
Hi, In my "Material Order status report" I got closed PO's. I dont want any closed PO's to be displayed in my report. How to set this? Regards P.Ramprakash
-
Error on saving a .rpt in the Enterprise-Folder
Hello, i have a special problem in saving a Crystal Report in the Enterprise-Folder of the BO-Server. The reports is based on xml-files and has serveral dynamic parameters, which are used in the Selection Formulars for the Record Selection. On creati
-
Hello- I am trying to play video podcasts on my itunes. So far no success. The video starts but is nothing but scrambled colors (mostly purple). audio is fine. Anyone can help?
-
Importing best practices baseline package (IT) ECC 6.0
Hello I hope is the right forum, i've a sap release ECC 6.00 with stack abap 14. In this release i have to install the preconfigured smartforms that now are called best practices baseline package. These pacakges are localized and mine is for Italy: S
-
Hi keep getting a faild dil. from postmaster from e-mails I did not send so now Iam blocked from sending e-mails and can,t contact sup. by email. some time a hundred a day