Is request.getContextPath() necessary?
I used to start a URL with request.getContextPath() for navigating any JSP files inside of the application. Since I can't pass it into a Javascript, I have a URL without it. The approach seems working so far. Does that mean that it isn't necessary to start a URL with request.getContextPath() ?
Using request.getContextPath() is handy if you are running a webapp that is not at the root context. For example, you can have 1 application running at the root context with 5 other apps on the same url running under their own context path - 1 url : multiple apps.
How your app is setup depends on how you use request.getContextPath(). For instance I use it frequently for path references in html snippets in my JSPs:
<script src="<%=request.getContextPath()%>/scripts/myDateFunction.js"></script>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/styles.css">Now no matter what context this runs under, I'll be garanteed it will look for the file under the requested context at it's root context:
http://localhost:8080/ = root context = "/"
http://localhost:8080/myApp/ = webapp "myApp" = "myApps" root context is "/myApp" + "/"
scripts lives in myApp:
myApp.war
-> /scripts/myDateFunctions.js
If I were to move my web application to a different context then I don't need any code changes as the request will always retrieve for me the correct context.
You can't exactly pass it to Javascript, but you can embed it in the javascript:
<script language="Javascript">
function goPage(pageName) {
document.location="<%=request.getContextPath()%>/admin/myPage.jsp";
</script>When the server writes this to the browser it will replace the <%=request.getContextPath()%> with the correct value.
Regards,
Anthony
Similar Messages
-
Hi,
I was using java script code in my JSP itself.This was working fine.but when i moved the code in .js file,it stopped working.!!!.
Please suggest how to make it work.
Cheers:
Akash.<%=request.getContextPath()%> won't work in a .js file. You can use a JSP file to generate javascript code by using content-type attribute of the page directive. To call this JSP page (which will actually generate the js code), you can either map the JSP page to a .js file in web.xml or use the URL to that JSP page directly in your JSP page where you are including that .js file. Basically this is what I mean
<script type="text/javascript" src="myjs.jsp"></script>Use the above in your calling page or the below (along with the mapping in your web.xml)
<script type="text/javascript" src="myjs.js"></script>web.xml
<servlet>
<servlet-name>MyJs</servlet-name>
<jsp-file>/myjs.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>MyJs</servlet-name>
<url-pattern>/myjs.js</url-pattern>
</servlet-mapping> -
How can i do to unlock my phone - they are requesting ativation necessary
I guys,
Im tring to sold a litle problem with my I-Phone 4S
Its appeare an diferent message in portugues - Ativacao Necessaria
Im tryng to do all step by steps but is not working
Someone can help me?Is it locked with a passcode? To a carrier? To an Apple ID?
What, exactly, do you see on the screen?
~Lyssa -
Forwarding requests on to non-java pages from servlet.
I have designed a web application using a form of single controller pattern.
I have a number of JSPs.
Each of these JSP's has a form element which if submitted got to a single servlet (Controller)which then forwards on the request to a different class based on the paramter passed. For example this form would call the SubmitFeedback class.
<form name="feedbackform" method="post" action="<%=request.getContextPath()%>/controller">
<input type="hidden" name="action" value="SubmitFeedback"/>
<input type="hidden" name="page" value="feedback.jsp">
<tr><td><input type="submit" name="go" value="Go"/></td></tr>
</table>
</form>After the class has done its processing it returns what page to go next to the Controller class and this forwards the request on. to the next jsp
String nextPage = createAction(request.getParameter(PARAM_ACTION)).handleRequest(this,request, response, request.getParameter(PARAM_PAGE));
request.getRequestDispatcher(nextPage).forward(request, response);
return;This is all fine but now I have a sitation where after the user submits the form I want do some processing then forward them onto another page which is not part of my system, nor java. But the RequestDispatcher is only for the current Context within a Servlet Container.
Could someone explain how I do this, what am Im missing please.i am not a JavaScript expert, so I can't be sure this is everything, but:
1) The javascript has to be put inside a <script></script> block (you also had an extra close bracket):
<script type="text/javascript">
<!--
function validateAccept() {
toReturn=true;
if (form.accept.checked==false) {
alert("You must select at least one checkbox to search");
toReturn=false;
return toReturn;
//-->
</script>The script block is usually put in the head section also, but that is not necessary.
2) I would call this function from the onsubit event of the form rather than the onclick of the submit button
<form name="form" action="..." method="post" onsubmit="return validateAccept();">
//...3) You will need to identify the form that you want to use inside the function. Just using the name form won't work, it has to be retrieved from a certain context. The easiest thing is to pass it in as a parameter:
<script type="text/javascript">
<!--
function validateAccept(form) {
<form name="form" action="..." method="post" onsubmit="return validateAccept(this);"> -
Unable get complete filepath from jsp page using request.getParameter()
Hey all,
i am actually trying to get the selected file path value using request.getParameter into the servlet where i will read the (csv or txt) file but i dont get the full path but only the file name(test.txt) not the complete path(C:\\Temp\\test.txt) i selected in JSP page using browse file.
Output :
FILE NAME : TEST
FILE PATH : test.txt
Error : java.io.FileNotFoundException: test.txt (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at java.io.FileReader.<init>(FileReader.java:55)
at com.test.TestServlet.processRequest(TestServlet.java:39)
at com.test.TestServlet.doPost(TestServlet.java:75)
JSP CODE:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!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=UTF-8">
<title>DEMO SERVLET</title>
</script>
</head>
<body>
<h2>Hello World!</h2>
<form name="myform" action="TestServlet" method="POST"
FILE NAME : <input type="text" name="filename" value="" size="25" /><br><br>
FILE SELECT : <input type="file" name="myfile" value="" width="25" /><br><br>
<input type="submit" value="Submit" name="submit" />
</form>
</body>
</html>
Servlet Code :
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, FileNotFoundException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
String filename = request.getParameter("filename");
out.println(filename);
String filepath = request.getParameter("myfile");
out.println(filepath);
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet TestServlet</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet TestServlet at " + request.getContextPath() + "</h1>");
if (filepath != null) {
File f = new File(filepath);
BufferedReader br = new BufferedReader(new FileReader(f));
String strLine;
String[] tokens;
while ((strLine = br.readLine()) != null) {
tokens = strLine.split(",");
for (int i = 0; i < tokens.length; i++) {
out.println("<h1>Servlet TestServlet at " + tokens[i] + "</h1>");
out.println("----------------");
out.println("</body>");
out.println("</html>");
} finally {
out.close();
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
Needed Output :
FILE NAME : TEST
FILE PATH : C:\\Temp\\test.txt
Any suggestions Plz??As the [HTML specification|http://www.w3.org/TR/html401/interact/forms.html] states, you should be setting the enctype to multipart/form-data to be able to upload files to the server. In the server side, you need to process the multipart/form-data binary stream by parsing the HttpServletRequest#getInputStream(). It is a lot of work to get it to work flawlessly. There are 3rd party API's around which can do that for you, such as [Apache Commons FileUpload|http://commons.apache.org/fileupload] (carefully read the User Guide how to use it).
You can also consider to use a Filter which makes use of the FileUpload API to preprocess the request so that you can continue writing the servlet code as usual. Here is an example: [http://balusc.blogspot.com/2007/11/multipartfilter.html]. -
Request.getParameter returns null - Converting webapp from Tomcat to oc4j
I support a simple web app that passes arguments via url context variables. For some reason it does not work in OC4J. When I use request.getContextPath() I see that the URL string only contains the webapps name, not the whole URL with parameters set.
BTW it is an OC4J cluster*Name: index.jsp
*Function: This page is 1st url for WebApp
*Information: This page is used as the home page for this application.
*Version: 1.0 (created on 2005-06-06)
* 2.0 052406 pge
%>
<%@ page pageEncoding="UTF-8"%>
<%@ page import="com.hp.itsm.api.*" %>
<%@ page import="com.hp.itsm.api.interfaces.*" %>
<%@ page import="java.text.Collator" %>
<%@ page import="java.util.*"%>
<%@ page contentType="text/html; charset=utf-8" %>
<%@ include file="include/variables_initialize.jsp" %>
<%@ include file="include/methods_global.jsp" %>
<%@ include file="include/methods_servicedesk.jsp" %>
<%
String login = request.getParameter("u");
String xxx = request.getContextPath();
//Service Call objects
ApiSDSession SDsession = null;
IPerson[] personList = null;
IAccount accountRequester = null;
Boolean bError = Boolean.FALSE; //Default to no errors found
List errMsgList = new ArrayList(); //Array of error messages
//Get account information
accountRequester = getAccount(SDsession, login);
if (accountRequester == null) {
bError = Boolean.TRUE;
errMsgList.add("Could not retrieve the accountRequester.");
} -
Error Code 12 When Transport BW Request
Dear All,
I am getting a return code 12 when I execute a BW transport request from DEV to QA. When the transport starts, it actually calls a job , RDDEXECL to run. The job fails with the error :
01.08.2006 14:05:05 Job started
01.08.2006 14:05:05 Step 001 started (program RDDEXECL, variant , user ID DDIC)
01.08.2006 14:05:05 All DB buffers of application server gdcs002q were synchronized
01.08.2006 14:14:57 STDO: Log could not be written on output device T
01.08.2006 14:22:14 Communication Structure /BIC/CS8ZEOPRO02 activated
01.08.2006 14:22:19 Transfer Rule(s) 8ZEOPRO02_AA activated
01.08.2006 14:22:23 Communication Structure /BIC/CS8ZEOPRO02 activated
01.08.2006 14:22:25 ABAP/4 processor: MESSAGE_TYPE_X
01.08.2006 14:22:25 Job cancelled
A ABAP dump was created due to the job failure.
Runtime Error MESSAGE_TYPE_X
Date and Time 01.08.2006 16:56:51
ShrtText
The current application triggered a termination with a short dump.
What happened?
The current application program detected a situation which really
should not occur. Therefore, a termination with a short dump was
triggered on purpose by the key word MESSAGE (type X).
What can you do?
Print out the error message (using the "Print" function)
and make a note of the actions and input that caused the
error.
To resolve the problem, contact your SAP system administrator.
You can use transaction ST22 (ABAP Dump Analysis) to view and administer
termination messages, especially those beyond their normal deletion
date.
is especially useful if you want to keep a particular message.
Error analysis
Short text of error message:
Serious internal error:
Technical information about the message:
Diagnosis
A serious internal error occurred. It could not be corrected.
Procedure
The following information is available on this error:
1.
2.
3.
4. OSS note
Check the OSS for corresponding notes and create a new problem
message if necessary.
Message classe...... "RSAR"
Number.............. 001
Variable 1.......... " "
Variable 2.......... " "
Variable 3.......... " "
Variable 4.......... " "
Variable 3.......... " "
Variable 4.......... " "
How to correct the error
Probably the only way to eliminate the error is to correct the program.
You may able to find an interim solution to the problem
in the SAP note system. If you have access to the note system yourself,
use the following search criteria:
"MESSAGE_TYPE_X" C
"SAPLRSAC" or "LRSACU75"
"RSAR_TRANSTRUCTURE_ACTIVATE"
If you cannot solve the problem yourself and you wish to send
an error message to SAP, include the following documents:
1. A printout of the problem description (short dump)
To obtain this, select in the current display "System->List->
Save->Local File (unconverted)".
2. A suitable printout of the system log
To obtain this, call the system log through transaction SM21.
Limit the time interval to 10 minutes before and 5 minutes
after the short dump. In the display, then select the function
"System->List->Save->Local File (unconverted)".
3. If the programs are your own programs or modified SAP programs,
supply the source code.
To do this, select the Editor function "Further Utilities->
Upload/Download->Download".
4. Details regarding the conditions under which the error occurred
or which actions and input led to the error.
System environment
SAP Release.............. "640"
Application server....... "gdcs002q"
Network address.......... "192.168.188.71"
Operating system......... "Windows NT"
Release.................. "5.2"
Hardware type............ "4x AMD64 Level"
Character length......... 16 Bits
Pointer length........... 64 Bits
Work process number...... 29
Short dump setting....... "full"
Database server.......... "GDCS002Q"
Database type............ "MSSQL"
Database name............ "BQ1"
Database owner........... "bq1"
Character set............ "C"
SAP kernel............... "640"
Created on............... "May 21 2006 22:47:47"
Created in............... "NT 5.2 3790 Service Pack 1 x86 MS VC++ 14.00"
Database version......... "SQL_Server_8.00 "
Patch level.............. "129"
Patch text............... " "
Supported environment....
Database................. "MSSQL 7.00.699 or higher, MSSQL 8.00.194"
SAP database version..... "640"
Operating system......... "Windows NT 5.0, Windows NT 5.1, Windows NT 5.2"
Memory usage.............
Roll..................... 16192
EM....................... 146644960
Heap..................... 0
Page..................... 2547712
MM Used.................. 82234648
MM Free.................. 51831952
SAP Release.............. "640"
User and Transaction
Client.............. 000
User................ "DDIC"
Language key........ "E"
Transaction......... " "
Program............. "SAPLRSAC"
Screen.............. "SAPMSSY0 1000"
Screen line......... 6
Information on where terminated
The termination occurred in the ABAP program "SAPLRSAC" in
"RSAR_TRANSTRUCTURE_ACTIVATE".
The main program was "RDDEXECU ".
The termination occurred in line 536 of the source code of the (Include)
program "LRSACU75"
of the source code of program "LRSACU75" (when calling the editor 5360).
The program "SAPLRSAC" was started as a background job.
Job name........ "RDDEXECL"
Job initiator... "DDIC"
Job number...... 16421301
Source Code Extract
Line
SourceCde
506
IF g_subrc NE 0.
507
MESSAGE x001.
508
ENDIF.
509
Check new version neccessary
510
l_curr_version = c_s_is_admin-odsversion.
511
512
IF l_new_version EQ rs_c_true.
513
IF i_without_versioning EQ rs_c_true.
514
MESSAGE e023 WITH c_s_is_admin-odsname_tech
515
c_s_is_admin-isource
516
RAISING no_psa_version_allowed.
517
ELSEIF i_without_versioning EQ 'C' AND
518
i_without_transport EQ rs_c_true.
519
*-- special handling for migration.
520
*- current system is target system no transport request
521
*- necessary if a new version is needed
522
ELSEIF i_without_versioning EQ 'C' AND
523
i_without_transport EQ rs_c_false.
524
RAISE inconsistency.
525
ENDIF. .
526
527
IF i_objtype = rsa_c_istype-data.
528
check type of InfoSource first
529
SELECT SINGLE issrctype FROM rsis
530
INTO l_isrctype
531
WHERE isource = c_s_is_admin-isource
532
AND objvers = rs_c_objvers-active.
533
IF sy-subrc <> 0 OR l_isrctype = rsarc_c_issrctype-ods.
534
if generated ODS InfoSource,
535
no PSA versioning possible
>>>>>
MESSAGE x001.
537
ENDIF.
538
ENDIF.
539
l_next_version = l_curr_version + 1.
540
c_s_is_admin-odsversion = l_next_version.
541
l_transtru_odsname+13(3) = l_next_version.
542
Don't use old progname but create new one
543
CLEAR l_progname_ods.
544
ELSE.
545
l_next_version = l_curr_version.
546
ENDIF.
547
548
ENDIF.
549
set transtru_names for IDoc
550
c_s_is_admin-odsname = i_transtru_name.
551
c_s_is_admin-odsname_tech = l_transtru_odsname.
552
WHEN OTHERS.
553
ENDCASE.
554
555
save Transfer rules as active version
Contents of system fields
Name
Val.
SY-SUBRC
0
SY-INDEX
1
SY-TABIX
0
SY-DBCNT
1
SY-FDPOS
10
SY-LSIND
0
SY-PAGNO
0
SY-LINNO
1
SY-COLNO
1
SY-PFKEY
SY-UCOMM
SY-TITLE
Execute Post-Import Methods and XPRAs for Transport Request
SY-MSGTY
X
SY-MSGID
RSAR
SY-MSGNO
001
SY-MSGV1
SY-MSGV2
SY-MSGV3
SY-MSGV4
Active Calls/Events
No. Ty. Program Include Line
Name
13 FUNCTION SAPLRSAC LRSACU75 536
RSAR_TRANSTRUCTURE_ACTIVATE
12 FORM SAPLRSAC_TRANSPORT LRSAC_TRANSPORTF02 1709
ACTIVATE_ISTS
11 FUNCTION SAPLRSAC_TRANSPORT LRSAC_TRANSPORTU68 124
RSAR_CODS_INFOSOURCE_ACTIVATE
10 FUNCTION SAPLRSAC_TRANSPORT LRSAC_TRANSPORTU67 134
RSAR_EXPORT_METADATA_GEN
9 METHOD CL_RSD_ODSO===================CP CL_RSD_ODSO===================CM00M 52
CL_RSD_ODSO=>IF_RSO_TLOGO_MAINTAIN_INT~AFTER_ACTIVATION
8 METHOD CL_RSO_TLOGO_COLLECTION=======CP CL_RSO_TLOGO_COLLECTION=======CM010 333
CL_RSO_TLOGO_COLLECTION=>ACTIVATE_ONE_STEP
7 METHOD CL_RSO_TLOGO_COLLECTION=======CP CL_RSO_TLOGO_COLLECTION=======CM009 216
CL_RSO_TLOGO_COLLECTION=>ACTIVATE_INTERNAL
6 METHOD CL_RSO_TLOGO_COLLECTION=======CP CL_RSO_TLOGO_COLLECTION=======CM004 6
CL_RSO_TLOGO_COLLECTION=>ACTIVATE
5 FUNCTION SAPLRSDG_ODSO LRSDG_ODSOU02 98
RS_ODSO_AFTER_IMPORT
4 FUNCTION SAPLRSVERS LRSVERSU03 127
RS_AFTER_IMPORT
3 FORM SAPLSCTS_EXE_EXP LSCTS_EXE_EXPF02 138
CALL_IMP_METHODS
2 FUNCTION SAPLSCTS_EXE_EXP LSCTS_EXE_EXPU02 94
TRINT_CALL_AFTER_IMP_METHOD
1 EVENT RDDEXECU RDDEXECU 186
START-OF-SELECTION
Chosen variables
Name
Val.
No. 13 Ty. FUNCTION
Name RSAR_TRANSTRUCTURE_ACTIVATE
I_DM_SEVERITY
2
0
0
0
I_LOGSYS
BQ1CLNT200
4534445333
2113CE4200
0000000000
0000000000
I_NO_PROG_GENERATE
2
0
0
0
I_OBJECT
8ZEOPRO02
354455433222222222222222222222
8A5F02F02000000000000000000000
000000000000000000000000000000
000000000000000000000000000000
I_OBJTYPE
D
4
4
0
0
I_SEGMENT_ID
2
0
0
0
I_TRANSTRU_NAME
8ZEOPRO02_AA
354455433544222222222222222
8A5F02F02F11000000000000000
000000000000000000000000000
000000000000000000000000000
I_T_TSFIELD
Table IT_1551158[17x632]
FUNCTION=RSAR_TRANSTRUCTURE_ACTIVATEDATA=I_T_TSFIELD
Table reference: 4904
TABH+ 0(20) = 88666064FE070000000000000000000000000000
TABH+ 20(20) = 2813000036AB17001100000078020000FFFFFFFF
TABH+ 40(16) = 046E01000038000010000000C9248400
store = 0x88666064FE070000
ext1 = 0x0000000000000000
shmId = 0 (0x00000000)
id = 4904 (0x28130000)
label = 1551158 (0x36AB1700)
fill = 17 (0x11000000)
leng = 632 (0x78020000)
loop = -1 (0xFFFFFFFF)
xtyp = TYPE#000285
occu = 16 (0x10000000)
access = 1 (ItAccessStandard)
idxKind = 1 (ItIndexLinear)
uniKind = 2 (ItUniqueNon)
keyKind = 1 (default)
cmpMode = 2 (cmpSingleMcmpR)
occu0 = 1
collHash = 0
groupCntl = 0
rfc = 0
unShareable = 0
mightBeShared = 1
sharedWithShmTab = 0
isShmLockId = 0
gcKind = 0
isUsed = 1
>>>>> Shareable Table Header Data <<<<<
tabi = 0x1857B168FE070000
pghook = 0x80E67064FE070000
idxPtr = 0x70C90864FE070000
refCount = 1 (0x01000000)
tstRefCount = 0 (0x00000000)
lineAdmin = 32 (0x20000000)
lineAlloc = 32 (0x20000000)
store_id = 957569 (0x819C0E00)
shmIsReadOnly = 0 (0x00000000)
>>>>> 1st level extension part <<<<<
regHook = Not allocated
hsdir = Not allocated
ext2 = Not allocated
>>>>> 2nd level extension part <<<<<
tabhBack = Not allocated
delta_head = Not allocated
pb_func = Not allocated
pb_handle = Not allocated
I_T_TSMAPPING
Table IT_1551159[17x2372]
FUNCTION=RSAR_TRANSTRUCTURE_ACTIVATEDATA=I_T_TSMAPPING
Table reference: 4956
TABH+ 0(20) = B0932263FE070000000000000000000000000000
TABH+ 20(20) = 5C13000037AB17001100000044090000FFFFFFFF
TABH+ 40(16) = 046E01008036000004000000C9248400
store = 0xB0932263FE070000
ext1 = 0x0000000000000000
shmId = 0 (0x00000000)
id = 4956 (0x5C130000)
label = 1551159 (0x37AB1700)
fill = 17 (0x11000000)
leng = 2372 (0x44090000)
loop = -1 (0xFFFFFFFF)
xtyp = TYPE#000277
occu = 4 (0x04000000)
access = 1 (ItAccessStandard)
idxKind = 1 (ItIndexLinear)
uniKind = 2 (ItUniqueNon)
keyKind = 1 (default)
cmpMode = 2 (cmpSingleMcmpR)
occu0 = 1
collHash = 0
groupCntl = 0
rfc = 0
unShareable = 0
mightBeShared = 1
sharedWithShmTab = 0
isShmLockId = 0
gcKind = 0
isUsed = 1
>>>>> Shareable Table Header Data <<<<<
tabi = 0x70FB0564FE070000
pghook = 0xE0E77064FE070000
idxPtr = 0x60EB1E64FE070000
refCount = 1 (0x01000000)
tstRefCount = 0 (0x00000000)
lineAdmin = 32 (0x20000000)
lineAlloc = 20 (0x14000000)
store_id = 957570 (0x829C0E00)
shmIsReadOnly = 0 (0x00000000)
>>>>> 1st level extension part <<<<<
regHook = Not allocated
hsdir = Not allocated
ext2 = Not allocated
>>>>> 2nd level extension part <<<<<
tabhBack = Not allocated
delta_head = Not allocated
pb_func = Not allocated
pb_handle = Not allocated
I_USE_PROPOSAL
X
5
8
0
0
I_WITHOUT_LOG
X
5
8
0
0
I_WITHOUT_TRANSPORT
X
5
8
0
0
I_WITHOUT_VERSIONING
2
0
0
0
C_S_IS_ADMIN
8ZEOPRO02_AA M T 8ZEOPRO02_AA 000/BIC/CAAA8ZEOPRO02
3544554335442222222222222224222252354455433544222222222222222222333244424444354455433222222222
8A5F02F02F11000000000000000D0000408A5F02F02F11000000000000000000000F293F31118A5F02F02000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
C_S_IS_ADMIN-ISOURCE
8ZEOPRO02
354455433222222222222222222222
8A5F02F02000000000000000000000
000000000000000000000000000000
000000000000000000000000000000
%_DUMMY$$
2222
0000
0000
0000
G_S_RSIS-COMSTRU
8ZEOPRO02
354455433222222222222222222222
8A5F02F02000000000000000000000
000000000000000000000000000000
000000000000000000000000000000
RS_C_OBJVERS-ACTIVE
A
4
1
0
0
L_ISRCTYPE
O
4
F
0
0
SY-SUBRC
0
0000
0000
SYST-REPID
SAPLRSAC
5454554422222222222222222222222222222222
310C231300000000000000000000000000000000
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
RSARC_C_ISSRCTYPE-ODS
O
4
F
0
0
%_ARCHIVE
2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
SY-REPID
SAPLRSAC
5454554422222222222222222222222222222222
310C231300000000000000000000000000000000
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
SY-MSGID
RSAR
55452222222222222222
23120000000000000000
00000000000000000000
00000000000000000000
MAXCHARLEN
000255
333333
000255
000000
000000
SPACE
2
0
0
0
SY-MSGNO
001
333
001
000
000
RS_C_OBJ_TABL
TABL
5444
412C
0000
0000
SY-MSGV1
22222222222222222222222222222222222222222222222222
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
SY-MSGV2
22222222222222222222222222222222222222222222222222
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
SY-MSGV3
22222222222222222222222222222222222222222222222222
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
SY-MSGV4
22222222222222222222222222222222222222222222222222
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
L_CURR_VERSION
000
333
000
000
000
L_NEXT_VERSION
000
333
000
000
000
DB6_MIN
003800
333333
003800
000000
000000
L_PROGNAME_ODS
GP9HAHZJDTVMUODQUVHPSYC02JZ
4534445445545445554555433452222222222222
709818AA446D5F41568039302AA0000000000000
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
No. 12 Ty. FORM
Name ACTIVATE_ISTS
L_NO_PROG_GENERATE
2
0
0
0
L_T_TR_PROT
Table[initial]
E_SUBRC
0
0000
0000
SYST-REPID
SAPLRSAC_TRANSPORT
5454554455544554552222222222222222222222
310C2313F421E30F240000000000000000000000
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
L_S_ISOSMAP-LOGSYS
BQ1CLNT200
4534445333
2113CE4200
0000000000
0000000000
L_S_ISOSMAP-OLTPSOURCE
8ZEOPRO02
354455433222222222222222222222
8A5F02F02000000000000000000000
000000000000000000000000000000
000000000000000000000000000000
L_S_ISOSMAP-ISTYPE
D
4
4
0
0
P_SEGID
2
0
0
0
L_TRANSTRU_NEW
8ZEOPRO02_AA
354455433544222222222222222
8A5F02F02F11000000000000000
000000000000000000000000000
000000000000000000000000000
L_T_TSFIELDSEL
Table IT_1551115[17x632]
FUNCTION-POOL=RSAC_TRANSPORTFORM=ACTIVATE_ISTSDATA=L_T_TSFIELDSEL
Table reference: 4207
TABH+ 0(20) = 88666064FE070000000000000000000000000000
TABH+ 20(20) = 6F1000000BAB17001100000078020000FFFFFFFF
TABH+ 40(16) = 046E01000038000010000000C9248400
store = 0x88666064FE070000
ext1 = 0x0000000000000000
shmId = 0 (0x00000000)
id = 4207 (0x6F100000)
label = 1551115 (0x0BAB1700)
fill = 17 (0x11000000)
leng = 632 (0x78020000)
loop = -1 (0xFFFFFFFF)
xtyp = TYPE#000285
occu = 16 (0x10000000)
access = 1 (ItAccessStandard)
idxKind = 1 (ItIndexLinear)
uniKind = 2 (ItUniqueNon)
keyKind = 1 (default)
cmpMode = 2 (cmpSingleMcmpR)
occu0 = 1
collHash = 0
groupCntl = 0
rfc = 0
unShareable = 0
mightBeShared = 1
sharedWithShmTab = 0
isShmLockId = 0
gcKind = 0
isUsed = 1
>>>>> Shareable Table Header Data <<<<<
tabi = 0x1857B168FE070000
pghook = 0x80E67064FE070000
idxPtr = 0x70C90864FE070000
refCount = 1 (0x01000000)
tstRefCount = 0 (0x00000000)
lineAdmin = 32 (0x20000000)
lineAlloc = 32 (0x20000000)
store_id = 957569 (0x819C0E00)
shmIsReadOnly = 0 (0x00000000)
>>>>> 1st level extension part <<<<<
regHook = Not allocated
hsdir = Not allocated
ext2 = Not allocated
>>>>> 2nd level extension part <<<<<
tabhBack = Not allocated
delta_head = Not allocated
pb_func = Not allocated
pb_handle = Not allocated
L_T_TSMAPPING
Table IT_1551116[17x2372]
FUNCTION-POOL=RSAC_TRANSPORTFORM=ACTIVATE_ISTSDATA=L_T_TSMAPPING
Table reference: 3062
TABH+ 0(20) = B0932263FE070000000000000000000000000000
TABH+ 20(20) = F60B00000CAB17001100000044090000FFFFFFFF
TABH+ 40(16) = 046E01008036000004000000C9248400
store = 0xB0932263FE070000
ext1 = 0x0000000000000000
shmId = 0 (0x00000000)
id = 3062 (0xF60B0000)
label = 1551116 (0x0CAB1700)
fill = 17 (0x11000000)
leng = 2372 (0x44090000)
loop = -1 (0xFFFFFFFF)
xtyp = TYPE#000277
occu = 4 (0x04000000)
access = 1 (ItAccessStandard)
idxKind = 1 (ItIndexLinear)
uniKind = 2 (ItUniqueNon)
keyKind = 1 (default)
cmpMode = 2 (cmpSingleMcmpR)
occu0 = 1
collHash = 0
groupCntl = 0
rfc = 0
unShareable = 0
mightBeShared = 1
sharedWithShmTab = 0
isShmLockId = 0
gcKind = 0
isUsed = 1
>>>>> Shareable Table Header Data <<<<<
tabi = 0x70FB0564FE070000
pghook = 0xE0E77064FE070000
idxPtr = 0x60EB1E64FE070000
refCount = 1 (0x01000000)
tstRefCount = 0 (0x00000000)
lineAdmin = 32 (0x20000000)
lineAlloc = 20 (0x14000000)
store_id = 957570 (0x829C0E00)
shmIsReadOnly = 0 (0x00000000)
>>>>> 1st level extension part <<<<<
regHook = Not allocated
hsdir = Not allocated
ext2 = Not allocated
>>>>> 2nd level extension part <<<<<
tabhBack = Not allocated
delta_head = Not allocated
pb_func = Not allocated
pb_handle = Not allocated
P_SUGGEST_AND_SAVE
X
5
8
0
0
RS_C_TRUE
X
5
8
0
0
L_WITHOUT_TRANSPORT
X
5
8
0
0
L_S_ADMIN
8ZEOPRO02_AA M T 8ZEOPRO02_AA 000/BIC/CAAA8ZEOPRO02
3544554335442222222222222224222252354455433544222222222222222222333244424444354455433222222222
8A5F02F02F11000000000000000D0000408A5F02F02F11000000000000000000000F293F31118A5F02F02000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
%_DUMMY$$
2222
0000
0000
0000
SY-REPID
SAPLRSAC_TRANSPORT
5454554455544554552222222222222222222222
310C2313F421E30F240000000000000000000000
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
%_SPACE
2
0
0
0
No. 11 Ty. FUNCTION
Name RSAR_CODS_INFOSOURCE_ACTIVATE
I_DATCLS
22222
00000
00000
00000
I_SIZCAT
22
00
00
00
I_T_OSFIELDMAP
Table IT_1547853[17x204]
FUNCTION=RSAR_EXPORT_METADATA_GENDATA=L_T_OSFIELDMAP
Table reference: 3042
TABH+ 0(20) = 88FF0A64FE070000A8FC4164FE07000000000000
TABH+ 20(20) = E20B00004D9E170011000000CC000000FFFFFFFF
TABH+ 40(16) = 04900300603B000010000000C1248400
store = 0x88FF0A64FE070000
ext1 = 0xA8FC4164FE070000
shmId = 0 (0x00000000)
id = 3042 (0xE20B0000)
label = 1547853 (0x4D9E1700)
fill = 17 (0x11000000)
leng = 204 (0xCC000000)
loop = -1 (0xFFFFFFFF)
xtyp = TYPE#000303
occu = 16 (0x10000000)
access = 1 (ItAccessStandard)
idxKind = 0 (ItIndexNone)
uniKind = 2 (ItUniqueNon)
keyKind = 1 (default)
cmpMode = 2 (cmpSingleMcmpR)
occu0 = 1
collHash = 0
groupCntl = 0
rfc = 0
unShareable = 0
mightBeShared = 1
sharedWithShmTab = 0
isShmLockId = 0
gcKind = 0
isUsed = 1
>>>>> Shareable Table Header Data <<<<<
tabi = 0x007EF563FE070000
pghook = 0xA0BD2565FE070000
idxPtr = 0x0000000000000000
refCount = 0 (0x00000000)
tstRefCount = 0 (0x00000000)
lineAdmin = 48 (0x30000000)
lineAlloc = 48 (0x30000000)
store_id = 956282 (0x7A970E00)
shmIsReadOnly = 0 (0x00000000)
>>>>> 1st level extension part <<<<<
regHook = 0x0000000000000000
hsdir = 0x0000000000000000
ext2 = 0xC8FFF263FE070000
>>>>> 2nd level extension part <<<<<
tabhBack = 0x904C8864FE070000
delta_head = 0000000000000000000000000000000000000000000000000000000000000000000000000000000
pb_func = 0x0000000000000000
pb_handle = 0x0000000000000000
E_T_MESSAGES
Table IT_1549098[6x1376]
FUNCTION=RSAR_EXPORT_METADATA_GENDATA=L_T_MESSAGES
Table reference: 4318
TABH+ 0(20) = 705E1064FE070000000000000000000000000000
TABH+ 20(20) = DE1000002AA317000600000060050000FFFFFFFF
TABH+ 40(16) = 04AD0000D010000008000000C1308000
store = 0x705E1064FE070000
ext1 = 0x0000000000000000
shmId = 0 (0x00000000)
id = 4318 (0xDE100000)
label = 1549098 (0x2AA31700)
fill = 6 (0x06000000)
leng = 1376 (0x60050000)
loop = -1 (0xFFFFFFFF)
xtyp = TYPE#000076
occu = 8 (0x08000000)
access = 1 (ItAccessStandard)
idxKind = 0 (ItIndexNone)
uniKind = 2 (ItUniqueNon)
keyKind = 1 (default)
cmpMode = 8 (cmpManyEq)
occu0 = 1
collHash = 0
groupCntl = 0
rfc = 0
unShareable = 0
mightBeShared = 0
sharedWithShmTab = 0
isShmLockId = 0
gcKind = 0
isUsed = 1
>>>>> Shareable Table Header Data <<<<<
tabi = 0x88731964FE070000
pghook = 0x0000000000000000
idxPtr = 0x0000000000000000
refCount = 0 (0x00000000)
tstRefCount = 0 (0x00000000)
lineAdmin = 8 (0x08000000)
lineAlloc = 8 (0x08000000)
store_id = 956709 (0x25990E00)
shmIsReadOnly = 0 (0x00000000)
>>>>> 1st level extension part <<<<<
regHook = Not allocated
hsdir = Not allocated
ext2 = Not allocated
>>>>> 2nd level extension part <<<<<
tabhBack = Not allocated
delta_head = Not allocated
pb_func = Not allocated
pb_handle = Not allocated
E_T_TLOGOHi Mike,
We have had this problem. Please delete the change log table of the ODS in the QA or Prod system (whichever is the target for your transport request) and then reimport the transport request.
<i>
534
if generated ODS InfoSource,
| 535|* no PSA versioning possible |</i>
Hope this helps... -
Error: Requested resource does not exist
Hi
I am using a J2EE application to connect to R/3. I am receiving the above mentioned error. I created a Web Module project. In that i created a package com.training.examples.servlet.GetSalesPage.java . This is going to be my controller.
I also created a JSP page with a submit button. Once i click on the button, i get the following message " The requested resource does not exist."
In the JSP page i used the follwing Tag :
<form action="<%= request.getContextPath() %>/servlet/GetSalesPage" method="POST">
I know this is will be tough to understand with me just giving me a bigger picture. I am ready to give the code if anyone wishes to check it out also.
Any help would be rewarded.
Murali.Hi
Thanks Vyara and Guru. I am actually trying to replicate the example of "Creating first J2EE application - flight bookings". So i am getting stuck with the basic things.
Ur inputs were valuable.
I added the Servlet in the Web.xml
Here is my Web.XML
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>WEB APP</display-name>
<description>WEB APP description</description>
<servlet>
<servlet-name>GetSalesPage</servlet-name>
<servlet-class>com.training.examples.servlet.GetSalesPage</servlet-class>
</servlet>
<servlet>
<servlet-name>GetSalesList.jsp</servlet-name>
<jsp-file>/GetSalesList.jsp</jsp-file>
</servlet>
<ejb-ref>
<ejb-ref-name>ejb/SalesEJBBean</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.training.examples.SalesEJBHome</home>
<remote>com.training.examples.SalesEJB</remote>
<ejb-link>SalesBean</ejb-link>
</ejb-ref>
</web-app>
Here is ejb-jar.xml in my EJB Project
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
<description>EJB JAR description</description>
<display-name>EJB JAR</display-name>
<enterprise-beans>
<session>
<ejb-name>SalesEJBBean</ejb-name>
<home>com.training.examples.SalesEJBHome</home>
<remote>com.training.examples.SalesEJB</remote>
<local-home>com.training.examples.SalesEJBLocalHome</local-home>
<local>com.training.examples.SalesEJBLocal</local>
<ejb-class>com.training.examples.SalesEJBBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
<resource-ref>
<res-ref-name>eis/SAPJRADemoFactory</res-ref-name>
<res-type>javax.resource.cci.ConnectionFactory</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</session>
</enterprise-beans>
</ejb-jar>
Now i am able to get the JSP page. When i key in data and click on submit button, i get the following error:
<b>
"Couldn't access bean salesEJB: Path to object does not exist at java:comp, the whole lookup name is java:comp/env/ejb/SalesEJB"</b>
I have setup eis/SAPJRADemoFactory for my Flight Application and it is working fine. I am trying to use the same setting for my application also.
Here is my GetSalesPage SERVLET Page :
Created on May 9, 2006
To change the template for this generated file go to
Window>Preferences>Java>Code Generation>Code and Comments
package com.training.examples.servlet;
import java.io.IOException;
import java.rmi.RemoteException;
import java.util.List;
import javax.ejb.CreateException;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.training.examples.SalesEJB;
import com.training.examples.SalesEJBHome;
import com.training.examples.SalesSelection;
@author MShanmugham
To change the template for this generated type comment go to
Window>Preferences>Java>Code Generation>Code and Comments
public class GetSalesPage extends HttpServlet {
/* names of jsp pages */
private static final String SELECT_SALES_ORDER= "/GetSalesList.jsp";
// JNDI names
private static final String PREFIX = "java:comp/env/ejb/";
private static final String SALES_BEAN = "SalesEJB";
public static final String BYF_SALES_SELECTION = "byf_sales_selection";
public static final String BYF_SALES_LIST = "byf_sales_list";
public static final String BYF_ERROR_MESSAGE = "byf_error_message";
// class members
private RequestDispatcher dispatcher = null;
protected void doGet(
HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
doPost(request, response);
protected void doPost(
HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
HttpSession session = request.getSession(true);
if(request.getParameter("select") != null) {
// select or GET_SALES event -> retrieve sales list, display 1. page
getSalesList( request, session);
dispatcher = request.getRequestDispatcher(SELECT_SALES_ORDER);
dispatcher.forward(request, response);
private void getSalesList( HttpServletRequest request, HttpSession session) {
try {
// get bean SalesEJB
InitialContext initialcontext = new InitialContext();
SalesEJBHome salesHome = (SalesEJBHome) initialcontext.lookup( PREFIX + SALES_BEAN);
SalesEJB sales = salesHome.create();
// get flight list
String salesOrg = (String) request.getParameter("salesOrg");
String customerNo = (String) request.getParameter("customerNo");
SalesSelection salesSelection = null;
if( (salesOrg != null) && (customerNo != null)) {
salesSelection = new SalesSelection( salesOrg, customerNo);
session.setAttribute( BYF_SALES_SELECTION,salesSelection);
} else {
salesSelection = (SalesSelection) session.getAttribute( BYF_SALES_SELECTION);
List salesList = sales.getSalesList(salesSelection);
if( salesList == null) {
request.setAttribute(BYF_ERROR_MESSAGE,"No records found!");
// set session and request attribute
session.setAttribute( BYF_SALES_SELECTION, salesSelection);
session.setAttribute( BYF_SALES_LIST, salesList);
}catch(NamingException exc) {
request.setAttribute(BYF_ERROR_MESSAGE, "Couldn't access bean salesEJB: " + exc.getMessage());
}catch(CreateException exc) {
request.setAttribute(BYF_ERROR_MESSAGE, "Couldn't create bean salesEJB: " + exc.getMessage());
}catch(RemoteException exc) {
request.setAttribute(BYF_ERROR_MESSAGE, "Bean salesEJB returned error message: " + exc.detail.getMessage());
Here is the only JSP I am using GetSalesList.jsp
<%@ page language="java" %>
<%@ page import="com.training.examples.servlet.GetSalesPage"%>
<%@ page import="com.training.examples.SalesSelection"%>
<%@ page import="com.training.examples.salesData"%>
<%
// get the sales order selection data and the list of selected Orders
SalesSelection salesSelection = (SalesSelection) session.getAttribute( GetSalesPage.BYF_SALES_SELECTION);
List salesList = (List) session.getAttribute( GetSalesPage.BYF_SALES_LIST);
// get the error message
String errorMessage = (String) request.getAttribute( GetSalesPage.BYF_ERROR_MESSAGE);
%>
<html>
<head>
<title> Fetch Orders </title>
</head>
<body>
<fieldset>
<legend>
<b> Give the Sales Org and Customer Number </b>
</legend>
<form action="<%= request.getContextPath() %>/servlet/GetSalesPage" method="POST">
Sales Organization:
<% if(salesSelection == null) { %>
<input type="text" size="16" name="salesOrg" value="">
<% } else { %>
<input type="text" size="16" name="salesOrg" value="<%= salesSelection.getSalesOrg() %>">
<% } %>
Customer Number:
<% if(salesSelection == null) { %>
<input type="text" size="16" name="customerNo" value="">
<% } else { %>
<input type="text" size="16" name="customerNo" value="<%= salesSelection.getCustomer() %>">
<% } %>
<br>
<br>
<input type="submit" name="select" value="Select">
<br>
<% if(salesList != null) { %>
<table border="1" box="all">
<tr>
<th rowspan="2"> </th>
<th rowspan="2">Sales Doc</th>
<th rowspan="2">Item No</th>
<th colspan="2">Material</th>
</tr>
<% for(int i = 0; i < salesList.size(); i++) { %>
<tr>
<td>
<input type="radio" name="saleslist">
</td>
<td><%= ((salesData)salesList.get(i)).getSd_doc() %></td>
<td><%= ((salesData)salesList.get(i)).getItm_number() %></td>
<td><%= ((salesData)salesList.get(i)).getMaterial() %></td>
</tr>
<br>
<% } %>
</table>
<br><br>
<input type="submit" name="continue" value="Continue">
</form>
<% } %>
<% if (errorMessage != null) { %>
<br>
<tr>
<td colspan="3">
<font color="#D00000"><b><%= errorMessage %></b></font>
</td>
</tr>
<% } %>
</fieldset>
<p>
</body>
</html>
Can you please help me out.
Murali. -
Sending Outlook Meeting Requests through Outlook using JSP?
Hi all,
I'm trying to develop a web application that's able to invoke the Create New Meeting Request dialog from the client's Outlook (they are using Outlook 2002/2003), and populate some data from server-side into the Meeting Request, so that users can customize the Request if necessary and send it out.
Have looked at a few solutions as follows:
1) HTML's mailto
This is not good, coz the body can only accept plain text, whereas I need to be able to send HTML text (which Outlook can accept).
2) Outlook View Control
This was more hopeful, as I was able to invoke the new Meeting Request dialog. However still no way to send my data to the Meeting Request :-(
Basically, what I need is to be able to send a customized Meeting Request through some means, like for example getting Outlook to do it like the above, or sending out via some Java APIs (do they exist?)
Any ideas if the above is possible at all? Or if there are other ways to do this, other than relying on Outlook?
I'm open to any suggestions, even commercial solutions, since I'm quite urgently in need of options.
Note that I can't connect direct to Exchange (there are some solutions for doing that), because of some security issues which doesn't allow me to connect to the Exchange Server.
Thanks in advance for any advice!Hi whartung,
Thanks for the reply! Appreciate it.
I think what you are suggesting is exactly what Outlook View Control is. Unfortunately, as I've mentioned, it seems that Microsoft did not give it sufficient controls to be able to pre-populate a new Meeting Request. You can only invoke the Outlook UI to create the Meeting Request, but there's no APIs to populate the new Meeting Request.
Have however found a possible alternative in the meantime:
Outlook supports iCalendar files which is a standard for calendaring information storage, and it is able to process a Meeting Request from an iCalendar file which contains details of the Meeting Request.
So what I'm looking to do is this:
1) Create the iCalendar file in the backend with Java.
2) Send an email to the user(s) who is intended to receive the Meeting Request, with the iCalendar file attached.
3) User clicks on the iCalendar file, which prompts them to process the Meeting Request.
Somewhat indirect, but gets the Meeting Request across, and all the 3 steps are actually possible.
Furthur to this, it opens up the possibility of sending Outllook Contacts (which supports iCard format) through similar mechanisms as well! -
How to create request object manually?
Can i edit a servlet request at the front controller level and disptach it to real url?
I need the way(maybe a class) to edit the request parameters;
request.getContextPath();
request.getRequestURL();
request.getPathInfo();
request.getServletPath();i need the equvilance of these methods which are built to SET.
is it possible?
thank you1) Write a subclass of the HttpServletRequestWrapper
class and overide your required methods.http://forum.java.sun.com/thread.jspa?threadID=682565&tstart=100
I have used the wrapper in that forum but this is just for to set some Parameter to the request. But there is no method like setServletPath on the wrapper class? it is still missing and i need an HELP plz about how to override ServletPath on the request object.
2)In the doFilter() method of your filter, call
chain.doFilter() method giving your wrapped request
object as an argument.I did it
public void doFilter(ServletRequest req,ServletResponse res,FilterChain chain)throws IOException,ServletException {
HttpServletRequest request = (HttpServletRequest) req;
HttpRequestWithModifiableParameters myReq= new HttpRequestWithModifiableParameters(request);
request=(HttpServletRequest)myReq;
HttpServletResponse response=(HttpServletResponse)res;
chain.doFilter( request, response );
}please help about just only how to override ServletPath on request object!!
thank you -
Incorrect file path from getContextPath
I am trying to get a file listing from a directory on the server from my jsp page by doing:
File hrdir = new File(request.getContextPath().substring(1));The substring just takes off the leading /.
Anyway, if I do a getAbsolutePath() on my file object I get back: "C:\Program files\Tomcat 5.5\AppName"
However, the actual path is: "C:\Program files\Tomcat 5.5\webapps\AppName"
Any ideas on why the path is coming back incorrectly?I recognize that this post is half a year old at this writing, and the OP has probably long since either solved or abandoned the problem in question. That being stipulated: if I understand the question properly, the OP is stating that there is a directory named A, and contained somewhere within that directory or one (or more) of its subdirectories is one (or more) file(s) named abc.txt, and OP would like to be able to locate and obtain the canonical path to said file(s). While I am in no way a java maven, I've written a brief program which appears to do exactly that:
import java.io.*;
public class Main {
public Main() {
String whatImLookingFor = "abc.txt";
String startingDirectory = "A";
File path = new File("A");
recursivelySearch(path, whatImLookingFor);
private void recursivelySearch(File path, String whatImLookingFor) {
try {
if (path.isFile()) {
if (path.getName().equals(whatImLookingFor))
System.out.println(path.getCanonicalPath());
else
if (path.isDirectory()) {
File[] currentFiles = path.listFiles();
for (int i=0; i<currentFiles.length; i++)
recursivelySearch(currentFiles, whatImLookingFor);
catch(IOException ioe) {
System.out.println("During search got error "+ioe.getMessage());
public static void main(String[] args) {
new Main(); -
ObFormLoginCookie not sent in request
Hi,
We are implementing enhanced security by adding an image to our login mechanism. Basically the first page accepts the userid and directs you to the password page where you show the image selected by the user. There are two buttons in the password page one is 'login' and the other one is 'change image'. Both post to webgate and go thro' the authentication. Both work great in IE but in Firefox only the login button works. The 'change Image' button doesn't work. The reason is that 'ObFormLoginCookie' doesn't get sent with 'Change Image' request(while it gets sent with login request), so the webgate doesn't know where to redirect. (I verified that the cookie is being set earlier). Please let me know what I am doing wrong or how to fix this.
ThanksI don't think it's the javascript issue (the javascript is the same for both login and changeimage - only difference is url).
The url for login is
/access/oblix/apps/webgate/bin/webgate.dll?<%= request.getContextPath()%>/sso/integration/user/SSOPreLogon";
The url for changeimage is
document.forms[0].action = "/access/oblix/apps/webgate/bin/webgate.dll?<%= request.getContextPath()%>/sso/integration/user/ChangeImage";
(Also I tested the script for changeimage just replacing URL with the one for login and it works fine. So it's not a javascript issue).
Basically the webgate sets this cookie. One thing I noticed though is the path for ObFormLoginCookie is set as
path=/access/oblix/apps/webgate/bin/webgate.dll?/cs70_banking/sso/integration/user/SSOPreLogon;
This /cs70_banking/sso/integration/user/SSOPreLogon is the path for the login button. So could this cause any issues. But this works in IE. If that's the issue how would I solve this? -
Calendar not working...
I have a following piece of code embedded in jsp but its not popping out a calendar...help plz
<li><label for="flightDepartureDate">Departing:</label> <input
type="text" name="criteria.displayDepartureDatetime" readonly="readonly"
onblur="updateCheckout();return true;"
value="<c:out value="${flightSearchForm.criteria.displayDepartureDatetime}"/>"><a
href="#showCalendar"
onClick="displayCalendar('criteria.displayDepartureDatetime', 'false','<%= request.getContextPath() %>');">
<img src="<cms:ref path="global" reference="images_calendar"/>"
alt="calendar" title="calendar" /> </a> <label for="flightReturnDate">Returning:</label>
<input type="text" NAME="criteria.displayReturnDatetime"
onblur="updateCheckout();return true;"
value="<c:out value="${flightSearchForm.criteria.displayReturnDatetime}"/>"><a
href="#showCalendar"
onClick="displayCalendar('criteria.displayReturnDatetime', 'false','<%= request.getContextPath() %>');"></li>
<img src="<cms:ref path="global" reference="images_calendar"/>"
alt="calendar" title="calendar" />
</a>
</li>
// Calendar Library
// This calendar is used when a user clicks on a link (image or text). A pop-up window is
// displayed and the user can click on an arrow to move to the next or previous month.
// When the user clicks on one of the days in the month the calendar window is closed and
// the selected date will now be displayed in the day and month option lists (focus is
// returned to the month option list).
// Usage: Add the following lines of code to your page to enable the Calendar
// component.
// // This line loads the JavaScript library for the calendar
// <script language="JavaScript" src="calendar.js"></script>
// // This line is used in conjunction with one form field (dateField).
// // *** NOTE ***
// <a href="#showCalendar
// onClick="setDateField(setDateField(document.mainForm.startDate));
// newWin = window.open('calendar.html','cal','dependent=yes,width=200,height=200')">
// <img src="../icons/icon_more.png" width=22 height=15 border=0></a>
// Note : when the calling window is an included jsp page make sure
// you use top.newWin ! Example Useage in the call centre app is :
// <a href="#showCalendar
// onClick="showCalendar('checkOutDate');
// top.newWin = window.open('<%= request.getContextPath() %>/webcontent/calendar.jsp',
// 'cal',
// 'dependent=yes,width=200,height=200, left=500,top=500');">
// <img src="<cms:ref path="search" reference="images_calendar"/>" alt="calendar" title="calendar" />
// </a>
// Required Files:
// calendar.js - contains all JavaScript functions to make the calendar work
// calendar.jsp - is the actual calendar that is opened by the initial page when
// the user clicks on icon_more.gif.
// image file - image that the user clicks on to view the calendar
// Begin user editable section ----------------------------------------------------------------------------------------
// CALENDAR COLORS
bottomBackground = "#3D70D6"; // BG COLOR OF THE BORDER OUTSIDE CALENDAR TABLE
tableBGColor = "#dfefff"; // BG COLOR OF THE CALENDAR TABLE
cellColor = "#ffffff"; // TABLE CELL BG COLOR OF THE DATE CELLS
headingCellColor = "#3d70d6"; // TABLE CELL BG COLOR OF THE WEEKDAY ABBREVIATIONS
focusColor = "#ff0000"; // TEXT COLOR OF THE DATE IN THE OPTION LIST (OR CURRENT DATE IF NONE SELECTED)
hoverColor = "#dfefff"; // TEXT COLOR OF A LINK WHEN YOU HOVER OVER IT
fontStyle = "8pt arial, helvetica"; // TEXT STYLE FOR DATES
headingFontStyle = "bold 8pt arial, helvetica"; // TEXT STYLE FOR WEEKDAY ABBREVIATIONS
// Formatting preferences
bottomBorder = false; // TRUE/FALSE (WHETHER TO DISPLAY BOTTOM CALENDAR BORDER)
tableBorder = 0; // SIZE OF CALENDAR TABLE BORDER (BOTTOM FRAME) 0=none
// End of User Editable Section ---------------------------------------------------------------------------------------
// Determine browser type
var isNav = false;
var isIE = false;
// Assume Netscape or IE
if (navigator.appName == "Netscape") {
isNav = true;
} else {
isIE = true;
var dateField = null;
var startDay;
var startMonth;
var startYear;
var format = null;
//used to determine if age needs to be calculated as well
var updateAge = false;
// Pre-build portions of the calendar when this JavaScript Library loads into the browser
buildCalParts();
// Calendar functions begin here --------------------------------------------------------------------------------------
Sets the initial value of the global date field
function showCalendar(inDateField, calcAge) {
dateField = document.getElementById(inDateField);
// Set the colours of the calendar
setCalColour();
buildCalParts();
// Set default value of noDateSelected
noDateSelected = 1;
setInitialDate();
//determine if the calculateAge function on the parent must be called;
updateAge = calcAge;
// Construct the calendar
calDocBottom = buildBottomCalFrame();
function displayCalendar(inDateField, calcAge, calendarPath)
// lets close the calendar window if its already open. Its safer dude!
if (top.newWin != null) top.newWin.close();
calendarURL = calendarPath + "/webcontent/common/calendar.html";
showCalendar(inDateField, calcAge);
top.newWin = window.open(calendarURL, "cal", "dependent=yes,width=200,height=200, left=500,top=500");
top.newWin.focus();
Set the initial calendar date to today or to the existing value in dateField
function setInitialDate() {
calDate = new Date();
today = new Date();
currentDate = new Date();
if (dateField.value.length == 11) {
noDateSelected = 0;
var day = dateField.value.substring(0, 2);
var month = dateField.value.substring(3, 6).toUpperCase();
var year = dateField.value.substring(7, 11);
calDate.setYear(year);
calDate.setDate(1);
if (month == "JAN") {
calDate.setMonth(0);
} else {
if (month == "FEB") {
calDate.setMonth(1);
} else {
if (month == "MAR") {
calDate.setMonth(2);
} else {
if (month == "APR") {
calDate.setMonth(3);
} else {
if (month == "MAY") {
calDate.setMonth(4);
} else {
if (month == "JUN") {
calDate.setMonth(5);
} else {
if (month == "JUL") {
calDate.setMonth(6);
} else {
if (month == "AUG") {
calDate.setMonth(7);
} else {
if (month == "SEP") {
calDate.setMonth(8);
} else {
if (month == "OCT") {
calDate.setMonth(9);
} else {
if (month == "NOV") {
calDate.setMonth(10);
} else {
if (month == "DEC") {
calDate.setMonth(11);
} else {
calDate.setMonth("N/A");
calDate.setDate(day);
// IF THE INCOMING DATE IS INVALID, USE THE CURRENT DATE
if (isNaN(calDate)) {
noDateSelected = 1;
calDate = new Date();
} else {
startDay = calDate.getDate();
startMonth = calDate.getMonth();
startYear = calDate.getYear();
calDay = calDate.getDate();
calMonth = calDate.getMonth();
// Set day value to 1... to avoid JavaScript date calculation anomalies
// (if the month changes to Feb and the day is 30, the month would change to
// March and the day would change to 2. Setting the day to 1 will prevent that)
calDate.setDate(1);
Sets the calendar colours
function setCalColour() {
bottomBackground = "#6598fe";
tableBGColor = "#dfefff";
cellColor = "#ffffff";
hoverColor = "#dfefff";
logo = "cal_logo_lilac.gif";
Create the calendar
function buildBottomCalFrame() {
// Start calendar document
var calDoc = calendarBegin + "<div class=\"calender\"><table align=center border=0 width=140>" + "<tr>" + "<td align=left><a href='javascript:parent.opener.setPreviousMonth()' class='navigate'><</a></td>" + "<td style=\"font-weight:700; color:#ffffff; margin:0; padding:0; text-align:center;\">" + getMonth(calDate.getMonth()) + "</td>" + "<td align=left><a href='javascript:parent.opener.setNextMonth()' class='navigate'>></span></td>" + "</tr>";
calDoc = calDoc + "<tr>" + "<td align=left><a href='javascript:parent.opener.setPreviousYear()' class='navigate'><</span></td>" + "<td style=\"font-weight:700; color:#ffffff; margin:0; padding:0; text-align:center;\">" + calDate.getFullYear() + "</td>" + "<td align=left><a href='javascript:parent.opener.setNextYear()' class='navigate'>></span></td>" + "</tr>" + "</table></div >" + calendarTable;
month = calDate.getMonth();
year = calDate.getFullYear();
// Get globally tracked day value (prevents JavaScript date anomalies)
day = calDay;
var counter = 0;
var days = getDaysInMonth();
// If global day value is > than days in month, highlight last day in month
if (day > days) {
day = days;
// Determine what day of the week the calendar starts on
var firstOfMonth = new Date(year, month, 1);
// Get the day of the week the first day of the month falls on
var startingPos = firstOfMonth.getDay();
days += startingPos;
var columnCount = 0;
// Make beginning non-date cells blank
for (counter = 0; counter < startingPos; counter++) {
calDoc += blankCell;
columnCount++;
var currentDay = 0;
var dayType = "weekday";
// Date cells contain a number
for (counter = startingPos; counter < days; counter++) {
var paddingChar = " ";
if (counter - startingPos + 1 < 10) {
padding = " ";
} else {
padding = " ";
currentDay = counter - startingPos + 1;
// Set the type of day
if (noDateSelected == 0 && (currentDay == startDay) && (startMonth == calDate.getMonth() && startYear == calDate.getYear())) {
dayType = "focusDay";
} else {
if (noDateSelected == 1 && (currentDay == currentDate.getDate()) && (calDate.getMonth() == currentDate.getMonth())) {
dayType = "focusDay";
} else {
dayType = "weekDay";
calDoc += "<td align=center bgcolor='" + cellColor + "'>" + "<a class='" + dayType + "' href='javascript:parent.opener.returnDate(" + currentDay + ")'>" + padding + currentDay + paddingChar + "</a></td>";
columnCount++;
// Start a new row when necessary
if (columnCount % 7 == 0) {
calDoc += "</tr><tr>";
// Make remaining non-date cells blank
for (counter = days; counter < 42; counter++) {
calDoc += blankCell;
columnCount++;
// Start a new row when necessary
if (columnCount % 7 == 0) {
calDoc += "</tr>";
if (counter < 41) {
calDoc += "<tr>";
calDoc += calendarEnd;
return calDoc;
Write the monthly calendar once the forward/backward arrow has been clicked on
function writeCalendar() {
// CREATE THE NEW CALENDAR FOR THE SELECTED MONTH & YEAR
calDocBottom = buildBottomCalFrame();
newWin.document.open();
newWin.document.write(calDocBottom);
newWin.document.close();
Set the global date to the previous month and refresh the calendar
function setPreviousMonth() {
var year = calDate.getFullYear();
var month = calDate.getMonth();
// If month is January, set month to December and decrement the year
if (month == 0) {
month = 11;
if (year > 1000) {
year--;
calDate.setFullYear(year);
} else {
month--;
calDate.setMonth(month);
writeCalendar();
Set the global date to the previous year and refresh the calendar
function setPreviousYear() {
var year = calDate.getFullYear();
year--;
calDate.setYear(year);
writeCalendar();
// Set the global date to next month and refresh the calendar
function setNextMonth() {
var year = calDate.getFullYear();
var month = calDate.getMonth();
// If month is December, set month to January and increment the year
if (month == 11) {
month = 0;
year++;
calDate.setFullYear(year);
} else {
month++;
calDate.setMonth(month);
writeCalendar();
// Set the global date to next year and refresh the calendar
function setNextYear() {
var year = calDate.getFullYear();
year++;
calDate.setYear(year);
writeCalendar();
Get number of days in the month
function getDaysInMonth() {
var days;
var month = calDate.getMonth() + 1;
var year = calDate.getFullYear();
if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) {
days = 31;
} else {
if (month == 4 || month == 6 || month == 9 || month == 11) {
days = 30;
} else {
if (month == 2) {
if (isLeapYear(year)) {
days = 29;
} else {
days = 28;
return (days);
Check to see if the year is a leap year
function isLeapYear(Year) {
if (((Year % 4) == 0) && ((Year % 100) != 0) || ((Year % 400) == 0)) {
return (true);
} else {
return (false);
Build the month select list
function getMonth(month) {
monthArray = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
// Return a string value which contains a select list of all 12 months
return monthArray[month];
Set days of the week
function createWeekdayList() {
daysInWeekLongName = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
daysInWeekShortName = new Array("Su", "Mo", "Tu", "We", "Th", "Fr", "Sa");
var weekdays = "<tr bgcolor='" + headingCellColor + "'>";
// Loop through the weekday array
for (var index = 0; index < daysInWeekShortName.length; index++) {
weekdays += "<td class='heading' align=center>" + daysInWeekShortName[index] + "</td>";
weekdays += "</tr>";
// Return table row of weekday abbreviations to display above the calendar
return weekdays;
Pre-build portions of the calendar (for performance reasons)
function buildCalParts() {
// Generate weekday headers for the calendar
weekdays = createWeekdayList();
// Build the blank cell rows
blankCell = "<td align=center bgcolor='" + cellColor + "'> </td>";
// Build the top portion of the calendar page using CSS to control some display elements
calendarBegin = "<html>" + "<head>" + "<TITLE>Calendar</TITLE>" + "<style>";
calendarBegin = calendarBegin + "TD.heading { text-decoration: none; color: #ffffff; font: " + headingFontStyle + "; }";
calendarBegin = calendarBegin + "B { text-decoration: none; color: #000000; font: " + headingFontStyle + "; }";
calendarBegin = calendarBegin + "A.focusDay:link { color: " + focusColor + "; text-decoration: none; font: " + fontStyle + "; }" + "A.focusDay:hover { color: " + focusColor + "; text-decoration: none; font: " + fontStyle + "; }" + "A.focusDay:visited { color: #000000; text-decoration: none; font: " + fontStyle + "; }";
calendarBegin = calendarBegin + "A.weekday:link { color: #000000; text-decoration: none; font: " + fontStyle + "; }" + "A.weekday:hover { color: " + hoverColor + "; font: " + fontStyle + "; }" + "A.weekday:visited { color: #000000; text-decoration: none; font: " + fontStyle + "; }";
calendarBegin = calendarBegin + "A.navigate:link { font-weight:700; color:#ffffff; text-decoration: none; }" + "A.navigate:hover { font-weight:700; color:#ffffff; text-decoration: none; }" + "A.navigate:visited { font-weight:700; color:#ffffff; text-decoration: none; }";
calendarBegin = calendarBegin + "</style>" + "</head>" + "<body style=\"background-color:#3d70d6; font:normal 75% arial, helvetica, sans-serif; text-align:center; margin:0; padding:0;\">" + "<center>";
// Netscape needs a table container to display the table outlines properly
if (isNav) {
calendarTable = "<table CELLPADDING=0 CELLSPACING=1 border=" + tableBorder + " align=center bgcolor=\"" + tableBGColor + "\"><tr><td>" +
// Build weekday headings
"<table CELLPADDING=0 CELLSPACING=1 border=" + tableBorder + " align=center bgcolor=\"" + tableBGColor + "\">" + weekdays + "<tr>";
} else {
// Build weekday headings
calendarTable = "<table CELLPADDING=0 CELLSPACING=1 border=" + tableBorder + " align=center bgcolor=\"" + tableBGColor + "\">" + weekdays + "<tr>";
// Build the bottom portion of the calendar page
calendarEnd = "";
// Whether or not to display a thick line below the calendar
if (bottomBorder) {
calendarEnd += "<tr></tr>";
// Netscape needs a table container to display the table outlines properly
if (isNav) {
calendarEnd += "</td></tr></table>";
// End the table and the HTML document
calendarEnd += "</table>" + "<a href='javascript: self.close ();' class='linktext' style=\"font-weight:700; color:#ffffff;\">Close Calendar Window</a>" + "</center>" + "</body>" + "</html>";
// Set form field value to the date selected and close the calendar window
function returnDate(selectedDay) {
calDate.setDate(selectedDay);
// Set the date returned to the user
var day = "0" + calDate.getDate();
day = day.substring(day.length - 2, day.length);
var month = monthArray[calDate.getMonth()];
month = month.substring(0, 3);
dateField.value = day + "-" + month + "-" + calDate.getFullYear();
//dateField.focus();
// Close the calendar window
if (updateAge === "true") {
top.calculateAge();
top.newWin.close();
}Too much unformatted code to even try and understand.
Is this a Java/JSP question or javascript issue?
Is there an error message loading the page?
Are there any javascript notifications (check the alert bottom left of IE browser)
When does the error occur? Loading the page? Pushing the button?
My suggestion would be to
- view source on the generated HTML. See if the html is valid, and correct.
- change the onclick event of the button to pop up an "alert" so you can see it is actually getting to the button press. Then put alerts through the code you are calling to see if it is actually getting there.
cheers,
evnafets -
I am experimenting with WebServices, when i used form a JSP/Servlet client the webservice is working fine:
package org.me.calculator.client;
import com.delunasaenz.scoreboard.Game;
import com.delunasaenz.scoreboard.ScoreboardWS;
import com.delunasaenz.scoreboard.ScoreboardWSService;
import java.io.*;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.WebServiceRef;
import javax.xml.ws.soap.SOAPFaultException;
* @author mg116726
@WebServlet(name="ClientServlet", urlPatterns={"/ClientServlet"})
public class ClientServlet extends HttpServlet {
@WebServiceRef(wsdlLocation = "http://localhost:8080/ScoreboardApp/ScoreboardWSService?wsdl")
public ScoreboardWSService service;
@Resource
protected WebServiceContext context;
* Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
* @param request servlet request
* @param response servlet response
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
out.println("<h2>Servlet ClientServlet at " + request.getContextPath () + "</h2>");
ScoreboardWS port = service.getScoreboardWSPort();But using that in a JavaFX code service is null:
import com.delunasaenz.scoreboardWS.Game;
import com.delunasaenz.scoreboardWS.ScoreboardWS;
import com.delunasaenz.scoreboardWS.ScoreboardWSService;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.Label;
import javax.annotation.Resource;
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.WebServiceRef;
* @author charly
public class ScoreBoardController implements Initializable {
@WebServiceRef(wsdlLocation = "http://localhost:8080/ScoreboardApp/ScoreboardWSService?wsdl")
public ScoreboardWSService service;
@Resource
protected WebServiceContext context;
@FXML
private ChoiceBox leagueSelection;
@FXML
private void handleButtonAction(ActionEvent event) {
@Override
public void initialize(URL url, ResourceBundle rb) {
leagueSelection.getSelectionModel().select(0);
leagueSelection.getSelectionModel().selectedIndexProperty()
.addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> ov,
Number t, Number t1) {
ScoreboardWS port = service.getScoreboardWSPort();Am I doing something wrong?
Greetings and thanks in advance.
NetBeans 7.3 , Java 7, GlasFish 3Hi,
Getting the result back from a httpservice / webservice /
remoting call always happens asynchronously. That is, there is no
way to force your script to wait for the result before proceeding.
The validator has to return true or false immediately. There is no
way to make it wait for a webservice result.
Ideally, Flex validators are for client side validation.
Though you could make a web service call, and check the result in
the result handler, and then fire your validator (or simply set
errorString of your component to the error message).
Whatever the case, the validator has to have all the
necessary information to validate when it is called. -
Invalidate session when user clicks back button
I want to invalidate the session when user clicks back button, so that user cannot refresh and reload a page.
Any suggestions will be highly appreciated.
Message was edited by:
sam_amc* SessionInvalidator.java
* Created on October 27, 2006, 9:18 AM
package web;
import java.io.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.*;
* @author javious
* @version
public class SessionInvalidator extends HttpServlet {
/** Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
* @param request servlet request
* @param response servlet response
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
String reposted = request.getParameter("reposted");
if("true".equals(reposted))
HttpSession session = request.getSession(false);
if(session == null)
// This is step 4 and beyond
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet SessionInvalidator</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet SessionInvalidator at " + request.getContextPath () + "</h1>");
out.println("I said, your session is now invalid! Now where are those Duke Dollars at?");
out.println("</body>");
out.println("</html>");
else
Integer hitCount = (Integer)session.getAttribute("hitCount");
if(hitCount == null)
// This is step 2 (the "good" - "stay" page.)
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet SessionInvalidator</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet SessionInvalidator at " + request.getContextPath () + "</h1>");
out.println("Your session is good.<br>");
out.println("If you click the browser's back button, you will invalidate your session.");
out.println("</body>");
out.println("</html>");
hitCount = 1;
session.setAttribute("hitCount", hitCount);
else
//We've used up our good visit
session.invalidate();
// This is step 3
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet SessionInvalidator</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet SessionInvalidator at " + request.getContextPath () + "</h1>");
out.println("Your session is now invalid");
out.println("</body>");
out.println("</html>");
else
// because the javascript in the following output will never allow a user
// to continue clicking back any further than this, we can safely create the session.
// (or perhaps the session can already be created here and this may not be necessary).
// A problem lies where if the user chooses to "select" a page back in history they thereby
// potentially skip back "over" this functionality, thus defeating the purpose of it.
request.getSession(true);
// This is step 1 (indirection)
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet SessionInvalidator</title>");
out.println("</head>");
out.println("<body onload=\"document.getElementById('invalidatorForm').submit()\">");
out.println("<h1>Servlet SessionInvalidator at " + request.getContextPath () + "</h1>");
out.println("<form id=\"invalidatorForm\" action=\"SessionInvalidator\" method=\"POST\">");
out.println("<input type=\"hidden\" name=\"reposted\" value=\"true\">");
out.println("</form>");
out.println("</body>");
out.println("</html>");
out.close();
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/** Handles the HTTP <code>GET</code> method.
* @param request servlet request
* @param response servlet response
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
/** Handles the HTTP <code>POST</code> method.
* @param request servlet request
* @param response servlet response
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
/** Returns a short description of the servlet.
public String getServletInfo() {
return "Short description";
// </editor-fold>
}The problem with even attempting to do this is that with today's browser capabilities, users can optionally choose to jump to a particular page in the browser history and this may not necessarily be the most recent page. In this case, you would also want to invalidate the user's session after already having been there (whatever page that may be). Then you have situations when the user may wish to jump back in history to external pages they were visiting before they reached your own site's pages. Then what happens when they start clicking forward, forward, etc... from there? This is why I prefer writing Swing Clients as alternatives to browser applications. There are soo many possible ways break web applications made for standard web browsers both maliciously and simply by accident or irregular user patterns. Regardless, this servlet would work based on the assumption that all the user(s) would "ever" do aside from moving logically forward is clicking on the browser's "back" button.
cheers!
Message was edited by:
javious
Maybe you are looking for
-
Imac won't get past boot screen
I have never had a problem with my mac, but recently I was surfing the internet, and the screen seemed to freeze. I powered it off by holding the power button until it turned off, then tried to turn it back on. the apple screen came up, then the ro
-
Why is QuickTime export only using 2-4 cores?
I'm trancoding video in QuickTime Player 7 (to H.264 and AAC), NTSC dimensions and good quality. It's taking quite a while, but it should be going faster for what I have. I have an 8-core Mac Pro, but the export process only ever goes a little above
-
How to create an EventListener for a specific keyboard press?
Hello, I have been trying to figure out how to switch my actionscript3 from a mouse click to a keyboard press. I'm new to Flash, but the problem I keep coming to is that I need to have 3 separate keys programmed in to do three seperate outcomes. I ha
-
Multipoint Sever 2011 - default language settings?
I inherited a gifted Multipoint 2011 server with six direct connect stations. It appears the default language from install is French (we are a bi-lingual school) however we want it to default to US English for ease of use due to keyboard issues. I c
-
Hi, everyone i want to know about nested panels in detail. If we make heirarchy of panels at third level then how we can perform drawing in uppermost(last child). please suggest me ideas and give links that gives sufficient matter about it. Thanks in