Getting troubles in getting the JSP page
hi friends,
Let me tell u first i m using Tomcat 5.5 and Internet Explorer .
I think i have some problem in Tomcat. Coz I have made an JSP page which has a simple coding as follows
<%@ page language="java" contentType="text/html" %>
<html>
<body bgcolor="green">
<font size=5 color="red">
<%! int i=5%> <%= "The i value is "+i %>
<h1>Let's cheak if its working or not. </h1>
</font>
</body>
</html>Let me tell u i don't want to do anything ,except getting valid response from a JSP page.
i believe nothing is wrong with this page but when ever i m giving request for JSP page i m getting a blank page(a page of white colour though i have set bgcolor to be 'green'). But if i m giving request for Servlet and HTML pages then it's running fine . Can anyone advice me what to do.
Let me tell u one more thing i.e when i m giving request 4 a JSP page the corresponding Servlet (the java file as well as .class file) is being formed by Tomcat. But still i m not getting my output.
I hope i m clear in communicating my problem.
Please suggest some solution what to do.
with regards
Arunabh
save the above as test.jsp ..place it in webapps....
important thing is check the path name u give in ur
url
http://10.32.246.55:8080/Activit/tex.jsp... in
my system i have a folder called Activit in webapps
so no need to mention webapps in url.... mention the
ip address ..if u r runnin the application on the
system where tomcat is installed then instead of ip
address u can mention as localhost .. do
mention port no. also ... think by default port no is
8080...
it should work cauz it worked in my systemIf it worked in ur system then i suppose somthing is wrong with my tomcat. Is it so ?????
Arunabh
Similar Messages
-
This is my jsf(jsp) page:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<f:view>
<h1 align="center">File Selection Page</h1>
<h:panelGroup>
<form id="uploadForm" method="post" action="Multipart.do" enctype="multipart/form-data">
Specify your name:<br />
<input type="text" name="name"><br /><br />
Specify your files: <br />
<input type="file" name="file1"><br /><br />
<input type="file" name="file2"><br /><br />
<input type="file" name="file3"><br /><br />
<input type="file" name="file4"><br /><br />
<br><br>
<center>
<input type="submit" name="Submit" value="Submit Your Files">
</center>
</form>
</f:view>
</body>
</html>I am using apache commons multipart file upload. How do I post success or failure messages to this page?
As you see I am using a servlet(not shown - which uses Faces Context to populate the messages). Not sure how to get these out in the jsp page.
Thanks,
Sonia
Edited by: sun_sonia on Nov 23, 2009 2:42 PMYou're using plain HTML <input type="file"> elements. Use Tomahawk's <t:inputFileUpload> components instead of you want to make use of JSF's validation and messaging capabilities.
If you insist in using a servlet instead of a bean for this, then just do all the usual JSP/Servlet way. My suggestion would be to hold a Map<String, String> which contains the fieldname-message pairs which you store in the request scope and then use the usual JSP/EL way to display them. -
Help needed urgently to get the values from the jsp page.
hi,
I am badly stuck into this problem.Please help me and find a solution.
I am using ms-access and jsp.
my database structure is as given below:
m_emp_no | from_date | to_date | approver| status |
1002 | 22/9/2008 | 23/9/2008|1003 |pending
1004 | 29/9/2008 | 30/9/2008|1003 |pending
2044 | 15/9/2008 | 16/9/2008|3076 |pending
now this is exactly a leave apply scenario where a page is displayed and the user has to fill in the details to apply leave.then the approver has to approve that leaves so even, he should get the details in his account.
for example here 1003 has to approve leaves for 1002 & 1004.i am able to fetch data from database for the particular approver here is the coding:
<html>
<body>
<h2 align="center"><u><b><span style="background-color: #FFFFFF"><font color="#C0C0C0" face="Comic Sans MS">Leave
Approval Requests</font></span></b></u></h2>
<form method="POST" name="f1" action="update.jsp">
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:employee_details");
PreparedStatement p=null;
p=con.prepareStatement("select * from emp_leave_application where approver='"+username+"'");
ResultSet r=p.executeQuery();
while(r.next())
%> <table border="1" width="100%" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
<tr>
<td width="100%" bgcolor="#999966"><b><u><%=r.getString(2)%></u></b></td>
</tr>
</table>
<table border="1" width="100%" height="171" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
<tr>
<td width="100%" height="165" valign="top">
<p align="left"><b>User ID</b> :
<input type="text" name="id" value="<%=r.getString(1)%>" size="4
<b>status</b>:<%=r.getString(5)%</p>
<p><b>Leave From</b> : <%=r.getString(2)%></p>
<p><b>Leave From</b> : <%=r.getString(3)%></p>
<p><b>Approve</b> : <select size="1" name="approved">
<option value="Approved">Approved</option>
<option value="Cancelled">Cancelled</option> </select></p>
<%
con.close();
%>
<table border="1" width="100%" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
<tr>
<td width="100%" bgcolor="#999966">
<p align="center"><input type="reset" value="Clear" name="B1">
<input type="submit" value="Submit" name="B2"></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>{code}
this will display both the rows but when i try to retrieve the values into update.jsp using the code given below it gives me only one value which is the first 1002.
{code}approved=(String)request.getParameter("approved");
id=(String)request.getParameter("id");{code}
but i need both the values to be inserted into the update.jsp only then the approver will be able to approve the leaves individually with respect to the m_emp_no.
please help me out.
thanks in advance.My comments below are all between (((((( and ))))))
<html>
<body>
<h2 align="center"><u><b><span style="background-color: #FFFFFF"><font color="#C0C0C0" face="Comic Sans MS">Leave
Approval Requests</font></span></b></u></h2>
<form method="POST" name="f1" action="update.jsp">
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:employee_details");
PreparedStatement p=null;
p=con.prepareStatement("select * from emp_leave_application where approver='"+username+"'");
ResultSet r=p.executeQuery();
while(r.next())
%> <table border="1" width="100%" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
<tr>
<td width="100%" bgcolor="#999966"><b><u><%=r.getString(2)%></u></b></td>
</tr>
</table>
<table border="1" width="100%" height="171" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
<tr>
<td width="100%" height="165" valign="top">
<p align="left"><b>User ID</b> :
<input type="text" name="id" value="<%=r.getString(1)%>" size="4
((((((( in the statement above, name="id" should be changed to something like name="id"<%=ii%>
Where ii is a counter that tells you how many times you have gone through the loop so far.
The reason for this is that each textfield you generate must have a unique name rather than all have the same name
such as 'id'. This change will give them names such as id0, id1, id2. Then when you submit the page, you can uniquely
identify each input textfield.))))))
<b>status</b>:<%=r.getString(5)%</p>
<p><b>Leave From</b> : <%=r.getString(2)%></p>
<p><b>Leave From</b> : <%=r.getString(3)%></p>
<p><b>Approve</b> : <select size="1" name="approved">
(((( the above select also has to have a unique name for each time through the loop. Change it to name="approved"<%=ii%>
<option value="Approved">Approved</option>
<option value="Cancelled">Cancelled</option> </select></p>
<%
con.close();
%>
<table border="1" width="100%" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
<tr>
<td width="100%" bgcolor="#999966">
<p align="center"><input type="reset" value="Clear" name="B1">
<input type="submit" value="Submit" name="B2"></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>
(((((((note you would be better off long term to put your business logic in a servlet and dispatch to the JSP page which will only have the responsiblity to display the data.
Also, connection pooling is better than the above. -
How to get the jsp page name in jsp?
how to get the jsp page name in jsp? how the jsp get the jsp page name dynamic.
thanks in advance.Try request.getServletPath()
-
Get Javascript Value in a JSP page
Let's say this is my javascript function in a html page
.<head>
<!-- Function getFields -->
function getFields(){
if (row >= 0){
for(var i=0; i<costForm.elements.length; i++){
if(costForm.elements.type == "text" || costForm.elements[i].type == "hidden"){
dynTableFields[i] = (costForm.elements[i].value)? costForm.elements[i].value : "";
if(costForm.elements[i].type == "select-one"){
dynTableFields[i] = costForm.elements[i].selectedIndex;
</head>
How do i get the costForm.elements.length value in another jsp page. Coz the html page has dynamic rows by the users. and i need the values in the jsp page to know how many rows the user created.
using normal request.getParameter("costForm.elements.length") doesn't workrequest.getParameter() will only get data that's been submitted thru a form or the query string of a URL. You'd have to record the length in a hidden field to read it on the back end, and then you can't just loop thru the fields like that in JSP on the server anyway, unless you have all fields named with a prefix and number, like: field1, field2, field3, etc.
-
When I AirPrint The printer only prints a portion of the page. How do I get it to print the whole page.
It would help if you stated what printer you are using and what application you are doing the printing from. Also, what are you printing?
-
My iphone4 has the correct Apple ID in the information settings section and asks me to login to my ID most of the time but when I try to update my apps, it asks me to login with an ID that isn't mine. I deleted the wrong ID from my itunes but it still won't let me login with my own ID to update apps. How do I get my iphone on the same page?
How did you obtain these apps? All apps are DRM protected & tied forever to the account used to originally obtain them. They cannot be transferred to another Apple ID(account), nor can they be updated using any Apple ID other than the one that was used to originally obtain them.
-
How can I set home page for a new tab? how can i get firefox to open the home page every time i open a new tab in Windows vista home basic??
== This happened ==
Every time Firefox openedFirefox can have multiple home pages if you wish. Each home page that will open when starting Firefox is separated by the "|" character.
See: http://support.mozilla.com/en-US/kb/How+to+set+the+home+page
To have new tabs open a specific web site, add one of the following extensions:
http://sogame.awardspace.com/newtaburl/
https://addons.mozilla.org/en-US/firefox/addon/777 -
I am unable to log into the server wiki. I can get as far as the login page.
When I attempte to log into our company server wiki I can get as far as the login page.
When I type in any user/pass all I see is a spinning wheel on the login panel.
The error that is occuring in the back ground is as follows
ActiveRecord::StatementInvalid in LoginController#plain_login
SQLite3::SQLException: attempt to write a readonly database: INSERT INTO "users" ("uid", "created_at", "shortname", "longname", "generated_uid", "updated_at") VALUES (...)
I have confirmed that the postgres server for collab is running and I am able to connect to it through a Database Utility. I can also verify through this database utility that the Wiki is in tact. I do not know where else to go form here or if the errors I am seeing are not related to the wiki.
I am open to any possible assistance through this endeavor. I am running a Mac OS X server version 10.7.5.Thank you so much. I deleted all of the Netflix history and the cookie. and it works fine now. Thank you again.
-
I keep getting booted back to the home page when trying to open apps.
When trying to launch an app I get booted back to the home page.
Hey there marvel10,
I understand that you are experiencing issues with your ability to launch certain apps on your iPad. There is an article on Apple’s knowledge base about this issue, and the article can be found below:
If an app you installed unexpectedly quits, stops responding, or won’t open - Apple Support
http://support.apple.com/en-us/HT201398
Thanks for being a part of the Apple Support Communities!
Cheers,
Braden -
Problem in Retrieve Image from DB and display in the JSP page
Hi All,
I did one JSP Program for retriveing image from DB and display in the JSP Page. But when i run this i m getting "String Value" output. Here i have given my Program and the output. Please any one help to this issue.
Database Used : MS Access
DSN Name : image
Table Name: image
Image Format: bmp
Output : 1973956
Sample Program:_
<%@ page contentType="text/html;charset=windows-1252"%>
<%@ page import="java.io.*" %>
<%
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection("jdbc:odbc:image");
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery("SELECT images FROM image");
String imgLen="";
if(rs.next()){
imgLen = rs.getString(1);
out.println(imgLen.length());
if(rs.next()){
int len = imgLen.length();
byte [] rb = new byte[len];
InputStream readImg = rs.getBinaryStream(1);
int index=readImg.read(rb, 0, len);
System.out.println("index"+index);
st.close();
response.reset();
response.setContentType("image/jpg");
response.getOutputStream().write(rb,0,len);
response.getOutputStream().flush();
}catch(Exception ee){
out.println(ee);
%>
Thanks,
Senthilkumar Svishruta wrote:
<%
%>Using scriptlets is asking for trouble. Java code belongs in Java classes. Use a Servlet.
out.println(imgLen.length());Your JSP was supposed to write an image to the output and you wrote some irrelevant strings to the output before? This will corrupt the image. It's like opening the image in a text editor and adding some characters before to it.
byte [] rb = new byte[len];Memory hogging. Don't do that.
out.println(ee);You should be throwing exceptions and at least printing its trace, not sending its toString() to the output.
You may find this article useful to get an idea how this kind of stuff ought to work: [http://balusc.blogspot.com/2007/04/imageservlet.html]. -
Junk characters like" � � "displayed in the jsp page please help.
Hi,
I am getting junk characters like � � displayed in the jsp page.
In the JSP page i used javascript "& nbsp" for appending spaces to a string "CCR" to get "CCR " .
Now the Resultant string "CCR " has three spaces appended to its right.
This String is set in session in that JSP page.
In the next JSP page i am getting that string from session.
After getting the string the "substring" function is performed to get only the first 5 charcters of the string. Now the result is displayed as " CCR� � " with has last 2 characters as junk values � � insteed of displaying as "CCR ". Please help me in solving this issue.
Please note that initially the sting "CCR" is got from the Oracle database in Solaris Machine.
Regards,
Vijayhave you tried:
strenuously inspecting the string that is coming from the db? do an actual loop over the string, character by character, dumping to System.out to make sure the characters are EXACT coming out of the db.
note you have to append " " not just "& nbsp"
post the code that is doing the output. the relevant bean code, the jsp, everything relevant - WITH COMMENTS discussing where things are happening.
Also, is it "weird characters" in the browser only? have you done a view source on the actual html source that the browser is rendering (right click in IE and click view source). browsers can act odd if you don't feed then exactly what they want, and it looks like you're feeding it escaped characters that it is rendering as something else. -
Error in parsing the taglib tag in the JSP page
Hi
We are trying to deploy and run a Web Application in CE 7.1 SP01. We are successful in deploying and running servlet based web pages, but when it comes to JSP's the taglibs are not parsed and we get the following error message
Runtime error in processing of the JSP file E:\usr\sap\CE1\J01\j2ee\cluster\apps\sap.com\TestNWEAR\servlet_jsp\TestNW\root\admin\main.jsp.
The error is: com.sap.engine.services.servlets_jsp.jspparser_api.exception.JspParseException: Error in parsing the taglib tag in the JSP page. Cannot resolve URI: [webwork]. Possible reason - validation failed. Check if your TLD is valid against its scheme.02004C4F4F5000190000004E000013400191D308B45
Processing HTTP request to servlet [jsp] finished with error.
The error is: java.io.FileNotFoundException: E:\usr\sap\CE1\J01\j2ee\cluster\apps\sap.com\TestNWEAR\servlet_jsp\TestNW\root\admin\webwork (The system cannot find the file specified)02004C4F4F50001900000051000013400191D308B45AF1AB
We followed the below weblog to correct the TLD's in JAVA EE 5 @ SAP but it did not work for us.
/people/community.user/blog/2006/10/13/porting-the-java-blueprint-solutions-catalogue-applications-to-sap-netweaver-application-server-java-ee-5-edition
Any immediate help will be rewarded with full points
Thanks in advance
Lakshmi
Edited by: lakshmi N Munnungi on May 5, 2008 11:36 PM
Edited by: lakshmi N Munnungi on May 5, 2008 11:39 PMHi Lakshmi,
I have also the same problem. If you have found the solution please post it thanks,
Thanks,
Tariq -
How to load only the jsp page even after applying template
Hi,
I have a webpage template with header,footer, Dynamic Menu etc. Now I assigned this .jtpl template to all my existing fases jsp files.
The problem is when I submit a form in jsp, the entire page including template gets loaded again by which we can notice significant time for loading menus and other things.
Is there any way to avoid this entire template loading and make only the jsp page to load? Please help
May be this can be achieved by frames. But I dont have idea on how I can merge template with frames. If someone can provide that even would help me better.
Thanks in advance.Hi
I found the solution .
<html>
<head>
<script language="JavaScript">
function checkRefresh()
if( document.refreshForm.visited.value == "" )
alert('first ime');
// This is a fresh page load
document.refreshForm.visited.value = "1";
// You may want to add code here special for
// fresh page loads
else
</script>
</head>
<body onLoad="JavaScript:checkRefresh();">
<form name="refreshForm">
<input type="hidden" name="visited" value="" />
</form>
</body>
</html> -
Pass the data back from the jsp page to the java code
Hi,
I have written an iView that receives an event using EPCF and extracts data from the client data bag.
I need this iView to pass the data back from the jsp page to the java code.
I am trying to do this using a hidden input field, but I cannot get the code to work.
Here is the code on the jsp page.
<%@ taglib uri="tagLib" prefix="hbj" %>
<hbj:content id="myContext" >
<hbj:page title="PageTitle">
<hbj:form id="myFormId">
<hbj:inputField id="myInputField" type="string" maxlength="100" value="" jsObjectNeeded="true">
<% myInputField.setVisible(false);%>
</hbj:inputField>
</hbj:form>
</hbj:page>
</hbj:content>
<script language=JavaScript>
EPCM.subscribeEvent("urn:com.peter", "namedata", window, "eventReceiver");
function eventReceiver(eventObj) {
var url = eventObj.dataObject;
var funcName = htmlb_formid+"_getHtmlbElementId";
func = window[funcName];
var ipField = eval(func("myInputField"));
ipField.setValue(url);
var form = document.all(htmlb_formid);
form.submit();
</script>
Here is my java code
package com.sap.training.portal;
import com.sapportals.htmlb.InputField;
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;
public class ListSalesOrder extends PageProcessorComponent {
public DynPage getPage(){
return new ListSalesOrderDynPage();
public static class ListSalesOrderDynPage extends JSPDynPage{
private String merong;
public void doInitialization(){
public void doProcessAfterInput() throws PageException {
InputField reportfld = (InputField) getComponentByName("myInputField");
if (reportfld != null) merong = reportfld.getValueAsDataType().toString();
public void doProcessBeforeOutput() throws PageException {
if ( merong != null ) setJspName("merong.jsp");
else setJspName("ListSalesOrder.jsp");
Here is DD
<?xml version="1.0" encoding="utf-8"?>
<application>
<application-config>
<property name="SharingReference" value="com.sap.portal.htmlb"/>
<property name="PrivateSharingReference" value="com.sap.portal.htmlb"/>
</application-config>
<components>
<component name="SearchSalesOrder">
<component-config>
<property name="ComponentType" value="jspnative"/>
<property name="JSP" value="/pagelet/SearchSalesOrder.jsp"/>
</component-config>
<component-profile>
<property name="tagLib" value="/SERVICE/htmlb/taglib/htmlb.tld"/>
</component-profile>
</component>
<component name="ListSalesOrder">
<component-config>
<property name="ClassName" value="com.sap.training.portal.ListSalesOrder"/>
</component-config>
<component-profile>
<property name="tagLib" value="/SERVICE/htmlb/taglib/htmlb.tld"/>
</component-profile>
</component>
</components>
<services/>
</application>
After receive event, then call java script function "eventReceiver" and call "form.submit()".
But .. PAI Logic in Java code doesn't called ...
Where is my problme ?
Help me ...
Regards, Arnold.Hi Arnold,
you should not do a form.submit yourself. Instead you can put a component called ExternalSubmit to your page:
ExternalSubmit exSubmit = new ExternalSubmit("EX_SUBMIT"));
exSubmit.setServerEventName("MyEvent");
This results in a java script funtion on the page which is called "_htmlb_external_submit_". If you call this function the the form gets submitted and your event handler is called.
regards,
Martin
Maybe you are looking for
-
Can we rename an exisiting target in Grid Control
Hello Gurus We are upgrading a database from 10.2.0.5.0 to 11.2.0.2.0 and we are going to change the SID of the environment. I wanted to know if it was possible to change the target name (so that we can keep all historical data of the previous databa
-
Fatal exception errors after IE7 upgrade
After accepting the MS Auto update of IE6 to IE7 I had "Fatal exception error - DW is terminating" even when clicking on Help. Errors included "Browse_back enabled in toolbars.xml" and "get CurrentValue in AddressURL.htm" when trying to switch betwee
-
Hi all, I am trying to insert my company logo to the certification letter generated in SAP Script . By running the program RXTLXDMC i have uploaded my logo and inserted that in my standard text say "zabc" and i have called that std text in my se38 re
-
My power button doesnt work how can i turn off my device
my power button doesnt work how can i turn off my device
-
Implementing Network Protocol (Sockets)
Hi, I'm having a hard time to implement a network protocol on my project. I'm doing a socket program that pass iso8583 message to the server. But one of the requirements is a network protocol which is the length of the message that is 4 bytes. Here's