payal sharma

Ranch Hand
+ Follow
since Oct 04, 2000
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by payal sharma

Dear java guru's
I have got jsp page A.jsp.User select few option and this jsp calls
B.servlet this takes user input and pass to
C.bean which returns vector to B.servlet
This servlet put vector in session and dispatch to new jsp
D.jsp which calls
E.jsp in it for Image generation.
This E.jsp retrieve vector from session and generate a image and reurn to D.jsp
Now my problem is that session in B.servlet and D.jsp are same but a new session in created in E.jsp so image is null as it could get data from vector which is null.
I put System.out.println(session.getId()) in each servlet and jsp so to get thier ID's.
This is working fine in my system with Tomcat 3.2 but on web the new session is created for E.jsp
I am calling E.jsp like this
<img src=<%=response.encodeURL("/iscap/report/jspChart.jsp")%> alt="generation image" width="400" height="350" border="1">
I am making page session=true in each jsp and also puttting request.getSession(false);
but still E.jsp is getting new session.I tried eliminating each one and made all combination that could be possible but not effect.
How Can I solve this problem on the web where I have to load this?
Do I have to make setting in context .
payal sharma
20 years ago
JSP
Dear java guru's
I was opening a url to a page like this.
url = new URL("http://www.webappcabaret.com/abc/report/successmail.jsp");
try {
in = new BufferedInputStream( url.openStream() );
} catch ( IOException e ) {
System.out.println( "Couldn't retrieve data from url!" );
}
But it is giving exception
So when I ask the provider about this they just said
"You CANNOT open a webappcabaret from within webappcabaret"
Is there any other way to do this?
Payal
20 years ago
Dear sonara,
If you are using servlets you can use
getServletContext().getRealPath("/WEB-INF/"+"student.xml");
if you are using jsp use
application.getRealPath("/WEB-INF/student.xml");

payal
Thanks Parama guru,
Links provided by you are really informative. I could write and read a xml file very easily with this package.
Payal sharma
Thanks Parama guru,
Your code help me lot to use xtags library in my example. In future for learning java and xml what I should learn. These are lot of packages in market as xerces,xalan,dom,jaxp from apache now sun in jdk1.4 beta had included sax and dom library.Where these are best used? Any idea
Payal sharma
One more thing I want to tell I am using jsp and servlet for inserting username,subject,message.
payal sharma
Suppose I have xml like this

