Converting forms6i fmb to jsp pages
Hi
Is there is any tool to convert forms6i fmbs to jsp pages
Please check out http://otn.oracle.com/products/forms/htdocs/FormsJavaSOD.html which should help.
Regards
Grant Ronald
Application Tools PM
Similar Messages
-
How to convert this Servlet into JSP
I am trying to convert this Servlet into JSP page.
How do I go about doing this?
Thanks.
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.text.*;
/** Shows all items currently in ShoppingCart. Clients
* have their own session that keeps track of which
* ShoppingCart is theirs. If this is their first visit
* to the order page, a new shopping cart is created.
* Usually, people come to this page by way of a page
* showing catalog entries, so this page adds an additional
* item to the shopping cart. But users can also
* bookmark this page, access it from their history list,
* or be sent back to it by clicking on the "Update Order"
* button after changing the number of items ordered.
* <P>
* Taken from Core Servlets and JavaServer Pages 2nd Edition
* from Prentice Hall and Sun Microsystems Press,
* http://www.coreservlets.com/.
* © 2003 Marty Hall; may be freely used or adapted.
public class OrderPage extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
HttpSession session = request.getSession();
ShoppingCart cart;
synchronized(session) {
cart = (ShoppingCart)session.getAttribute("shoppingCart");
// New visitors get a fresh shopping cart.
// Previous visitors keep using their existing cart.
if (cart == null) {
cart = new ShoppingCart();
session.setAttribute("shoppingCart", cart);
String itemID = request.getParameter("itemID");
if (itemID != null) {
String numItemsString =
request.getParameter("numItems");
if (numItemsString == null) {
// If request specified an ID but no number,
// then customers came here via an "Add Item to Cart"
// button on a catalog page.
cart.addItem(itemID);
} else {
// If request specified an ID and number, then
// customers came here via an "Update Order" button
// after changing the number of items in order.
// Note that specifying a number of 0 results
// in item being deleted from cart.
int numItems;
try {
numItems = Integer.parseInt(numItemsString);
} catch(NumberFormatException nfe) {
numItems = 1;
cart.setNumOrdered(itemID, numItems);
// Whether or not the customer changed the order, show
// order status.
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String title = "Status of Your Order";
String docType =
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
"Transitional//EN\">\n";
out.println(docType +
"<HTML>\n" +
"<HEAD><TITLE>" + title + "</TITLE></HEAD>\n" +
"<BODY BGCOLOR=\"#FDF5E6\">\n" +
"<H1 ALIGN=\"CENTER\">" + title + "</H1>");
synchronized(session) {
List itemsOrdered = cart.getItemsOrdered();
if (itemsOrdered.size() == 0) {
out.println("<H2><I>No items in your cart...</I></H2>");
} else {
// If there is at least one item in cart, show table
// of items ordered.
out.println
("<TABLE BORDER=1 ALIGN=\"CENTER\">\n" +
"<TR BGCOLOR=\"#FFAD00\">\n" +
" <TH>Item ID<TH>Description\n" +
" <TH>Unit Cost<TH>Number<TH>Total Cost");
ItemOrder order;
// Rounds to two decimal places, inserts dollar
// sign (or other currency symbol), etc., as
// appropriate in current Locale.
NumberFormat formatter =
NumberFormat.getCurrencyInstance();
// For each entry in shopping cart, make
// table row showing ID, description, per-item
// cost, number ordered, and total cost.
// Put number ordered in textfield that user
// can change, with "Update Order" button next
// to it, which resubmits to this same page
// but specifying a different number of items.
for(int i=0; i<itemsOrdered.size(); i++) {
order = (ItemOrder)itemsOrdered.get(i);
out.println
("<TR>\n" +
" <TD>" + order.getItemID() + "\n" +
" <TD>" + order.getShortDescription() + "\n" +
" <TD>" +
formatter.format(order.getUnitCost()) + "\n" +
" <TD>" +
"<FORM>\n" + // Submit to current URL
"<INPUT TYPE=\"HIDDEN\" NAME=\"itemID\"\n" +
" VALUE=\"" + order.getItemID() + "\">\n" +
"<INPUT TYPE=\"TEXT\" NAME=\"numItems\"\n" +
" SIZE=3 VALUE=\"" +
order.getNumItems() + "\">\n" +
"<SMALL>\n" +
"<INPUT TYPE=\"SUBMIT\"\n "+
" VALUE=\"Update Order\">\n" +
"</SMALL>\n" +
"</FORM>\n" +
" <TD>" +
formatter.format(order.getTotalCost()));
String checkoutURL =
response.encodeURL("../Checkout.html");
// "Proceed to Checkout" button below table
out.println
("</TABLE>\n" +
"<FORM ACTION=\"" + checkoutURL + "\">\n" +
"<BIG><CENTER>\n" +
"<INPUT TYPE=\"SUBMIT\"\n" +
" VALUE=\"Proceed to Checkout\">\n" +
"</CENTER></BIG></FORM>");
out.println("</BODY></HTML>");
}Sorry.
actually this is my coding on the bottom.
Pleease disregard my previous coding. I got the different one.
My first approach is using <% %> around the whole doGet method such as:
<%
String[] ids = { "hall001", "hall002" };
setItems(ids);
setTitle("All-Time Best Computer Books");
out.println("<HR>\n</BODY></HTML>");
%>
I am not sure how to break between code between
return;
and
response.setContentType("text/html");
Here is my coding:
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
String[] ids = { "hall001", "hall002" };
setItems(ids);
setTitle("All-Time Best Computer Books");
if (items == null) {
response.sendError(response.SC_NOT_FOUND,
"Missing Items.");
return;
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String docType =
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
"Transitional//EN\">\n";
out.println(docType +
"<HTML>\n" +
"<HEAD><TITLE>" + title + "</TITLE></HEAD>\n" +
"<BODY BGCOLOR=\"#FDF5E6\">\n" +
"<H1 ALIGN=\"CENTER\">" + title + "</H1>");
CatalogItem item;
for(int i=0; i<items.length; i++) {
out.println("<HR>");
item = items;
if (item == null) {
out.println("<FONT COLOR=\"RED\">" +
"Unknown item ID " + itemIDs[i] +
"</FONT>");
} else {
out.println();
String formURL =
"/servlet/coreservlets.OrderPage";
formURL = response.encodeURL(formURL);
out.println
("<FORM ACTION=\"" + formURL + "\">\n" +
"<INPUT TYPE=\"HIDDEN\" NAME=\"itemID\" " +
" VALUE=\"" + item.getItemID() + "\">\n" +
"<H2>" + item.getShortDescription() +
" ($" + item.getCost() + ")</H2>\n" +
item.getLongDescription() + "\n" +
"<P>\n<CENTER>\n" +
"<INPUT TYPE=\"SUBMIT\" " +
"VALUE=\"Add to Shopping Cart\">\n" +
"</CENTER>\n<P>\n</FORM>");
out.println("<HR>\n</BODY></HTML>"); -
How to convert a Jsp page in a Pdf
Hi!
I have a problem. I need to convert the content of a Jsp page in a pdf , clicking a link.
Anybody knows how i can do it?
ByeGoogle for iText.
-
How to convert a .jsp page in to the .txt page with a click of the button
Hi Sir,
Here the main thing is that in order to print a web page(.jsp page) in dotmatrix printer i need to first convert that webpage (.jsp page) in to .txt page.But my doubt is that can you convert a .jsp page in to .txt page with a click of a button so that whatever there in .jsp page has to be completely transferred in to .txt page if so then in that .txt page i need a button when i click it the page need to be send to the printer without using the file menu print option.First i need to know whether it is possible in java?If so please do help me by providing the exact code.If it is not possible in java pls.do provide other option.It is very urgent.Thank U.
Regards,
m.ananthuWe can convert a .JSP page content into a .txt file by using MIME type conversion. In this scenario we cannot provide a button, because its an .txt file (not .JSP).
If you want to print JSP content into a .txt content along with a button to print that page can also be done.
-Chandra -
Converting a class for use in a jsp page.
I was just wondering if it is possible/normal to convert complex(ish) classes to change the output from the system.out, to a return value from a method that is displayed via a jsp page. (I am just beginning, and trying to make the coversion from asp with COM to jsp with beans/servlets and I am not yet fully understanding the technologies, and how you import classes etc - please bear with me!)
first, I made a class that has a method that just returns a string. like:
public String GetAValue()
return "Hello there.";
}and then I made a jsp page that imported the class (test) like:
<%@ page import="Test" %>
<jsp:useBean id="tst" scope="page" class="Test" />
st = tst.GetAValue();
out.println(st);
Which to my delight, worked fine! Then I made another class that retrieved a value from a web service. kind of like...
public String GetAValueFromAWebService(){
return theWebService.GetValueFromWebServiceMethod();
}This class also works good when I just run via "java testit". But when I went to do the same as above ,ie, import the class, do a usebean then do st=tst2.GetValueFromWebServiceMethod(), I could not get it to work at all. This class does lots more tricky stuff then the first one though - it loads its properties from a .properties file via an instance of another class, and imports funky stuff like - import org.uddi4j.* and import java.util.Vector; and more.
Ok, now the question! Is what I am trying to do stupid? If so, how should I do it? If its not stupid, how do I include all the extra import statements on the jsp page (there are about 10)
Wow, sorry about the length of this post. I hope someone can understand my ramblings!
Thanks,
nmoog.Sorry, yeah...
I am actually using the UDDI4J package, and it loads various settings with the
config = Configurator.load(); (a seperate class to load stuff in with)
The Configurator.Load method basically just does:
config.load(new java.io.FileInputStream("samples.prop"));
and then does System.setProperty() with the config.getProperty()
values.
I have a test class when I do "java Test" it runs and in the Main method just instantiates the MyWebService class and does the MyWebService.GetAWebServiceValue() which returns a string.
As I said, this runs fine. But from the JSP code if I do the same thing it gets a NullPointerException.
"java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:389)
at java.util.Properties.setProperty(Properties.java:102)
at java.lang.System.setProperty(System.java:654)
at Configurator.load(Configurator.java:43)"
Why can it load okie-dokey from the test class, but not the jsp page? Any ideas? -
How to convert a JSP page into a PDF file?
I am calculating and generating a bill in JSP?
I want the output JSP page from the server to get converted to a PDF file.
How to do this?
Please help me doing this!Hai CeciNEstPasUnProgrammeur
Actually I didnt mean what you are asking?
I will put it in this way,
I am having a JSP output.
If I save that page in the browser it should get
saved as a PDF File,
This is my problem,As far as I can see, you have two options:
1) Ensure you have some kind of rendering tool installed on the server, render your JSP to that engine, capture the output as an image and transform the image to a PDF. Or a variation on that server-side theme.
2) Take the data you would be/are pushing into a JSP, offer a "download" facility that just takes that data and wraps it into a PDF. Your server then serves out that PDF file.
To save the browser view (your JSP) as a PDF each client machine would need to be set up with some mechanism to capture and save as PDF. You can't control that.
I've had to do something similar in the past. In that case though we had a simplar task of just generating a stored HTML file that we could store in the DB and lock down. Our approach was to use XSLT over the generated XML data structure.
I'd advise you doing the same and generating an XML file and then running an XSLT/FO process over it to generate your PDF file. Don't try to do all the fancy stuff on the client environment, that's an environment you usually have very little control over. -
Convert jsp page into xml or dom for search
Hello everyone,
I have to build an application that searches for message beans in all jsp page. I did it the traditional way, using scanner and string methods. Its working but its not perfect. So i want to convert all my jsp page into xml format and then process them. My jsp pages are quite complicated. I used some jars that convert them into jspx . But its not working. Please help
Thanks in advanceWell its like this.I need to develop a program that reads all the message bean keys.. We have lots of struts webapps. All messages in the jsp pages have been externalised and internationalised. Now i have to build a program that given a webapp path prints out all the message bean keys used in the webapp. I have developed the program using the Plexus Directory scanner to filter all the jsp pages and java util Scanner to read line by line and used String functions to search for keys.
Now thats not the best soultion. The best way, imo, is to cinvert the jsp into xml pages and then we can parse the xml pages easily. The' problem is to find a way to convert the jsp pages(jstl +javascript) into xml.
Can you help me out?
Thanks -
How to convert text values acceses from jsp page into an xml file?
/* this is the jsp page which i want to convert it into an xml file
please help me , i thank in advance*/
<html>
<head>
<title> xml test</title>
</head>
<body>
<form action="testxml2.jsp" method = post>
<ul>
<li>
<ul>NAME:
<br>
<li>First Name:<INPUT NAME="firstName" TYPE=text SIZE=20><br>
<li>Middle Name:<INPUT NAME="middlename" TYPE=text SIZE=20><br>
<li>Last Name:<INPUT NAME="lastname" TYPE=text SIZE=20><br>
<li>t Name:<INPUT NAME="tname" TYPE=text SIZE=20><br>
</ul>
<br>
<ul>Role:</b><p><input type="radio" name="role" value="buyer">Buyer<p>
<input type="radio" name="role" value="seller">Seller<p>
<input type="radio" name="role" value="thirdparty">Third Party<p>
</ul>
<ul>
Qualification:<br>
<li>Highest Degree:<INPUT NAME="degree" TYPE=text SIZE=20><br>
<li>Percentage: <INPUT NAME="percentage" TYPE=text SIZE=20><br>
</ul>
<ul> Adress:
<li> streetName:<INPUT NAME="street" TYPE=text SIZE=20><br>
<li>cityName:<INPUT NAME="city" TYPE=text SIZE=20><br>
<li>StateName:<INPUT NAME="state" TYPE=text SIZE=20><br>
</ul>
</ul>
<b>
<INPUT TYPE=SUBMIT VALUE="ENTER" >
</body>
</html>hi there,
In the MCV there is a part about struts, this is a descent way to do this.
how to do it:
create an actionform containing all the properties of the page.
then when you submit your form use an method in the actionforms (that you have written) that makes sets your data in a xml file.
this works very quickely and i use it in production...
you can choose if you want the xml to generaded hard coded or via a parser.
greetings -
Can I call JSP page from forms6i C/S?
Hi.
How can I call JSP page from forms6i Client/Server?
Flavio.What is your problem with a host command? You can use:
host('c:\program files\internet explorer\iexplore.exe http://server/page.jsp');
There a disadvantage indeed: you have to close the browser before you can return to the form. -
Not able to compile an xml file using jasper reports through jsp page
hi,
i have compiled an xml file and got html,pdf etc using jasperreports but that was from an java application and now i want to convert this application to an jsp page so i have copied these jar files "commons-beanutils-1.5.jar","commons-collections-2.1.jar","commons-digester-1.3.jar","itext-1.01.jar","jasperreports-0.5.2.jar" to the folder "C:\Program Files\Apache Tomcat 4.0\webapps\examples\WEB-INF\lib" and have set classpath to these jar files.
my application(java class invoked by a servlet) is in C:\Program Files\Apache Tomcat 4.0\webapps\examples\WEB-INF\classes.
i m using this API "JasperCompileManager.compileReportToFile(fileName);"
but i m getting following error:
type Exception report
message Internal Server Error
description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Invoker service() exception
at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:504)
at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:180)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2312)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1011)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106)
at java.lang.Thread.run(Thread.java:536)
root cause
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.apache.commons.digester.Digester.(Digester.java:345)
at dori.jasper.engine.xml.JRXmlDigester.(JRXmlDigester.java:115)
at dori.jasper.engine.xml.JRXmlLoader.prepareDigester(JRXmlLoader.java:446)
at dori.jasper.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:384)
at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:371)
at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:339)
at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:323)
at dori.jasper.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:102)
at jasper_interact.file_exporter(jasper_interact.java:44)
at reportcontroller.doGet(reportcontroller.java:59)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:446)
at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:180)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2312)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1011)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106)
at java.lang.Thread.run(Thread.java:536)
i have one folder "C:\Program Files\Apache Tomcat 4.0\org\apache\commons\logging" containing some LogFactory calsses but i dont know where to put this folder so that tomcat can find them.
please help me..
i know i may not be clear to u but plz give me some way out i m totally stucked.
manishhi,
thanx for your reply.
ya i have "commons-logging-1.0.2.jar" file but when i tried to put it with other jar files and set the class path and run the application thru tomcat then it automatically stops the tomact.and when i removed this perticular logging jar file then tomcat works normally but gives the error which i mentioned before.
i have also tried the second option u suggested, by putting the LogFactory class files in "C:\Program Files\Apache Tomcat 4.0\webapps\examples\WEB-INF\classes\org\apache\commons\logging" but that was not working.shud i set some classpath for them? or shud i have to import these packages........ but when i copied this folder "org" to C:\Program Files\Apache Tomcat 4.0\webapps\examples\WEB-INF\classes and in program wrote import org.* then copilation error occured "no such package found.
what to do now.
manish -
XML to convert creative html to jsp?
I am trying to find a way to use XML, XSL, etc., to make the process of building web pages at my company easier between the creative team and developers:
1.) The creative team creates the images, text, and html (using Dreamweaver). Please note, the creative team barely knows html, much less xml, xsl, or taglibs.
2.) The creative team then sends me the html pages.
3.) I then need to "convert" the html into jsps. That is, I remove the mock/dummy dynamic content, and replace it with the scriptlets or taglibs that will produce the real dynamic content.
This takes alot of time. On top of that, if the creatives ever need to be changed, I need to send the newly converted jsps back to the creative team. They inevitably mess the jsps up, because they do not understand scriptlets or taglibs. Is there some standard way of dealing with this scenario, so that the creative team and I can work better together, and so that I dont constantly "convert" the html pages to jsps? I know one option is Enhydra's xmlc, but I will have a hard time getting the creative team to adopt that.
thank you,
Davidy don't u eliminate your jsp from your HTML. you can inculde html files as a header and footer.
tell to write a comment tag in html <Html code> <table><tr><td> <!--jsp output--></td></tr></table> <Html code>. you can write a small jsp which can String.indexOf("<!--jsp output-->");. you can easily create header and footer files. for your jsp, u can also change your jsp code like this. -
How to retrieve records from a database and display it in a jsp page.Help!!
Hello everyone ! im very new to this forum.Please help me to solve my problem
First i ll explain what is my requirement or needed.
Actually in my web page i have text box to enter start date and end date
and one list box to select the month .If user select or enter the dates in text box
accordingly the data from ms access database has to display in a jsp page.
Im using jsp and beans.
I tried returning ResultSet from bean but i get nothing display in my web page
instead it goes to error page (ErrorPage.jsp) which i handle in the jsp.
I tried many things but nothing work out please help me to attain a perfect
solution. I tried with my bean individually to check whether the result set has
values but i got NullPointerException . But the values which i passed or
available in the database.
I dint get any reply for my last post please reply atleast to this.
i get the date in the jsp page is by this way
int Year=Integer.parseInt(request.getParameter("year"));
int Month=Integer.parseInt(request.getParameter("month"));
int Day=Integer.parseInt(request.getParameter("day"));
String startdate=Day+"/"+Month+"/"+Year;
int Year1=Integer.parseInt(request.getParameter("year1"));
int Month1=Integer.parseInt(request.getParameter("month1"));
int Day1=Integer.parseInt(request.getParameter("day1"));
String enddate=Day1+"/"+Month1+"/"+Year1;But this to check my bean whether it return any result!
public void databaseConnection(String MTName,String startDate,String endDate)
try
java.text.SimpleDateFormat dateFormat=new java.text.SimpleDateFormat("dd/MM/yyyy");
java.util.Date fromDate=dateFormat.parse(startDate);
java.util.Date tillDate=dateFormat.parse(endDate);
java.sql.Date sqlFromDate=new java.sql.Date(fromDate.getTime());
java.sql.Date sqlTillDate=new java.sql.Date(tillDate.getTime());
String query1="select MTName,Date,MTLineCount from Main where MTName='"+MTName+"' and Date between '"+sqlFromDate+"' and '"+sqlTillDate+"' " ;
System.out.println(query1);
Class.forName(driver);
DriverManager.getConnection(url);
preparedStatement=connection.prepareStatement(query1);
preparedStatement.setString(1,"MTName");
preparedStatement.setDate(2,sqlFromDate);
preparedStatement.setDate(3,sqlTillDate);
resultSet=preparedStatement.executeQuery();
while(resultSet.next())
System.out.println(resultSet.getString(1));
System.out.println(resultSet.getDate(2));
System.out.println(resultSet.getInt(3));
catch (Exception e)
e.printStackTrace();
I Passed value from my main method is like thisl
databaseConnection("prasu","1/12/2005","31/12/2005");Please provide solutions or provide some sample codes!
Help!
Thanks in advance for repliesThanks for ur reply Mr.Rajasekhar
I tried as u said,
i tried without converting to sql date ,but still i din't get any results
java.text.SimpleDateFormat dateFormat=new java.text.SimpleDateFormat("dd/MM/yyyy");
java.util.Date fromDate=dateFormat.parse(startDate);
java.util.Date tillDate=dateFormat.parse(endDate);
String query1="select MTName,Date,MTLineCount from linecountdetails where mtname='"+MTName+"' and Date >='"+fromDate+"' and Date <='"+tillDate+"' " ;
System.out.println(query1);
//From main method
databaseConnection("prasu","1/12/2005","31/12/2005");I got the output as
---------- java ----------
select MTName,Date,MTLineCount from linecountdetails where mtname='prasu' and Date >='Thu Dec 01 00:00:00 GMT+05:30 2005' and Date <='Sat Dec 31 00:00:00 GMT+05:30 2005'
java.lang.NullPointerException
null
null
java.lang.NullPointerException
Output completed (4 sec consumed) - Normal TerminationThanks
Prasanna.B -
How to access a static method inside the JSP page
Here i had wrote the code in java to access databases , i had include the class path to all the class files.
my problem is when i click the register.jsp page, it will pose eror as null pointer exception i've put my code in this section as follows
memberchecking.jsp
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*,businessclasses.*,businessobjects.*,projectutils.DateUtilities.*,java.util.*" errorPage="" %>
<html>
<head>
<title>Checking Member's Registration Details...</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<%
String loginId = request.getParameter("loginId");
String resourcePassword = request.getParameter("resourcePassword");
String confirmPassword = request.getParameter("confirmPassword");
String resourceStatus=request.getParameter("resourceStatus");
String nameTitle = request.getParameter("nameTitle");
String jobTitle = request.getParameter("jobTitle");
String firstName = request.getParameter("firstName");
String middleName = request.getParameter("middleName");
String lastName = request.getParameter("lastName");
String displayName = request.getParameter("displayName");
String resourceInitials = request.getParameter("resourceIniitials");
String countryCode = request.getParameter("countryCode");
String resourceLanguage = request.getParameter("resourceLanguage");
//String resourceCurrency = request.getParameter("resourceCurrency");
String resourceEmail2 = request.getParameter("resourceEmail2");
String birthMonth = request.getParameter("birthMonth");
String birthDay = request.getParameter("birthDay");
String birthYear = request.getParameter("birthYear");
String resourceGender = request.getParameter("resourceGender");
String martialStatus = request.getParameter("martialStatus");
String resourceOccupation = request.getParameter("resourceOccupation");
String webPage = request.getParameter("webPage");
String homePhone = request.getParameter("homePhone");
String homePhone2 = request.getParameter("homephone2");
String homeFax = request.getParameter("homepFax");
String phoneOffice = request.getParameter("phoneOffice");
String phoneOffice2 = request.getParameter("phoneOffice2");
String officeFax = request.getParameter("officeFax");
String resourcePager = request.getParameter("resourcePager");
String resourceMobile = request.getParameter("resourceMobile");
String resourceType=request.getParameter("resourceType");
String resourceName = firstName + " " + middleName + " " + lastName;
//java.util.Date resourceBirthDate = (String)birthMonth + "/" + birthDay + "/" + birthYear;
session.setAttribute("Name",resourceName);
session.setAttribute("UserId",loginId);
out.println("name==========="+resourceName);
//check whether the input data is valid for insert
//input validation code goes here.....
ResourceBC aResourceBC=new ResourceBC();
//marshall the resource
ResourceBO resource=new ResourceBO();
String e1 = (String)resource.getEmail();
String e2 = (String)resource.getEmail2();
if(loginId != e1 && resourceEmail2 != e2 ) {
resource.setStatus( "L");
resource.setId(5);
resource.setCountryCode(countryCode);
// resource.setResourceTypeCode(resourceType);
// resource.setResourceParent(rs.getLong(6));
// resource.setHKey(rs.getLong(7));
resource.setName(resourceName);
resource.setDisplayName(displayName);
resource.setLogonPassword(resourcePassword);
resource.setNameTitle(nameTitle);
resource.setJobTitle(jobTitle);
resource.setEmail(loginId);
resource.setEmail2(resourceEmail2);
// resource.setPasswordUpdateDate(rs.getDate(14));
// resource.setPasswordExpireDate(rs.getDate(15));
// resource.setAccessCode(rs.getString(16));
// resource.setLogonUnSuccessTries(0);
resource.setWebPage(webPage);
resource.setPhoneOffice(phoneOffice);
resource.setPhoneOffice2(phoneOffice2);
resource.setPhoneOfficeFax(officeFax);
resource.setPhoneHome(homePhone);
resource.setPhoneHome2(homePhone2);
resource.setPhoneHomeFax(homeFax);
resource.setMobile(resourceMobile);
resource.setPager(resourcePager);
resource.setStatus(resourceStatus);
resource.setGender(resourceGender);
// resource.setBirthDate(resourceBirthDate);
resource.setMartialStatus(martialStatus);
resource.setLanguage(resourceLanguage);
// resource.setCurrency(resourceCurrency);
// resource.setPhoto(photo);
resource.setInitials(resourceInitials);
// resource.setCreatedBy(1);
// resource.setCreatedDate(rs.getDate(36));
// resource.setUpdatedBy(rs.getLong(37));
// resource.setUpdatedDate(rs.getDate(38));
resource.setFirstName(firstName);
resource.setLastName(lastName);
resource.setMiddleName(middleName);
//resource.setCreatedDate(new java.sql.Date());
int rowsAdded=aResourceBC.resourceAdd(resource);
out.println("rowsAdded= "+rowsAdded);
//add message for success or failure to add resource
String msg="";
if(rowsAdded == -1){
msg="<font color=red>The ResourceName already exists .Try another</font>";
session.setAttribute("message",msg);
response.sendRedirect(response.encodeRedirectURL("memberregister.jsp"));
else if(rowsAdded > 0){
msg="<font color=green>Resource Added successfully..........</font>";
session.setAttribute("message",msg);
%>
<jsp:forward page="memberlist.jsp">
<jsp:param name="message" value="<%=msg%>"/>
</jsp:forward>
<%}
%>
</body>
</html>
ResourceBC.java
package businessclasses;
import java.sql.*;
import businessobjects.ResourceBO;
import java.util.*;
import dbutilities.DBManager;
public class ResourceBC
public Vector resourceList() throws Exception{
Vector resourceList=new Vector();
String listSQL="";
StringBuffer listSQLBuffer=new StringBuffer();
listSQLBuffer.append("SELECT ");
listSQLBuffer.append("RES_ID,");
listSQLBuffer.append("RES_NAME,");
listSQLBuffer.append("CNTRY_CODE,");
listSQLBuffer.append("RES_LOGON_PASSWORD,");
listSQLBuffer.append("RESTYPE_CODE,");
listSQLBuffer.append("RES_PARENT,");
listSQLBuffer.append("RES_HKEY,");
listSQLBuffer.append("RES_DISPLAY_NAME,");
listSQLBuffer.append("RES_NAME_TITLE,");
listSQLBuffer.append("RES_JOB_TITLE,");
listSQLBuffer.append("RES_EMAIL,");
listSQLBuffer.append("RES_EMAIL2,");
listSQLBuffer.append("RES_PASSWORD_ACTION,");
listSQLBuffer.append("RES_PASSWORD_UPDATE_DATE,");
listSQLBuffer.append("RES_PASSWORD_EXPIRE_DATE,");
listSQLBuffer.append("RES_ACCESS_CODE,");
listSQLBuffer.append("RES_LOGON_UNSUCCESS_TRIES,");
listSQLBuffer.append("RES_WEB_PAGE,");
listSQLBuffer.append("RES_PHONE_OFFICE,");
listSQLBuffer.append("RES_PHONE_OFFICE2,");
listSQLBuffer.append("RES_PHONE_OFFICE_FAX,");
listSQLBuffer.append("RES_PHONE_HOME,");
listSQLBuffer.append("RES_PHONE_HOME2,");
listSQLBuffer.append("RES_PHONE_HOME_FAX,");
listSQLBuffer.append("RES_MOBILE,");
listSQLBuffer.append("RES_PAGER,");
listSQLBuffer.append("RES_STATUS,");
listSQLBuffer.append("RES_GENDER,");
listSQLBuffer.append("RES_BIRTH_DATE,");
listSQLBuffer.append("RES_MARTIAL_STATUS,");
listSQLBuffer.append("RES_LANGUAGE,");
listSQLBuffer.append("RES_CURRENCY,");
listSQLBuffer.append("RES_PHOTO,");
listSQLBuffer.append("RES_CREATED_BY,");
listSQLBuffer.append("RES_NAME_INITIALS,");
listSQLBuffer.append("RES_CREATED_DATE,");
listSQLBuffer.append("RES_UPDATED_BY");
listSQLBuffer.append("RES_UPDATED_DATE,");
listSQLBuffer.append("RES_NAME_FIRST,");
listSQLBuffer.append("RES_NAME_LAST,");
listSQLBuffer.append("RES_NAME_MIDDLE");
listSQLBuffer.append(" FROM T_RESOURCES ");
listSQL=listSQLBuffer.toString();
System.out.println("listSQL---"+listSQL);
DBManager dbManager=new DBManager();
Connection con =dbManager.getConnection();
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery(listSQL);
ResourceBO resource=null;
while(rs.next()){
resource=new ResourceBO();
resource.setId(rs.getLong(1));
resource.setName(rs.getString(2));
resource.setCountryCode(rs.getString(3));
resource.setLogonPassword(rs.getString(4));
resource.setResourceTypeCode(rs.getLong(5));
resource.setResourceParent(rs.getLong(6));
resource.setHKey(rs.getLong(7));
resource.setDisplayName(rs.getString(8));
resource.setNameTitle(rs.getString(9));
resource.setJobTitle(rs.getString(10));
resource.setEmail(rs.getString(11));
resource.setEmail2(rs.getString(12));
resource.setPasswordAction(rs.getString(13));
resource.setPasswordUpdateDate(rs.getDate(14));
resource.setPasswordExpireDate(rs.getDate(15));
resource.setAccessCode(rs.getString(16));
resource.setLogonUnSuccessTries(rs.getLong(17));
resource.setWebPage(rs.getString(18));
resource.setPhoneOffice(rs.getString(19));
resource.setPhoneOffice2(rs.getString(20));
resource.setPhoneOfficeFax(rs.getString(21));
resource.setPhoneHome(rs.getString(22));
resource.setPhoneHome2(rs.getString(23));
resource.setPhoneHomeFax(rs.getString(24));
resource.setMobile(rs.getString(25));
resource.setPager(rs.getString(26));
resource.setStatus(rs.getString(27));
resource.setGender(rs.getString(28));
resource.setBirthDate(rs.getDate(29));
resource.setMartialStatus(rs.getString(30));
resource.setLanguage(rs.getString(31));
resource.setCurrency(rs.getString(32));
resource.setPhoto(rs.getString(33));
resource.setCreatedBy(rs.getLong(34));
resource.setInitials(rs.getString(35));
resource.setCreatedDate(rs.getDate(36));
resource.setUpdatedBy(rs.getLong(37));
resource.setUpdatedDate(rs.getDate(38));
resource.setFirstName(rs.getString(39));
resource.setLastName(rs.getString(40));
resource.setMiddleName(rs.getString(41));
resourceList.add(resource);
con.close();
con=null;
return resourceList;
//Method to insert the values into the database
public int resourceAdd(ResourceBO resource){
System.out.println("in resourceAdd method ");
//check for duplicate record in the table
String checkDuplicationSQL="SELECT RES_ID FROM T_RESOURCES WHERE RES_ID='"+resource.getId()+"'";
DBManager dbManager=new DBManager();//.getInstance();
boolean hasDuplicateRecord=dbManager.hasDuplicateRecord(checkDuplicationSQL);
int rowsAdded=0;
//insert the record
//hasDuplicateRecord=false;
if(!hasDuplicateRecord){
//get the next resource id for insertion
long nextID=dbManager.getNextIDForColumnAndTable("RES_ID","T_RESOURCES");
System.out.println("nextID================== "+nextID);
StringBuffer fieldsbuffer=new StringBuffer();
fieldsbuffer.append("INSERT INTO T_RESOURCES (");
fieldsbuffer.append("RES_ID,");
fieldsbuffer.append("RES_NAME,");
fieldsbuffer.append("CNTRY_CODE,");
fieldsbuffer.append("RES_LOGON_PASSWORD,");
fieldsbuffer.append("RESTYPE_CODE,");
fieldsbuffer.append("RES_PARENT,");
fieldsbuffer.append("RES_HKEY,");
fieldsbuffer.append("RES_DISPLAY_NAME,");
fieldsbuffer.append("RES_NAME_TITLE,");
fieldsbuffer.append("RES_JOB_TITLE,");
fieldsbuffer.append("RES_EMAIL,");
fieldsbuffer.append("RES_EMAIL2,");
fieldsbuffer.append("RES_PASSWORD_ACTION,");
fieldsbuffer.append("RES_PASSWORD_UPDATE_DATE,");
fieldsbuffer.append("RES_PASSWORD_EXPIRE_DATE,");
fieldsbuffer.append("RES_ACCESS_CODE,");
fieldsbuffer.append("RES_LOGON_UNSUCCESS_TRIES,");
fieldsbuffer.append("RES_WEB_PAGE,");
fieldsbuffer.append("RES_PHONE_OFFICE,");
fieldsbuffer.append("RES_PHONE_OFFICE2,");
fieldsbuffer.append("RES_PHONE_OFFICE_FAX,");
fieldsbuffer.append("RES_PHONE_HOME,");
fieldsbuffer.append("RES_PHONE_HOME2,");
fieldsbuffer.append("RES_PHONE_HOME_FAX,");
fieldsbuffer.append("RES_MOBILE,");
fieldsbuffer.append("RES_PAGER,");
fieldsbuffer.append("RES_STATUS,");
fieldsbuffer.append("RES_GENDER,");
fieldsbuffer.append("RES_BIRTH_DATE,");
fieldsbuffer.append("RES_MARTIAL_STATUS,");
fieldsbuffer.append("RES_LANGUAGE,");
fieldsbuffer.append("RES_CURRENCY,");
fieldsbuffer.append("RES_PHOTO,");
/* fieldBuffer.append("RES_CREATED_BY,");
fieldBuffer.append("RES_NAME_INITIALS,");
fieldBuffer.append("RES_CREATED_DATE,");
fieldBuffer.append("RES_UPDATED_BY");
fieldBuffer.append("RES_UPDATED_DATE,");
fieldBuffer.append("RES_NAME_FIRST,");
fieldBuffer.append("RES_NAME_LAST,");
fieldBuffer.append("RES_NAME_MIDDLE"); */
StringBuffer valuesBuffer=new StringBuffer(" VALUES(");
valuesBuffer.append(nextID+",");
valuesBuffer.append("'"+resource.getName()+",");
valuesBuffer.append("'"+resource.getCountryCode()+",");
valuesBuffer.append("'"+resource.getLogonPassword()+"',");
valuesBuffer.append("'"+resource.getResourceTypeCode()+",");
valuesBuffer.append("'"+resource.getResourceParent()+",");
valuesBuffer.append("'"+resource.getHKey()+",");
valuesBuffer.append("'"+resource.getDisplayName()+",");
valuesBuffer.append("'"+resource.getNameTitle()+",");
valuesBuffer.append("'"+resource.getJobTitle()+",");
valuesBuffer.append("'"+resource.getEmail()+"',");
valuesBuffer.append("'"+resource.getEmail2()+"',");
valuesBuffer.append("'"+resource.getPasswordAction()+",");
valuesBuffer.append("'"+resource.getPasswordUpdateDate()+",");
valuesBuffer.append("'"+resource.getPasswordExpireDate()+",");
valuesBuffer.append("'"+resource.getAccessCode()+",");
valuesBuffer.append("'"+resource.getLogonUnsuccessTries()+",");
valuesBuffer.append("'"+resource.getWebPage()+"',");
valuesBuffer.append("'"+resource.getPhoneOffice()+"',");
valuesBuffer.append("'"+resource.getPhoneOffice2()+"',");
valuesBuffer.append("'"+resource.getPhoneOfficeFax()+"',");
valuesBuffer.append("'"+resource.getPhoneHome()+"',");
valuesBuffer.append("'"+resource.getPhoneHome2()+"',");
valuesBuffer.append("'"+resource.getPhoneHomeFax()+"',");
valuesBuffer.append("'"+resource.getMobile()+"',");
valuesBuffer.append("'"+resource.getPager()+"',");
valuesBuffer.append("'"+resource.getStatus()+"',");
valuesBuffer.append("'"+resource.getGender()+"',");
valuesBuffer.append("'"+resource.getBirthDate()+"',");
valuesBuffer.append("'"+resource.getMartialStatus()+"',");
valuesBuffer.append("'"+resource.getLanguage()+"',");
valuesBuffer.append("'"+resource.getCurrency()+"',");
valuesBuffer.append("'"+resource.getPhoto()+"',");
valuesBuffer.append("'"+resource.getCreatedBy()+"',");
valuesBuffer.append("'"+resource.getInitials()+"',");
valuesBuffer.append("'"+resource.getCreatedDate()+"',");
valuesBuffer.append("'"+resource.getUpdatedBy()+"',");
valuesBuffer.append("'"+resource.getUpdatedDate()+"',");
valuesBuffer.append("'"+resource.getFirstName()+"',");
valuesBuffer.append("'"+resource.getLastName()+"',");
valuesBuffer.append("'"+resource.getMiddleName()+"')");
String insertSQL=fieldsbuffer.toString()+valuesBuffer.toString();
System.out.println("insertSQL="+insertSQL);
rowsAdded=dbManager.executeSQL(insertSQL);
System.out.println("rowsAdded= "+rowsAdded+"hasDuplicateRecord "+hasDuplicateRecord);
}//end if
else{
//throw new Exception("Has a duplicate Record");
return -1;
return rowsAdded;
public int resourceUpdate(ResourceBO resource){
int rowsUpdated=0;
/* String orgCodeStr=null;
if(resource.getOrgCode()==0){
orgCodeStr="NULL";
}else{
orgCodeStr=""+resource.getOrgCode();
StringBuffer updateSQLBuffer=new StringBuffer();
updateSQLBuffer.append("UPDATE T_RESOURCES SET ");
updateSQLBuffer.append("RES_NAME='"+resource.getName()+"',");
updateSQLBuffer.append("CNTRY_CODE='"+resource.getCountryCode()+"',");
updateSQLBuffer.append("RES_LOGON_PASSWORD='"+resource.getLogonPassword()+"',");
updateSQLBuffer.append("RESTYPE_CODE="+resource.getResourceTypeCode()+",");
updateSQLBuffer.append("RES_PARENT="+resource.getResourceParent()+",");
updateSQLBuffer.append("RES_HKEY="+resource.getHKey()+",");
updateSQLBuffer.append("RES_DISPLAY_NAME="+resource.getDisplayName()+",");
updateSQLBuffer.append("RES_NAME_TITLE="+resource.getNameTitle()+",");
updateSQLBuffer.append("RES_JOB_TITLE="+resource.getJobTitle()+",");
updateSQLBuffer.append("RES_EMAIL='"+resource.getEmail()+"',");
updateSQLBuffer.append("RES_EMAIL2='"+resource.getEmail2()+"',");
updateSQLBuffer.append("RES_PASSWORD_ACTION="+resource.getPasswordAction()+",");
updateSQLBuffer.append("RES_PASSWORD_UPDATE_DATE="+resource.getPasswordUpdateDate()+",");
updateSQLBuffer.append("RES_PASSWORD_EXPIRE_DATE="+resource.getPasswordExpireDate()+",");
updateSQLBuffer.append("RES_ACCESS_CODE="+resource.getAccessCode()+",");
updateSQLBuffer.append("RES_LOGON_UNSUCCESS_TRIES="+resource.getLogonUnsuccessTries()+",");
updateSQLBuffer.append("RES_WEB_PAGE='"+resource.getWebPage()+"',");
updateSQLBuffer.append("RES_PHONE_OFFICE='"+resource.getPhoneOffice()+"',");
updateSQLBuffer.append("RES_PHONE_OFFICE2='"+resource.getPhoneOffice2()+"',");
updateSQLBuffer.append("RES_PHONE_OFFICE_FAX='"+resource.getPhoneOfficeFax()+"',");
updateSQLBuffer.append("RES_PHONE_HOME='"+resource.getPhoneHome()+"',");
updateSQLBuffer.append("RES_PHONE_HOME2='"+resource.getPhoneHome2()+"',");
updateSQLBuffer.append("RES_PHONE_HOME_FAX='"+resource.getPhoneHomeFax()+"',");
updateSQLBuffer.append("RES_MOBILE='"+resource.getMobile()+"',");
updateSQLBuffer.append("RES_PAGER='"+resource.getPager()+"',");
updateSQLBuffer.append("RES_STATUS='"+resource.getStatus()+"',");
updateSQLBuffer.append("RES_GENDER='"+resource.getGender()+"',");
updateSQLBuffer.append("RES_BIRTH_DATE='"+resource.getBirthDate()+"',");
updateSQLBuffer.append("RES_MARTIAL_STATUS='"+resource.getMartialStatus()+"',");
updateSQLBuffer.append("RES_LANGUAGE='"+resource.getLanguage()+"',");
updateSQLBuffer.append("RES_CURRENCY='"+resource.getCurrency()+"',");
updateSQLBuffer.append("RES_PHOTO='"+resource.getPhoto()+"',");
updateSQLBuffer.append("RES_NAME_INITIALS='"+resource.getInitials()+"',");
updateSQLBuffer.append("RES_NAME_FIRST='"+resource.getFirstName()+"',");
updateSQLBuffer.append("RES_NAME_LAST='"+resource.getLastName()+"',");
updateSQLBuffer.append("RES_NAME_MIDDLE='"+resource.getMiddleName()+"'");
updateSQLBuffer.append("WHERE RES_ID="+resource.getId());
String updateSQL=updateSQLBuffer.toString();
//String updateSQL="UPDATE T_RESOURCES SET CLIENT_NAME='"+resource.getName()+"',CLIENT_STATUS='"+resource.getStatus()+"',CLIENT_EMAIL_PRIMARY='"+resource.getEmailPrimary()+"',CLIENT_EMAIL_ALTERNATIVE='"+resource.getEmailAlternate()+"',CLIENT_CURRENCY_SYMBOL='"+resource.getCurrencySymbol()+"',CLIENT_CURRENCY_DIGITS="+resource.getCurrencyDigits()+",CLIENT_DIRECTORY_DOCUMENT='"+resource.getDirectoryDocument()+"',CLIENT_DIRECTORY_TEMPLATE='"+resource.getDirectoryTemplate()+"',CLIENT_STORAGE_QUOTA="+resource.getStorageQuota()+",CLIENT_KEY='"+resource.getKey()+"' WHERE CLIENT_ID="+resource.getId();
System.out.println("updateSQL---"+updateSQL);
DBManager dbManager=new DBManager();
rowsUpdated=dbManager.executeSQL(updateSQL);
return rowsUpdated;
public int resourceDelete(long resourceId){
int rowsDeleted=0;
DBManager dbManager=new DBManager();
String deleteSQL="DELETE FROM T_RESOURCES WHERE RES_ID="+resourceId;
System.out.println("deleteSQL==="+deleteSQL);
rowsDeleted=dbManager.executeSQL(deleteSQL);
System.out.println("rowsDeleted= "+rowsDeleted);
return rowsDeleted;
public ResourceBO getResourceById(long resourceId)throws Exception{
StringBuffer selectSQLBuffer=new StringBuffer();
selectSQLBuffer.append("SELECT ");
selectSQLBuffer.append("RES_ID,");
selectSQLBuffer.append("RES_NAME,");
selectSQLBuffer.append("CNTRY_CODE,");
selectSQLBuffer.append("RES_LOGON_PASSWORD,");
selectSQLBuffer.append("RESTYPE_CODE,");
selectSQLBuffer.append("RES_PARENT,");
selectSQLBuffer.append("RES_HKEY,");
selectSQLBuffer.append("RES_DISPLAY_NAME,");
selectSQLBuffer.append("RES_NAME_TITLE,");
selectSQLBuffer.append("RES_JOB_TITLE,");
selectSQLBuffer.append("RES_EMAIL,");
selectSQLBuffer.append("RES_EMAIL2,");
selectSQLBuffer.append("RES_PASSWORD_ACTION,");
selectSQLBuffer.append("RES_PASSWORD_UPDATE_DATE,");
selectSQLBuffer.append("RES_PASSWORD_EXPIRE_DATE,");
selectSQLBuffer.append("RES_ACCESS_CODE,");
selectSQLBuffer.append("RES_LOGON_UNSUCCESS_TRIES,");
selectSQLBuffer.append("RES_WEB_PAGE,");
selectSQLBuffer.append("RES_PHONE_OFFICE,");
selectSQLBuffer.append("RES_PHONE_OFFICE2,");
selectSQLBuffer.append("RES_PHONE_OFFICE_FAX,");
selectSQLBuffer.append("RES_PHONE_HOME,");
selectSQLBuffer.append("RES_PHONE_HOME2,");
selectSQLBuffer.append("RES_PHONE_HOME_FAX,");
selectSQLBuffer.append("RES_MOBILE,");
selectSQLBuffer.append("RES_PAGER,");
selectSQLBuffer.append("RES_STATUS,");
selectSQLBuffer.append("RES_GENDER,");
selectSQLBuffer.append("RES_BIRTH_DATE,");
selectSQLBuffer.append("RES_MARTIAL_STATUS,");
selectSQLBuffer.append("RES_LANGUAGE,");
selectSQLBuffer.append("RES_CURRENCY,");
selectSQLBuffer.append("RES_PHOTO,");
selectSQLBuffer.append("RES_CREATED_BY,");
selectSQLBuffer.append("RES_NAME_INITIALS,");
selectSQLBuffer.append("RES_CREATED_DATE,");
selectSQLBuffer.append("RES_UPDATED_BY");
selectSQLBuffer.append("RES_UPDATED_DATE,");
selectSQLBuffer.append("RES_NAME_FIRST,");
selectSQLBuffer.append("RES_NAME_LAST,");
selectSQLBuffer.append("RES_NAME_MIDDLE");
selectSQLBuffer.append(" FROM T_RESOURCES WHERE RES_ID="+resourceId);
String fetchSQL=selectSQLBuffer.toString();
System.out.println("fetchSQL---"+fetchSQL);
DBManager dbManager=new DBManager();
Connection con =dbManager.getConnection();
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery(fetchSQL);
ResourceBO resource=new ResourceBO();
while(rs.next()){
resource.setId(rs.getLong(1));
resource.setName(rs.getString(2));
resource.setCountryCode(rs.getString(3));
resource.setLogonPassword(rs.getString(4));
resource.setResourceTypeCode(rs.getLong(5));
resource.setResourceParent(rs.getLong(6));
resource.setHKey(rs.getLong(7));
resource.setDisplayName(rs.getString(8));
resource.setNameTitle(rs.getString(9));
resource.setJobTitle(rs.getString(10));
resource.setEmail(rs.getString(11));
resource.setEmail2(rs.getString(12));
resource.setPasswordAction(rs.getString(13));
resource.setPasswordUpdateDate(rs.getDate(14));
resource.setPasswordExpireDate(rs.getDate(15));
resource.setAccessCode(rs.getString(16));
resource.setLogonUnSuccessTries(rs.getLong(17));
resource.setWebPage(rs.getString(18));
resource.setPhoneOffice(rs.getString(19));
resource.setPhoneOffice2(rs.getString(20));
resource.setPhoneOfficeFax(rs.getString(21));
resource.setPhoneHome(rs.getString(22));
resource.setPhoneHome2(rs.getString(23));
resource.setPhoneHomeFax(rs.getString(24));
resource.setMobile(rs.getString(25));
resource.setPager(rs.getString(26));
resource.setStatus(rs.getString(27));
resource.setGender(rs.getString(28));
resource.setBirthDate(rs.getDate(29));
resource.setMartialStatus(rs.getString(30));
resource.setLanguage(rs.getString(31));
resource.setCurrency(rs.getString(32));
resource.setPhoto(rs.getString(33));
resource.setCreatedBy(rs.getLong(34));
resource.setInitials(rs.getString(35));
resource.setCreatedDate(rs.getDate(36));
resource.setUpdatedBy(rs.getLong(37));
resource.setUpdatedDate(rs.getDate(38));
resource.setFirstName(rs.getString(39));
resource.setLastName(rs.getString(40));
resource.setMiddleName(rs.getString(41));
con.close();
con=null;
return resource;
}//end of class
plz help me to solve this problem....
rajkumarThe JSP wil be converted into a java file and then compiled into a class. If you are using tomcat, the java file will be somewhere in the work folder of your tomcat installation. Find the java file and check the line that is reported in the exception to see where the null-pointer is coming from.
-
How to show an xml content in a Jsp page?
I use <jsp:include page=".....xml" /> tag in a jsp file to include an xml file. When this jsp page is open, only the text content in the xml file shows up with plain text. I want this xml file shows up like in IE (with xml format). Does anyone know how to do it? Thanks.
northcloudThank you, BalusC & evnafets. Someone told me to use <c:import> to load the XML file into a scoped variable, and then use <c:out> to display it. The <c:out> will automatically convert the markup to HTML entities. I tried it, it works. It shows the content in the xml file as plain text (a long string). Any one give me some suggestion to make it looking better, for example, show each element in seperated lines. Thanks.
-
How to retrieve data and display in JSP page
hi,
i am trying to retrieve data from SQL server 2000 and display in JSP Page. I have already place the codes of the retrieve in the bean file. I wanna ask is that how to display in the JSP page. If possible, can provide example codings for mi to reference?
Thanks
Regards,
shixuanHI Tan ,
I pressume that you wanted to make use of PDK, the code can go like this .
<b><u>1) JAVA file</u></b>
import com.sapportals.htmlb.DropdownListBox;
import com.sapportals.htmlb.InputField;
import com.sapportals.htmlb.event.Event;
import com.sapportals.htmlb.page.DynPage;
import com.sapportals.htmlb.page.PageException;
import com.sapportals.portal.htmlb.page.JSPDynPage;
import com.sapportals.portal.htmlb.page.PageProcessorComponent;
import com.sapportals.portal.prt.component.IPortalComponentRequest;
import com.sapportals.portal.prt.component.IPortalComponentSession;
import com.sapportals.portal.prt.component.IPortalComponentContext;
import java.sql.*;
public class P_SAP_B_User extends PageProcessorComponent
* Method : getPage()
* Description :
* Input Parameters : None
* Returns : Object of Class DynPage
public DynPage getPage()
return new P_SAP_B_UserDynPage();
} // end of dynPage()
public static class P_SAP_B_UserDynPage extends JSPDynPage
/* Variable Declaration */
/* Object of bean class P_SAP_B_CreateUser initialised to null */
private P_SAP_B_CreateUser createUserBean = null;
/* Flags for checking the occurance of Event & Error. */
private int iFlag=0;
private int iErrFlag=0;
/* Variables for storing the information
entered by user in each text field */
private String sFname;
private String sSname;
private String sAge;
private String sExp;
private String sSkill;
private String sUnit;
* Method : doInitialization()
* Description :
* Input Parameters : None
* Returns : None
public void doInitialization()
IPortalComponentSession componentSession = ((IPortalComponentRequest)getRequest()).getComponentSession();
Object o = componentSession.getValue("createUserBean");
if(o==null || !(o instanceof P_SAP_B_CreateUser))
createUserBean = new P_SAP_B_CreateUser();
componentSession.putValue("createUserBean",createUserBean);
} // end of if
else
createUserBean = (P_SAP_B_CreateUser) o;
} // end of else
}//end of doInitialisation()
* Method : onUpdate()
* Description :
* Input Parameters : object of Event class
* Returns : None
public void onUpdate(Event e)throws PageException
/* sets flag to 1 when update button is clicked. */
iFlag=1;
* Method : doProcessAfterInput()
* Description :
* Input Parameters : None
* Returns : None
public void doProcessAfterInput() throws PageException
InputField ifFirstName = (InputField) getComponentByName("FirstName");
InputField ifSecondName = (InputField) getComponentByName("SecondName");
InputField ifAge = (InputField) getComponentByName("Age");
InputField ifExp = (InputField) getComponentByName("Exp");
InputField ifSkill = (InputField) getComponentByName("Skill");
DropdownListBox dlbUnit = (DropdownListBox) getComponentByName("Unit");
int iAge,iExp;
IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
IPortalComponentContext myContext = request.getComponentContext();
P_SAP_B_CreateUser myNameContainer = (P_SAP_B_CreateUser) myContext.getValue("createUserBean");
if(ifFirstName != null)
this.sFname = ifFirstName.getValueAsDataType().toString() ;
} // end of if
if(ifSecondName!= null)
this.sSname = ifSecondName.getValueAsDataType().toString() ;
} // end of if
if(ifAge!= null)
this.sAge = ifAge.getValueAsDataType().toString() ;
} // end of if
if(ifExp!= null)
this.sExp = ifExp.getValueAsDataType().toString() ;
} // end of if
if(ifSkill != null)
this.sSkill = ifSkill.getValueAsDataType().toString() ;
} // end of if
if(dlbUnit != null)
this.sUnit = dlbUnit.getSelection().toString() ; ;
} // end of if
/* Data Validation */
/* try block for numeric Exception */
try
/* checking for any field left blank by the user */
if(sFname.equals("") || sSname.equals("") || sAge.equals("")|| sExp.equals("") || sSkill.equals(""))
/* set error flag to 1 in case of any field left blank */
iErrFlag=1;
} // end of if
else
/* converting Age and Experience fields (String) to integer */
iAge= Integer.parseInt(sAge);
iExp= Integer.parseInt(sExp);
/* setting the boundaries on the value in Age Field */
if(iAge<0)
/* set error flag to 2 in case of age below 0 */
iErrFlag=2;
}// end of if
/* setting the boundaries on the value in Experience field */
else if(iExp<0 ||(iExp/12)>=iAge)
/* set error flag to 3 in case of experience below 0 or exceeding the age in years */
iErrFlag=3;
}// end of else if
/* In case of no error */
else
/* setting the bean variables */
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:Test");
String query="insert into UserData values(?,?,?,?,?,?)";
PreparedStatement prestat=con.prepareStatement(query);
/* setting the values to be inserted into the user table */
prestat.setString(1,sFname);
prestat.setString(2,sSname);
prestat.setString(3,sAge);
prestat.setString(4,sExp);
prestat.setString(5,sSkill );
prestat.setString(6,sUnit);
prestat.executeUpdate() ;
prestat.close();
con.close();
myNameContainer.setSFname(sFname);
myNameContainer.setSLname(sSname);
myNameContainer.setSAge(sAge);
myNameContainer.setSExp(sExp);
myNameContainer.setSSkill(sSkill);
myNameContainer.setSUnit(sUnit);
} // end of inner try block
catch(Exception sqle)
myNameContainer.setErrMessage("Update failed ! Please try again." );
} // end of catch corresponding to inner try
} // end of inner else
} //end of outer else
} //end of outer try block
catch(Exception e)
/* setting flag to 4 in case of non-numeric age/experience values */
iErrFlag = 4;
/* Displaying error message corresponding to the value of error flag */
switch(iErrFlag)
/* Empty Field */
case 1:myNameContainer.setErrMessage( "Please Fill all the fields");
break;
/* Invalid Value in the age field */
case 2:myNameContainer.setErrMessage( "Enter a valid value in Age field.(Hint : Have you entered Age<0 ?");
break;
/* Invalid Value in the experience field */
case 3:myNameContainer.setErrMessage( "Enter a valid value in Experience field.(Hint : Experince should not be negative or greater than your age in months)");
break;
/* Non-numeric value in the Age/ experience fields */
case 4:myNameContainer.setErrMessage( "Please Enter Numeric Value for Age and Experience");
break;
} // end of switch-case block
} //end of doProcessAfterInput()
* Method : doProcessBeforeOutput()
* Description :
* Input Parameters : None
* Returns : None
public void doProcessBeforeOutput() throws PageException
/* Displays Form for new user creation by default */
this.setJspName("P_SAP_B_UserCreationForm.jsp");
/* In case of an error display an error message page */
if(iErrFlag!=0)
setJspName("ErrorPage.jsp");
} //end of if
/* Displays the user's information as entered in the SQL
database after its been uploaded by the user */
else if(iFlag==1)
setJspName("hello.jsp");
} // end of else if
} // end of doProcessBeforeOutput()
} // end of P_SAP_B_UserDynPage Class
} // end of P_SAP_B_User class
* End of File P_SAP_B_User.java
2) Bean
package com.sap.usercreation;
import java.io.Serializable;
public class P_SAP_B_CreateUser implements Serializable
private String sFname;
private String sLname;
private String sUnit;
private String sSkill;
private String sExp;
private String sAge;
private String errMessage;
* @return
public String getSFname() {
return sFname;
* @return
public String getSLname() {
return sLname;
* @param i
* @param string
public void setSFname(String string) {
sFname = string;
* @param string
public void setSLname(String string) {
sLname = string;
* @return
public String getSUnit() {
return sUnit;
* @param string
public void setSUnit(String string) {
sUnit = string;
* @return
public String getSSkill() {
return sSkill;
public void setSSkill(String string) {
sSkill = string;
* @return
public String getSAge() {
return sAge;
* @return
public String getSExp() {
return sExp;
* @param string
public void setSAge(String string) {
sAge = string;
* @param string
public void setSExp(String string) {
sExp = string;
* @return
public String getErrMessage() {
return errMessage;
* @param string
public void setErrMessage(String string) {
errMessage = string;
3) The Jsp file i have already posted.
See if you copy this code and paste it wont work as i have not given you full code ,But yes this gives you an overview of how things can be done .
Thanx
Pankaj
Maybe you are looking for
-
How to include preset in RTF import option while importing RTF files?
Dear all, I created a script which will place text from rtf files present in a folder to an active document on different page based on match. I am using a preset name "myRTF" which i will use when i import rtf files without script. Is there a way to
-
The "back" button no longer works in certain specific situations on certain specific websites -- especially on the very website on which I need to use it very frequently. This has been going on for a couple of weeks. Also, I noticed today that the "c
-
Why do I lose the abilitiy to search my PDF Portfolio once it is uploaded to the internet?
-
I go Start: All Programs: Adobe Master Collection: The Encore Icon comes up and does it thing for a few seconds and then, Bleep....it goes off screen, back to my desktop. All my other Adobe programs will open from the Master Collection??? I want to o
-
What is data sets,parent data,child data in generic technology connector..
Hi All, I am a new learner to OIM. Please try to give a brief details of data sets,child data,parent data,providers in Generic Technology Connectors.. Thanks in advance..