How to use enviroment variables in JSP code?
I�m developing a web server with JSP�s, and I need to move the application to others computers. I need to access to a directory, but I don�t know it because the user can install the Application in the directory he wants. So I need to access to that directory in the JSP code.
The directory is "C:\Program Files\....\tomcat\webapps\ROOT\upload". I have the CATALINA_HOME enviroment variable defiened as "C:\Program Files\....\tomcat\", so I need to use something like "CATALINAHOME\\webapps\upload\", but I don�t know how to mekr the JSP code to understand the enviroment variable CATALINA_HOME.
I�ve tried with %CATALINA_HOME%, but the Tomcat server doesn�t recognize it. How can I access to that directory?
Thanks (Sorry about my english)
My JSP�s are in: %CATALINA_HOME%\webapps\ROOT\
I wan�t to access to %CATALINA_HOME%\webapps\ROOT\upload\
My JSP code:
<% ...
String DPATH = "C:\\Program Files\\JBuilder7\\jakarta-tomcat-4.0.3\\webapps\\ROOT\\upload\\";
File newfile = null;
newfile = new File(DPATH+filename);
%>
I want the JSP to locate the directory \webapps\ROOT\upload\ without knowing the complete route "c:\Program Files\...", because I have the enviroment variable CATALINA_HOME with the value "C:\Program Files\JBuilder7\jakarta-tomcat-4.0.3\". SO the user of the aplication only has to set the CATALINA_HOME variable and the aplication should access the upload directory throught the CATALINA_HOME variable.
I can�t explain it better. Sorry.
Similar Messages
-
How to use protected method in jsp code
Could anyone tell me how to use protected method in jsp code ...
I declare a Calendar class , and I want to use the isTimeSet method ,
But if I write the code as follows ..
========================================================
<%
Calendar create_date = Calendar.getInstance();
if (create_date.isTimeSet) System.out.println("true");
%>
============================================================
when I run this jsp , it appears the error wirtten "isTimeSet has protected access in java.util.Calendar"The only way to access a protected variable is to subclass.
MyCalendar extends Calendar
but I doubt you need to do this. If you only want to tell if a Calendar object has a time associated with it, try using
cal.isSet( Calendar.HOUR ); -
How to use bind variables in JSP applications ?
Hi,
How will i use bind variables in jsp applicaions ?
Any links that give a clear understanding ?
TIA,
jjHi,
Try this link, this may help you.
http://www.oracle-base.com/articles/misc/WebScriptingForOracle.php
Thanks -
How to use a variable of jsp custom tag in my java code?
hi folks,
i got a folderList tag like this:
ArrayList list = new ArrayList(20);
%>
<foo:folderList path="${attributes.newsPath}" var="year" contentType="folder">
<%
list.add(${year.contentEntryName}); // of course, this doesn't work
%>
</foo:folderList>I think, its clear what I want to do. I am just wondering how I can use my Variable "year" in the Java code between <% %>...<% list.add(year.getContentEntryName()); %>
You have to have defined in the custom tag that "var" relates to a scripting variable that you want defined.
<tag>
<variable>
<name-given>var</name-given>
<variable-class>myPackage.myClass</variable-class>
<declare>true</declare>
<scope>NESTED</scope>
</variable>
</tag> Cheers,
evnafets -
How to use enviroment variables?
I�m developing a web server with JSP�s, and I need to move the application to others computers. I need to access to a directory, but I don�t know it because the user can install the Application in the directory he wants. So I need to access to that directory in the JSP code.
The directory is "C:\Program Files\....\tomcat\webapps\ROOT\upload". I have the CATALINA_HOME enviroment variable defiened as "C:\Program Files\....\tomcat\", so I need to use something like "CATALINAHOME\\webapps\upload\", but I don�t know how to mekr the JSP code to understand the enviroment variable CATALINA_HOME.
I�ve tried with %CATALINA_HOME%, but the Tomcat server doesn�t recognize it. How can I access to that directory?
Thanks (Sorry about my english)Try:
System.getProperty("catalina.home");This is not the enviroment variable, but it's set by the catalina.bat file when starting java with the option -Dcatalina.home=%CATALINA_HOME% -
How to use session variable in JSP function & How to use both JSP Servlet
Hi,
I am new to JSP and servlets
Still I am devloping a website in JSP. I am not mixing JSP with servlets, but I do create Java files for bean, logic and database works.
I try to keep the hard coding part out of JSP.
I dont how to use both JSP and Servlets in combination.
Hence If needed I write some functions in JSP.
but it gives me error
+<%! public void abc()+
+{+
int intUserId = Integer.valueOf((Integer) session.getAttribute("MySession_UserID"));
+}+
+%>+
Saying cannot find symbol session
1) So can u please tell how can I access session variables within JSP function
2) And also give me some links/tutorials about useing both JSP and Servlets in combination.
Thanks
VenkatThe application architecture when you use Servlets and JSP in a standard MVC pattern is explained here (under the heading "Integrating Servlets and JSP Pages") and here ...
-
How to use odi variable in java code.
Hi,
I am trying to calculate check sum of a file and need to capture that in a odi variable...
I wrote code like this(selected technology as java bean shell)
<@
import java.io.*;
import java.util.zip.*;
public class checksum {
public static void main(String[] args) throws Exception {
FileInputStream fis = new FileInputStream(new File("c:/dummy.txt"));
CheckedInputStream cis = new CheckedInputStream(fis, new CRC32());
BufferedInputStream in = new BufferedInputStream(cis);
while (in.read() != -1) {
#checksum = cis.getChecksum().getValue();
}@>
But I am not able to get that value...
I tried in another way like this
<@
import java.io.*;
import java.util.zip.*;
public class checksum {
public static void main(String[] args) throws Exception {
long result;
FileInputStream fis = new FileInputStream(new File("c:/dummy.txt"));
CheckedInputStream cis = new CheckedInputStream(fis, new CRC32());
BufferedInputStream in = new BufferedInputStream(cis);
while (in.read() != -1) {
result= cis.getChecksum().getValue();
@>
In odi variable refreshing mode i selected schema as memory_engine and wrote
select '<@=result@>' from dual;
even this wont work for me :(
Anyone pls help me in this...
Thanks in advance
PavanHi Phani,
Thanks for the reply. I resolved this. The mistake is I wrote java code in a class,in main function. I removed class and main function. Now I am able to capture value into Odi variable...
I modified code as
<@
import java.io.*;
import java.util.zip.*;
long result;
FileInputStream fis = new FileInputStream(new File("C:/dummy.txt"));
CheckedInputStream cis = new CheckedInputStream(fis, new CRC32());
BufferedInputStream in = new BufferedInputStream(cis);
while (in.read() != -1) {
result=cis.getChecksum().getValue();
@>
finally retrieving result value from dual
select '<@=result@> from dual
Edited by: 908443 on Jan 16, 2012 10:42 PM -
Using JSTL variables in JSP or Javascript. Possible ?
Hi All,
Is it possible to share or use the variables which are declared are used by JSTL in JSP expression or scriplet code and in Java Script.
Example:
This Works:
<fmt:set var="test" value="JSTL" />
<fmt:out value="${test}" />
But, this gives error:
<% out.println(test) %>
And passing the value of variable 'test' to Java Script code also gives error.
How to use JSTL variables in JSP and in Javascript ?
Yours,
Sankar.BBy default, JSTL variables are kept in servlet
attributes. Default is to store it in the page
context. You can make it request/session/application
scope as required by an attribute of the set tag.Hi there,
Can anyone advise how to access JSP variables in JSTL?
Can it be done as the same method through request/session/application scope?
Thnks... -
How can we use java variable in javascript code on JSP page?
How can we use java variable in javascript code on JSP page?
Pls helpThink about it:
JSP/Java is executed on the Server and produces HTML+JavaScript.
Then that HTML+JavaScript is transfered to the client. The client now interpretes the HTML+JavaScript.
Obviously there's no way to access a Java variable directly from JavaScript.
What you can do, however, is write out some JavaScript that creates a JavaScript variable containing the value of your Java variable. -
How to access a JAVA Script variable in JSP Code
How to access a JAVA Script variable in JSP Code. I have been unable todo this.
Plz Suggest a way.
Thanks
Soumyatry to do this code
String s=request.getParameter("javascriptvariablename"); -
How can use a variable in the folowing code?
How can use a variable 'W_ROWNUM2' in the folowing code?
MOVE '1' TO CNT.
LOOP AT L_T_PM2.
CONCATENATE '0' CNT INTO W_ROWNUM2.CONDENSE W_ROWNUM2.
CONCATENATE 'F110V-VARI'W_ROWNUM2'(01)' INTO FLD2.
perform DYNPRO_FIELD using FLD2
L_T_PM2-vari12_con.
CNT = CNT + 1.
CONDENSE CNT.
ENDLOOP.
I need to increment the value of W_ROWNUM2.
Please ,it is urgent!!Hello
CONCATENATE 'F110V-VARI'W_ROWNUM2'(01)' INTO FLD2.
Try using spaces between parts of the resulting string.
CONCATENATE 'F110V-VARI' W_ROWNUM2 '(01)' INTO FLD2
Regards
Greg Kern. -
How to use Value Variable in Report Painter Column defined as Formula
Hi Gurus,
In report painter, how can I add one field (exchange rate) in selection screen, so that user can provide the exchange rate to be used, then execute the report, the exchange rate will used to multiple local currency amount.
The reason for this is we want use provided exchange rate to convert the amount from once currency to the other currency.
Alternatively I am studying the functionality of "Value Variable" and found that I can perform the task from this. I have created the value variable but when I am using the variable in Report Painter columns as "&ZVALVAR", system is giving me error. I read the help and it states that use the variable with "&" and do it as it is mentioned.
Can anybody suggest what I need to do to make it workable.
ThanksI did try using the presentation variable, but that does not work too. I am setting session variable in the dashboard prompt (select 'request variable'). When I use presentation variable, it hard codes the value of the variable name.
sql is
select date from work_order where facility = @{p_facility}
the physical log sql is
select date from work_order where facility = 'p_facility' -
How to use bind variables in this procedure
Hi Experts,
How to use bind variables in this procedure for static queries.
PROCEDURE DELETE_MER_PROC (M_id IN NUMBER)
IS
BEGIN
V_date DATE;
SELECT PD_DATE INTO v_date FROM PD_MAINTAIN;
DELETE FROM MER_CLEAR
WHERE MER_DT < v_date
AND ID = M_ID;
COMMIT;
END;
How to use v_date and m_id as bind variables in this procedure to avoid hard parsing.
Please help me.
Thanks.976208 wrote:
How to use v_date and m_id as bind variables in this procedure to avoid hard parsing.
You cannot avoid hard parsing - as the 1st time a SQL statement (like the SELECT or DELETE statements in your code) is encountered, it does not reside in the server's Shared Pool, and needs to be added into the pool via a hard parse.
Bind variables does not prevent hard parsing. Hard parsing happens when the SQL statement (with or without bind variables) is a brand new statement encountered by the server.
Bind variables enables the same SQL cursor to be reused, by simply changing the bind variable value.
Not using bind variables means that each SQL statement is unique and not shareable - as the value is hardcoded into the statement and cannot be changed via a bind value. This typically means LOTS of different SQL statements (where the only difference is the changed value in the statement) are created - with each statement being a new statement not seen before in the Shared Pool and needing to be hard parsed.
One does not design one's code not to be hard parsed. There ALWAYS will be a hard parse in order to get a SQL statement into the Shared Pool. One designs one's code to REUSE cursors in the Shared Pool. -
How to set enviroment variables for Inso Filter
Hi everyone,
I want to convert word documents to html using CTX_DOC.Filter.According to the documentation,I know I neednot set the 'Inso Filter'in the preference when creating index,but I must set enviroment variables for Inso Filter.
I found the following instructions for it in the 8.1.5 documentation,but I can't understand it well.Is there anyone can tell me how to set enviroments variables for Inso Filter on Windows2000 Server?(My DB version is 8.1.7EE)
Environment Variable Locations
All environment variables related to Inso filtering must made visible to interMedia Text. Set these variables in the following locations:
listener.ora file. This makes the environment variables visible to the extproc PL/SQL process.
The operating system shell from where ctxsrv server is started. This makes the environment variables visible to the ctxsrv process, which does background DML.
Any suggestions are apreciated
Reemon
nullNSAPI plugins are normally configured using parameters specified in magnus.conf and/or obj.conf. What plugin requires you set an environment variable?
-
How to use ADF variables in C:when test?
I have a <af:iterator in my page fragment as follows
<af:iterator id="i1" value="#{queryModel.currentDescriptor.conjunctionCriterion.criterionList}" var="criterion" varStatus="vs">
Within this iterator, I want to make a decision absed on the index of the iterator. To do this test, I am using jstl as follows
<c:when test="${vs.index == '0' or vs.index == '2' or vs.index == '4'}">
This test is however always evaluating to false. I have tried cahnging my code using various combiantion as below ...
<c:when test="#{vs.index == '0' or vs.index == '2' or vs.index == '4'}">
<c:when test="${vs.index == 0 or vs.index == 2 or vs.index == 4}">
<c:when test="${vs.index == '0' || vs.index == '2' || vs.index == '4'}">
But nothign seems to be working fine.
Can some one help me with what I am doing wrong?
Thanks.How to use ADF variables in <C:when test?
Maybe you are looking for
-
I have 2 Apple IDs and I want to merge them so I only use one. Can I change my Apple ID for iTunes to my iCloud/email ID?
-
I recently purchase a full membership student yearly plan. I was prompted to this page after my payment was confirmed - https://creative.adobe.com/products/download/creative-cloud However I continue to receive the error "We are currently experiencing
-
How to change the cash journal voucher
Hi Pls advice how to change the cash journal voucher lay out , that is auto generated in the system. I need to add some fields. Thanx
-
My back up to time machine is not occuring and I am getting the message: sparsebundle already in use. Any Clues?
-
MDT Refresh doesn't clean recycle bin
Hello, Has anyone dealt with the fact that the, "Clean Disk" performed by LTIApply.wsf marks the Recycler folder as a protected folder and doesn't clear it out? Essentially leaving the contents of the user's recycle bin beyond after reimage? Is there