Then I want to create a xsl which display only subject as hyperlink . when clicked this take the value of that message id and display message.
I am new to xml and I want to know whether I should use xsl or use parser and dom with jsp.
When a new record is entered then it should take the last value of messageID from xml file and and increment it for new one.
It is a type of guestbook.
I have downloaded xerces and running its examples.
But I want to know what I follow to complete this small task.
thanks in advance
payal sharma
Thanks Mapraputa
I also want to ask what is server side tranformation and my question-->
I have downloaded the xerces package.But in the above xml input example given by our rancher , class SaxReader and XmlWriter are not avaliable there in the API.How can I run the above example?
Payal sharma
Thanks Mapraputa
I also want to ask what is server side tranformation and mu question-->
I have downloaded the xerces package.But in the above xml input example given by our rancher , class SaxReader and XmlWriter are not avaliable there in the API.How can I run the above example?
Payal sharma
I have downloaded the xerces package.But in the above example given by our rancher the class SaxReader and XmlWriter are not avaliable there in the API.How can I run the above example?
One more thing is that I also tried this in IE5.5
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform">
<xsl:template match="/">
<TABLE>
<xsl:for-each select="//name">
<xsl:sort order="ascending" select="."/>
<TR><TH><xsl:value-of select="."/></TH></TR>
</xsl:for-each>
</TABLE>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="a.xsl"?>
<xslTutorial>
<name>John</name>
<name>Josua</name>
<name>Charles</name>
<name>Alice</name>
<name>Martha</name>
<name>George</name>
</xslTutorial>
But nothing is visible on the screen but in view source I could see this xml file.
Please help
payal sharma
Dear java guru's
Need help with web.xml and .war file.
I am using tomcat 3.2. I made change in my server.xml in conf directory of tomcat by adding
following lines.
<Context path="/assess"
docBase="assess"
crossContext="false"
debug="0"
reloadable="true"
trusted="false" >
</Context>
So now my context name is "assess".In this contest I created a package name "login".The structure of
it is like this
assess -->
login-->
*.jsp
Web-inf -->
web.xml
classes-->
login--->
*.class
The web.xml is the default xml I copied from tomcat conf directory and put it in web-inf
And some it is like this
<load-on-startup> -2147483646 </load-on-startup> </servlet> <servlet-mapping>
<servlet-name> invoker </servlet-name> <url-pattern> /servlet/*
</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name> jsp
</servlet-name> <url-pattern> *.jsp </url-pattern> </servlet-mapping>
<session-config> <session-timeout> 30 </session-timeout> </session-config>
Now for making .war file I run the following command.
from my contest assess> jar -cvf login.war *
then I delete all file from my context except login.war
Now when I run the following url http://localhost:8080/assess/login/index.jsp
I am getting this error
Error: 500
Location: /assess/login/index.jsp
Internal Servlet Error:
javax.servlet.ServletException: login/Retry
at org.apache.jasper.servlet.JspServlet.service(Compiled Code)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)

Root cause:
java.lang.NoClassDefFoundError: login/Retry
at
login._0002flogin_0002findex_0002ejspindex_jsp_0._jspService(_0002flogin_0002findex_0002ejs
pindex_jsp_0.java:64)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
at org.apache.jasper.servlet.JspServlet.service(Compiled Code)
login.Retry is first bean used in index.jsp
Now Help me where I am lagging
thanks in advance
payal sharma
20 years ago
Thanks david for pointing the connection and statement problem which would be return to connection pool before getting result.
cameron, Session problem is very strange to me.If I enter 10 reports then in 2 I got this problem of values in session get lost.So user complain that his values are null sometimes.
I am giving sample code of one of my process which set values
<%@ page import="java.util.*,report.Report1"%>
<jsp:useBean id="report1" scope="session" class="report.Report1" > </jsp:useBean>
<jsp:setProperty name="report1" property="reset" value=" " />
<jsp:setProperty name="report1" property="*"/>
<% if(session.getAttribute("logon.isDone")==null){
response.sendRedirect("/report/relogin.jsp");}%>

<% String sitename=""; %>
<% sitename=(String)session.getAttribute("logon.isDone"); %>
<% if(sitename.equalsIgnoreCase("Bombay")) {%>
<% sitename="mumbai"; %>
<% } %>
<% String entersite=""; %>
<% entersite=report1.getSite(); %>
<% if(entersite.equals(sitename)) { %>
<% if (report1.validate()) { %>
<jsp:forward page="/report/report2.jsp"/>
<% } else { %>
<jsp:forward page="/report/report1.jsp"/>
<% } %>
<% } else { %>
<jsp:forward page="/report/please.jsp"/>
<% } %>

detail of my app is
I am making an online reporting site .I am asking user to fill 3 page
report one by one .I am keeping all value in session.Here Also checking at
every servlet and jsp whether user is valid or not as guest can see the
report but can not fill the report.
A valid user can upload database and only administrator can download
database files.
There are also other simple report to be filled on the site.
These all report are to filled fortnightly and if user miss then he should be
emailed from the server .
I had made this in servlets,jsp,javabeans(with set and get methods only)
Problem I always facing that my session value get lost very easly and
user is sent back to login page . An example
I am using tomcat 3.1
In my login page my session value get lost frequently.I am using
session.setAttribute("logon.isDone", name); in servlets and In every jsp's
I am checking as
I have taken all initiative to build this site.I am the only programmer
working here so all decision is up to me.

thanks in advance
payal sharma
20 years ago
David
Please explain in detail what you mean by business object.
Could you please explain in detail if possible.
2)
I am also getting problems with session
I am using tomcat 3.1
In my login page my session value get lost frequently.I am using session.setAttribute("logon.isDone", name); in servlets and In every jsp's I am checking as <% if(session.getAttribute("logon.isDone")==null){
response.sendRedirect("/iscap/report/relogin.jsp");}%>
The value get lost in a very short time so user is sent to relogin .

payal sharma
20 years ago
My problem is
I am making an online reporting site .I am asking user to fill 3 page
report one by one .I am keeping all value in session.Here Also checking at
every servlet and jsp whether user is valid or not as guest can see the
report but can not fill the report.
A valid user can upload database and only administrator can download
database files.
There are also other simple report to be filled on the site.
These all report are to filled fortnightly and if user miss then he should be
emailed from the server .
I had made this in servlets,jsp,javabeans(with set and get methods only)
Problem I always facing that my session value get lost very easly and
user is sent back to login page . An example
I am using tomcat 3.1
In my login page my session value get lost frequently.I am using
session.setAttribute("logon.isDone", name); in servlets and In every jsp's
I am checking as <% if(session.getAttribute("logon.isDone")==null){<br /> response.sendRedirect("/report/relogin.jsp");}%>
I have taken all initiative to build this site.I am the only programmer
working here so all decision is up to me.
Now my question is whether by using EJB,JMS I can make it more
effective.At present I am learning ejb and site has got facility to use
EJB,JMS,XML.My session problem could be solved.
thanks in advance
payal sharma
Got the answer.I will put the resultset in to session and open the jsp page which will take the resultset from the session.
payal sharma
20 years ago