What should I take note when converting Servlets to JSPs files?
Hi Everyone,
I have a web application that currently runs using Servlets and JSP, but i intend to change every servlet file into JSP.
What should I take note?
Please advice and comment.
Thanks in advance
Ok, I can see your logic, but I don't agree with it.
It may SEEM like you'll save time, but I'm pretty sure you wouldn't in the end.
So you don't have to restart the Tomcat server so much.
That still doesn't justify writing java code into a JSP.
Whatever you gain from not restarting the server you will lose 10 times over from stupid compile errors/typos that come from writing scriptlet code in a JSP.
Java code belongs in a java class, where you can take advantage of all of the assistance of the IDE for code completion, formatting, compiling, syntax checking etc.
Also if you write your code in classes, you can test them with Junit tests - something harder to do when your logic is embedded in JSPs
Write your java code where it is meant to be. In java classes. Beans/Servlets/whatever.
A JSP is for one purpose only - to produce an HTML page.
Just my 2 cents.
evnafets
Similar Messages
-
What should be take action against following sql tuning report.
Hi
what should be take action against following sql tuning report.
SQL ID : fn3mt5dvm7fba
SQL Text : SELECT * FROM (select
to_number(ow.waybl_no) waybl_no,ow.id wb_id,
To_Number(ogp.gp_no) gp_no,
To_Number(ots.trip_sht_no) trip_sht_no,
otr.nm,
ots.gty_br_mast_id,
DECODE(otr.sign_recd,'1','YES','NO') Sign_Recd,
DECODE(otr.stamped,'1','YES','NO') Stamped,
otr.dlvry_dt dlvry_dt,
otr.tel_no,
--otr.remarks,
Decode(otr.comments, NULL,'','Yes') remarks,
otr.id ID,ops_safex_utl.get_br_nm(to_number(ow.bkg_br_mast_id))
book_br,
ow.pick_dt book_date
from
ops_ts_reconsile otr,
ops_pultd_wb_dtls opuwd,
ops_trip_sht ots,
ops_waybl ow,
ops_ultd_wb_dtls ouwd,
ops_gate_pass ogp
where
otr.trip_sht_id=ots.id and
otr.pultd_wb_dtls_id=opuwd.id and
opuwd.ultd_wb_dtls_id=ouwd.id and
ouwd.gate_pass_id=ogp.id and
opuwd.waybl_id=ow.id and
otr.status_lid=157 and
ots.gty_br_mast_id = (:br_Id) and
(otr.dlvry_dt = :searchDate OR :searchDate IS NULL) and
otr.note_prpd = 'N' and otr.pod_recd = '1' and
not exists (select TS_RECONSILE_ID from OPS_POD_FRWD_NOTE_DTLS
where TS_RECONSILE_ID = otr.id)
union
select
to_number(ow.waybl_no) waybl_no, ow.id wb_id,
To_Number(ogp.gp_no) gp_no,
null trip_sht_no,
ogr.nm,
ogp.dlvry_br_mast_id,
DECODE(ogr.sign_recd,'Y','YES','NO') Sign_Recd,
DECODE(ogr.stamped,'Y','YES','NO') Stamped,
ogr.dlvry_dt dlvry_dt,
ogr.tel_no,
--ogr.remarks,
Decode(ogr.comments, NULL,'', 'Yes') remarks,
ogr.id ID,ops_safex_utl.get_br_nm(to_number(ow.bkg_br_mast_id))
book_br,
ow.pick_dt book_date
from
ops_gp_reconcile ogr,
ops_gate_pass ogp,
ops_waybl ow
where
ogr.gp_id=ogp.id and
ogp.waybl_id=ow.id and
ogp.dlvry_br_mast_id = (:br_Id) and
(ogr.dlvry_dt = :searchDate) and
ogr.note_prpd = 'N' and ogr.pod_recd = 'Y' and
not exists (select GP_RECONSILE_ID from OPS_POD_FRWD_NOTE_DTLS
where GP_RECONSILE_ID = ogr.id)) QRSLT ORDER BY trip_sht_no desc
Bind Variables :
1 - (VARCHAR2(32)):37069
2 - (DATE):07/11/2011 00:00:00
3 - (DATE):07/11/2011 00:00:00
4 - (VARCHAR2(32)):37069
5 - (DATE):07/11/2011 00:00:00
FINDINGS SECTION (3 findings)
1- SQL Profile Finding (see explain plans section below)
2 potentially better execution plans were found for this statement. Choose
one of the following SQL profiles to implement.
Recommendation (estimated benefit<=10%)
- Consider accepting the recommended SQL profile.
execute dbms_sqltune.accept_sql_profile(task_name => 'TASK_58643',
task_owner => 'SYS', replace => TRUE);
Recommendation (estimated benefit: 99.15%)
- Consider accepting the recommended SQL profile to use parallel execution
for this statement.
execute dbms_sqltune.accept_sql_profile(task_name => 'TASK_58643',
task_owner => 'SYS', replace => TRUE, profile_type =>DBMS_SQLTUNE.PX_PROFILE);
Executing this query parallel with DOP 128 will improve its response time
99.11% over the SQL profile plan. However, there is some cost in enabling
parallel execution. It will increase the statement's resource consumption by
an estimated 14.56% which may result in a reduction of system throughput.
Also, because these resources are consumed over a much smaller duration, the
response time of concurrent statements might be negatively impacted if
sufficient hardware capacity is not available.
The following data shows some sampled statistics for this SQL from the past
week and projected weekly values when parallel execution is enabled.
Past week sampled statistics for this SQL
Number of executions 17494
Percent of total activity 7.2
Percent of samples with #Active Sessions > 2*CPU .63
Weekly DB time (in sec) 614696.04
Projected statistics with Parallel Execution
Weekly DB time (in sec) 704166.9
2- Restructure SQL finding (see plan 1 in explain plans section)
An expensive "UNION" operation was found at line ID 4 of the execution plan.
Recommendation
- Consider using "UNION ALL" instead of "UNION", if duplicates are allowed
or uniqueness is guaranteed.
3- Alternative Plan Finding
Some alternative execution plans for this statement were found by searching
the system's real-time and historical performance data.
The following table lists these plans ranked by their average elapsed time.
See section "ALTERNATIVE PLANS SECTION" for detailed information on each
plan.
id plan hash last seen elapsed (s) origin note
1 209247904 2011-07-12/10:09:08 7.564 Cursor Cache
2 4029269565 2011-07-12/10:20:21 15.374 Cursor Cache original plan
3 4128886984 2011-07-08/11:30:25 42.426 AWR
4 3695555639 2011-07-12/08:30:30 101.459 AWR
Recommendation
- Consider creating a SQL plan baseline for the plan with the best average
elapsed time.
execute dbms_sqltune.create_sql_plan_baseline(task_name => 'TASK_58643',
owner_name => 'SYS', plan_hash_value => 209247904);
ADDITIONAL INFORMATION SECTION
- The optimizer could not merge the view at line ID 3 of the execution plan.
The optimizer cannot merge a view that contains a set operator.
- SQL Profile "SYS_SQLPROF_01306b26f6aa0000" exists for this statement and
was ignored during the tuning process.afzal wrote:
Hi
what should be take action against following sql tuning report.
<snip>Perhaps no action at all.
You can ALWAYS produce a report that will show "top 5" issues. The question is NOT "do I have an issue reported by a tuning report". Yes you do. Everyone does. Always. Even if you slowest batch job runs in 1.3 seconds and your slowest OLTP transaction completes in 0.0001 second.
The question is "do I have a problem that is serious enough to spend time solving?"
If your average OLTP transaction completes in 3 seconds, how much effort is justified to get a 50% improvement?
How much effort is justified to get that same 50% improvement on transactions that complete in 1.5 seconds? 0.2 seconds?
Beware of Compulsive Tuning Disorder. -
What software do i need to convert AVCHD mts/mts2 files to import to iMovie
What software do i need to convert AVCHD mts/mts2 files to import to iMovie
As Kirk says, if you have your camera, you can attach it directly.
Further, if you preserved the entire file structure of your camera (not just the .mts files, but also the folders on the camera), then you can import from that via FILE/IMPORT FROM CAMERA ARCHIVE.
When you import from a camera, it is recommended that you keep a camera archive so you always have the originals available.
If you have the .mts files out of context, you will need a third party app to convert. Two that I know of are ClipWrap and Voltaic HD. You should convert the files to Apple Intermediate Codec. And then use FILE/IMPORT/MOVIE. -
What is the system doing when I empty a large file from the trash?
I am in the process of deleting my old iPhoto library. When I installed OS X 10.10.3 it created a new Photos Library.photoslibrary and left the old iPhotos library as an archive. The old library is 249 gigabytes. I don't have "Empty Trash securely" on, and yet it is taking hours for the Finder to empty the trash with the 249 gigabyte iPhotos library in it. What is odd is that for a time, the amount of free space on my MacBook was increasing. It went from 77 GB to 88 GB, and then it started dropping all the way to 70 GB free. Now it is back up to 83.61 GB free.
What is the Finder doing when it deletes a huge file? I realize that the iPhotos Library is not a single file, but contains hundreds of folders and thousands of files. Still I find it odd that it is taking it so many hours to delete, and that the amount of free space on my Mac goes up and down and up. Can someone explain this?
It has been deleting for 4 hours and based on the "Emptying the Trash …" progress bar, it should take another two to three hours.Yes, but why would the space available go up and down and up as the files are deleted? If the Finder is deleting the files, shouldn't the free space on the drive be steadily increasing as the Trash is emptied?
-
What does servlet-name & jsp-file tags do...
Could someone please tell me how does the following tags pair work, in a JSP/servlet based application.
<servlet-name>Hellow</servlet-name>
<jsp-file>/Appl/Jsp/process.jsp</jsp-file>
What is the relationship between the Hellow and the /Appl/Jsp/process.jsp file
Regards
ANWhen you register a servlet in the deployment descriptor, you must always specify <servlet-name>. The other required parameter is EITHER <servlet-class> OR <jsp-file>. For a standard servlet, use <servlet-class>, for a JSP use <jsp-file>.
Servlets are always registered, JSPs are not. The reason to register a JSP is to set other values such as <load-on-startup>. In this case, the JSP must be converted to a servlet before deployment.
Read the servlet spec for a better and fuller description. -
How can I change (or select) what is being being used when I share, as the file cover. When I Share lets say "Master File" i want to select a frame that is used as the file cover. So when its on my desktop I see this image as the file icon.
I don't think Finder does this (I've tried).
iTunes does though. Where you can set artwork or the "poster frame"...
This may not be what you want but if it helps, I know 2 ways do this is
Open the video in QuicktimePlayer7 | View | Set Poster Frame (even then, you might need to save it as .mov (ie in a 'mov container').
Drag the file into iTunes and set the artwork (as in http://www.dummies.com/how-to/content/adding-album-cover-art-or-images-in-itunes .html)
From there, iTunes will use that frame as the "poster frame" ie the photo/frame that shows when you browse your videos. Which is what you want, but limited to iTunes.
When I do either of these above, the frame I set does not show when exploring files in "Finder" (or in the other Explorer tool I use called "Pathfinder").
So it maybe, that exactly what you want, is not possible. -
At the time of reindex what should we take care ?
Hi All,
1. When we reindex the table, what precausion to be take care. If the table having partition, triggers - Should we take a backup of these ?
2. How to compress/defragment the table ?
Regards,
Rajan B1 - reindex how? Do you mean drop/re-create index to reorganize it? You should probably use ALTER INDEX x REBUILD instead, but it is rarely necessary to rebuild Oracle indexes. You should make sure the target tablespace has ample free space to hold the resulting index plus if you rebuild in the existing tablespace that means it needs enough free space to hold two copies while the command runs.
If you are changing the index to add or remove columns to support queries then you likely want to perform this action at a time when the table is not needed for update activity.
2 - If this would be beneficial you could use either alter table move commands or export/truncate/import (see Utilities manual entries for expdp or exp and impdp or imp depending on Oracle version)
HTH -- Mark D Powell -- -
What should I do not to loose my previous savings ...
Hi there again,
I have been using PC suits for many years. Starting from my phone the 8250.
I have saved all my sms/text massages in my PC suit from the 8250 and 6230 phones.
Now I have a 6680 phone. Have installed the PC suit newer version for 6680. All my inbox, outbox, drafts and sent messages cant be seen in the phone editor anymore. therefore i re-installed the version for the 6230.
what should I do?
Also I would like to change my computer, how can I copy all the Folders I have created over the years in my old PC suit for the 6230 phone.
The answers to the above question will be grately appreciated it, since I have bought the 6680 at the beginning of 2006 but havent used it, cause of the above problem. I like to keep track of my messages, but could only do so with the PC Suits versions suitable for the 6230.
Pls note :
I am using the PC suits which came with the CD-ROM package of the phones.
My connection methods are : either infrared or cable data.Hi there again,
I have been using PC suits for many years. Starting from my phone the 8250.
I have saved all my sms/text massages in my PC suit from the 8250 and 6230 phones.
Now I have a 6680 phone. Have installed the PC suit newer version for 6680. All my inbox, outbox, drafts and sent messages cant be seen in the phone editor anymore. therefore i re-installed the version for the 6230.
what should I do?
Also I would like to change my computer, how can I copy all the Folders I have created over the years in my old PC suit for the 6230 phone.
The answers to the above question will be grately appreciated it, since I have bought the 6680 at the beginning of 2006 but havent used it, cause of the above problem. I like to keep track of my messages, but could only do so with the PC Suits versions suitable for the 6230.
Pls note :
I am using the PC suits which came with the CD-ROM package of the phones.
My connection methods are : either infrared or cable data. -
I have a 27 min. avi file that has a lot of still imagery with motion effects. When I export this as an .mov file with default settings, there is flickering on some of the landscape imagery. This doesn't occur in the native file. What are the optimal settings to correct this problem and produce the best quality end product on a DVD?
So what are good options for file conversion from mpg? Usually I simply use QuickTime Pro (augmented with to view and occasionally trim and splice video clips from various sources, including web page-linked .mpgs and .flvs This has a lot of limitations - poor picture quality, not recognizing spliced clips, exported files blowing up to as much as 50x the original filesize and more. No doubt the answer is partly, "you get what you pay for" but I'm not sure how much better specific commercial applications will work for me.
When I look at video file properties in any application, e.g. QT or VLC, there are always many parameters I don't think are important, but am not sure. Is there a good simple guide to the structure and hierarchies of various video file types which can help explain and identify the characteristics to look for when setting file conversion controls? -
I record with a sony ax2000 and use the 1080 60i setting. what settings should I edit with when using adobe premiere elements 10?
smannino
You have duplicate threads on this issue related to project preset suggestion for your 1080 60i video.
I have responded to your question in the other thread
if i record with a sony ax2000 using 1080 60 i what is the best editing setting to use with elements 10?
Please reply in that other thread.
Thank you.
ATR -
Hi, I want to download shazam so I hit FREE and then download. When it goes to homescreen It appears "Invalid Address"!!!! What should I do!?!?!?!?
The GB size of the download file is the compressed size (like .zip or .dmg). When the file is installed/uncompressed it can be 2-3 times larger.
How much space is used by your Other? You may be able to reduce.
How Do I Get Rid Of The “Other” Data Stored On My iPad Or iPhone?
http://tinyurl.com/85w6xwn
With an iOS device, the “Other” space in iTunes is used to store things like documents, settings, caches, and a few other important items. If you sync lots of documents to apps like GoodReader, DropCopy, or anything else that reads external files, your storage use can skyrocket. With iOS 5/6, you can see exactly which applications are taking up the most space. Just head to Settings > General > Usage, and tap the button labeled Show All Apps. The storage section will show you the app and how much storage space it is taking up. Tap on the app name to get a description of the additional storage space being used by the app’s documents and data. You can remove the storage-hogging application and all of its data directly from this screen, or manually remove the data by opening the app. Some applications, especially those designed by Apple, will allow you to remove stored data by swiping from left to right on the item to reveal a Delete button.
Cheers, Tom -
What is the safest way to convert a CS5.5 file to CS6?
At the agency I work at, we've recently had issues with information loss in documents when opening a CS5.5 file in CS6 and vice versa. So, is there a better way to convert besides saving a CS5.5 .INDD file as a .IDML to open in CS6? And if not, is there a way to compare either the .INDD/.IDML files or the exported .PDFs without having to go line-by-line on every page?
I've found Acrobat Pro's document compare feature very useful for some jobs, and irritating for others. One of its modes amounts to light-tabling the two documents, but I usually want a text compare, most recently of a 450-pp. book, where the 250-pp. max. meant I had to do it in two chunks. Acrobat 9 seems happier with more RAM: I learned not to approach the 250-pp. max on my Vista64 machine with 8 GB, but the package seems more reliable on my Win7 machine with 16 GB. It often generates quite a few false positives, which take getting used to. Versions 7 and 8, if I recall correctly, would place the pages side-by-side, which I prefer; version 9 can still be made to do this, I'm note sure about X.
-
Problem when converting a 3d Autocad file to a 3d pdf
Hi all,
I am trying to convert a 3d .dwg file from autocad to 3d pdf using adobe 9 pro extended. The file I am trying to convert is actually a TIN from a survey. Within Autocad the TIN shows up as a series of contiguous triangles next to one another. I am able to change this visualisation via the "Visual styles manager" so it looks like a nice shaded surface rather than 1000's of triangles. However when I convert this to 3d pdf the pdf brings in all the triangles outlines rather than showing as a continuous shade (like in autocad). I am following the process of draging the drawing into Adobe then exporting to 3d reviewer and creating a .u3d file by exporting from reviewer. When the data is in 3d reviewer it still looks like it originally did in Autocad. But once I create the pdf from the .u3d file thats when it changes back to a series of triangles.
Does any one have any idea on how I could rectify this problem? I have attached a link to a screen shot I took. On the left is what the data looks like in Autocad (and ultimately what I would like the 3d pdf to look like. And on the right is the 3d pdf that I have managed to create.
Any help on this would be greatly appreciated.
Thanks, Grant
http://www.flickr.com/photos/50145309@N07/4602969238/sizes/l/I don't know much about Word these days but I know that Calibri is a MS font. There isn't any way you can stop the warnings. They are to help you. If they are so annoying ask the creator of the Word document to use another font, one that doesn't give you warnings.
If you can get the font you double click on the file and you'll get the possibility to install it. Search for the font on internet or on MS site
"Is there a 'clear all formatting' feature in Pages as there is in Word and would this remove the allegedly hidden Calibri font?!"
No, not that I can see but you can if you paste the content of a Word document and use PAste and Match style get a preset font but that is just for that particular document. -
Not able to run a JSP file in Tomcat 5.5
Hello friends i am new to JSP programming.
I recently designed a application to enter values of certain field in a database (Using SQL Server Database)
i used a file name Register.jsp, so when the action is performed by clicking submit button it use to call another file named Register_DB.jsp in which database insertion is performed this 2nd file includes another .java file which is actually creating the JDBC ODBC connection drivers
but whenever i use to run the programme using tomcat-5.5 i use to get certain error as below ------------------->
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to load class for JSP
org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:591)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:137)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:305)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.ClassNotFoundException: org.apache.jsp.Registration_jsp
java.net.URLClassLoader$1.run(Unknown Source)
java.security.AccessController.doPrivileged(Native Method)
java.net.URLClassLoader.findClass(Unknown Source)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:158)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:71)
org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:589)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:137)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:305)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.
Apache Tomcat/5.5.9***********************************************************************************************************
So can anybody tell me what should i do to resolve this error
here is the code what i have written
File Name Registration.jsp
<!-- ***** File Name Test.jsp ***** -->
<%@ import="Login.connectionBean" %>
<%@ language="java" %>
<%@ import="java.io.*" %>
<%@ import="java.sql.*" %>
<%@ import="javax.sql.*" %>
<jsp:useBean id="sq" scope="page" class="Login.connectionBean" type="connectionBean"/>
<jsp:setProperty name="sq" property="*"/>
<html>
<!-- DW6 -->
<head>
<!-- Copyright 2005 Macromedia, Inc. All rights reserved. -->
<title>Registration Form</title>
</head>
<body>
<form name="Test" action="Registration_DB.jsp" method="get">
<table width="100%" border="0">
<tr>
<td colspan="5"></td>
</tr>
<tr>
<td width="10%" height="250"></td>
<td width="90%" colspan="4"><div align="center">
<table width="437" border="1">
<tr>
<td><div align="center">User ID </div></td>
<td> </td>
<td><div align="center">
<input name="User_ID" type="text" size="25" maxlength="25" />
</div></td>
</tr>
<tr>
<td><div align="center"></div></td>
<td> </td>
<td><div align="center"></div></td>
</tr>
<tr>
<td width="149"><div align="center">User name </div></td>
<td width="27"> </td>
<td width="239"><div align="center">
<input name="User_Name" type="text" size="25" maxlength="25" />
</div></td>
</tr>
<tr>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
</tr>
<tr>
<td><div align="center">Password</div></td>
<td> </td>
<td><div align="center">
<input name="Password" type="text" size="25" maxlength="25" />
</div>
</td>
</tr>
<tr>
<td><div align="center"></div></td>
<td> </td>
<td><div align="center"></div></td>
</tr>
<tr>
<td><div align="center">
<input name="Button_Reset" type="reset" value="Reset Fields" />
</div></td>
<td> </td>
<td><div align="center">
<input name="Button_Submit" type="reset" value="Submit Details" />
<%
String User_Id=request.getParameter("User_Id")
String User_Name="";
String Password="";
%>
<%
try
sq.connect();
if(user_Id!==null && User_Id!="")
ResultSet rs2.sq.execQuery("select User_Name FROM User_Login where User_Id='"+User_Id+"'");
catch(Exception e)
out.println("Exception Caught" +e);
e.printStackTrace();
%>
</div></td>
</tr>
</table>
</div></td>
</tr>
</table>
</form>
</body>
</html>***********************************************************************************************************
File Name Registration_DB.jsp
<!-- ***** File Name Test_DB.jsp ***** -->
<%@ language="java" %>
<%@ import="Login.connectionBean" %>
<%@ import="java.sql.*" %>
<%@ import="javax.sql.*" %>
<%@ import="java.io.*" %>
<jsp:useBean id="sq" scope="page" class="Login.connectionBean" type="connectionBean"/>
<jsp:setProperty name="sq" property="*"/>
<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<%
String Button_Submit = request.getParameter("Button_Submit");
String User_Id = request.getParameter("User_Id");
String User_Name = request.getParameter("User_Name");
String Password = request.getParameter("Password");
%>
<%!
ResultSet rs1=null;
ResultSet rs2=null;
%>
<%
try
sq.connect();
if(Button_Submit!=null && Button_Submit!="")
String qry="INSERT INTO User_Login (User_Id, User_Name, Password) VALUES('"+User_Id+"','"+User_Name+"','"+Password+"')";
int i=sq.executeUpdae(qry);
if (i>0)
response.sendRedirect("Registration.jsp");
catch(Exception e)
out.println("Exception Caught" +e);
e.printStackTrace();
%>
</body>
</html>***********************************************************************************************************
File name connectionBean.java
package Login;
import java.sql.*;
public class connectionBean
private Connection con;
public connectionBean()
super();
public boolean connect() throws ClassNotFoundException, SQLException
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:JAVA"," "," ");
return true;
public void close() throws SQLException
con.close();
public ResultSet execQuery(String qry) throws SQLException
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery(qry);
return(rs==null)?null:rs;
public int execUpdae(String qry) throws SQLException
Statement stmt=con.createStatement();
int i=stmt.executeUpdate(qry);
return(i==0)?0:i;
}hi
here the problem is tat the server culdnt find the class for u page,
check u hav deployed it properly or not,
check the tomcat installation and is it working fine,
regards
venkat -
Java class bean can not access to DB in JSP file
Hi, I wrote a java class bean in order to access to MySql database ,and this bean is used in a JSP file,so that the bean can query from DB and then display the queried information on the JSP file,but it can not work correctly,the following is the source code and error message popup by the system,
does anybody has experience in solving thus question,Please reply ,Thank you for your help.
%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import = "java.sql.*" %>
<jsp:useBean id="conn" scope="page" class="news.conn"/>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>1</title>
<style>
<!--
A:link {
COLOR: #993399
.s {
FONT-SIZE: 13px; LINE-HEIGHT: 170%; FONT-FAMILY: "utf-8"
-->
</style>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
<tr>
<td width="100%">
<img border="0" src="images/ruanjian.jpg" width="770" height="154"></td>
</tr>
<tr>
<td width="100%">@</td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber2">
<tr>
<td width="13%">@</td>
<td width="87%">
<img border="0" src="images/mid-rdxw2.gif" width="101" height="18"><p>
<%
ResultSet rs,rsNest;
String strSql=null;
strSql = "select * from news where TYPE=1";
rs = conn.executeQuery(strSql);
while (rs.next()){
%>
<span class="s"> <a href="newsContent.jsp?newsId=<%=rs.getInt(id")%">"><%=rs.getString("Title")%></a><br>
<%
%>
<p>
<img border="0" src="images/mid-hyxw2.gif" width="94" height="19"></p>
<%
strSql="select * from news where TYPE=2";
rs = conn.executeQuery(strSql);
while (rs.next()){
%>
<span class="s"> <a href="newsContent.jsp?newsId=<%=rs.getInt("id")%>"><%=rs.getString("Title")%></a><br>
<%
%>
<p>@</td>
</tr>
</table>
<p align="center">Study Online</p>
<p align="center">@</p>
</body>
</html>
Error message:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Exception in JSP: /newsMain.jsp:47
44: strSql = "select * from news where TYPE=1";
45: rs = conn.executeQuery(strSql);
46:
47: while (rs.next()){
48:
49: %>
50:
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
root cause
java.lang.NullPointerException
org.apache.jsp.newsMain_jsp._jspService(newsMain_jsp.java:98)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.27 l</a>nogoodatcoding wrote:
Tolls wrote:
Is that Jasper Exception telling us where the problem is in the jsp, though?
If it is, then "rs" is null in the call rs.next()...which means conn.executeQuery() is returning null. Which means that whatever class conn is (news.conn?) has a problem maybe?That's possible. Though, it may just be the case that the 'conn' object itself is null! That line is the first place where it's being used and there are no checks that I can see...we'll have to wait for the OP to investigate and reply I guess.That's what I originally thought, then I noticed it was saying line 47, which is the rs.next() line. Assuming Jasper is correct in its choice of line, then it's the rs that's null. Which means the conn is doing strange things.
Edit: Now that I think about it, going by the previous thread the OP posted, I'm wondering whether news.conn class is their attempt to move the JDBC stuff out of the JSP page, and it's grabbing the "real" connection (java.sql.Connection) and getting the result set and returning it...or getting something wrong and returning null.
Edited by: Tolls on 11-Jun-2009 12:24
Maybe you are looking for
-
hi all. SAP Tickets - What Is That? Handling tickets is called Issue Tracking system. The errors or bugs forwarded by the end user to the support team are prioritized under three seviority High, Medium and Low. Each and every seviority as got its tim
-
My husband and my itunes have been disabled. Our credit card was stolen and I think there was some theft to our itunes acct too. I have put our new credit cards in accounts but we still cannot use itunes. Please help, I cannot seem to access anyone.
-
Display external html page in (Collapsible Panel widget)
i everybody is there a way to display external html page in (Collapsible Panel widget) All the example a seen is with raw text in it is the panel can display different object instead of simple text At least a internal designed html page Thanks
-
How could i migrate large tables multi-million row from Oracle 8i to 9i.Pls explain me the process
-
[SOLVED] Econnman fails during build
Trying to install econnman for E17 on a new system but it fails saying 400: bad request. I'm not sure what to do here. All the dependencies have been met. makepkg -s ==> Making package: econnman-svn 79483-1 (Wed Jan 23 11:10:52 EST 2013) ==> Checking