Java variable documentation
Hello
i have a question about documenting variables
is it like this
* documentation
private static final int CONSTANT = 1;
or
* documentation
private static final int CONSTANT = 1;
if it is the last one, is there any use of the first one? for example only constants or something
thanks in advance
Also most IDEs have extended support for the Javadocs, even if you don't generate them into HTML. So if you're gonna comment, better use the javadoc style unless you have a good reason not to.
Similar Messages
-
Hello,
SharedObjects.getEnvironment() method is deprecated, but didn't find any documentation on intradoc java api... So what method should be used instead? Does any body knows where to get intradoc java api documentation (even for Oracle ISV partners). There is no such documentation on Oracle portal, on partner portal, ...
Many thanks in advice.From our development team:
In 10gR3, getEnvironment has been replaced by two different methods.
getSafeEnvironment: Gets the environment without variables that are considered unsafe to expose. For instance, it won't include JdbcPassword, IntradocDir, etc. A complete list is in the resource table SecureEnvironmentKeys in the file std_resources.htm. When evaluating Idoc script in an unsafe context (which is most of the time), the DataBinder should have a reference pointer to the safe environment and not the secure environment.
getSecureEnvironment: This includes all configuration parameters. It is used when doing admin level tasks of all sorts.
Also, the getEnvironment method still exists, but it is a pointer to getSafeEnvironment. -
Assign a value to an ODI or Java variable in a KM
Hi Gurus,
I'm developing a new KM and I need to get the name of a dblink by calling an Oracle function. How to store the result of a function in an ODI or Java variable in a KM step ?
And if it is in an Java variable, how to use it in this kind of step (line 7) :
create or replace view <%=odiRef.getObjectNameDefaultPSchema("L", "" , "W")%><%=odiRef.getInfo("COLL_NAME")%>
<%=odiRef.getColList("", "[CX_COL_NAME]", ",\n\t", "", "")%>
as select <%=odiRef.getPop("DISTINCT_ROWS")%>
<%=odiRef.getColList("", "[EXPRESSION]", ",\n\t", "", "")%>
from <%=odiRef.getSrcTablesList("", "[SCHEMA].[RES_NAME]@"+++*#PROJECT.VARIABLE*+++" [POP_TAB_ALIAS]", ", ", "")%>
where (1=1)
<%=odiRef.getFilter()%>
<%=odiRef.getJrnFilter()%>
<%=odiRef.getJoin()%>
<%=odiRef.getGrpBy()%>
<%=odiRef.getHaving()%>
Thanks a lot for your help.
Best regardsIf it is java variable then your code should looks like this
create or replace view <%=odiRef.getObjectNameDefaultPSchema("L", "" , "W")%><%=odiRef.getInfo("COLL_NAME")%>
<%=odiRef.getColList("", "[CX_COL_NAME]", ",\n\t", "", "")%>
as select <%=odiRef.getPop("DISTINCT_ROWS")%>
<%=odiRef.getColList("", "[EXPRESSION]", ",\n\t", "", "")%>
from <%=odiRef.getSrcTablesList("", "[SCHEMA].[RES_NAME]@ *<@=java_variable_name@>* [POP_TAB_ALIAS]", ", ", "")%>
where (1=1)
<%=odiRef.getFilter()%>
<%=odiRef.getJrnFilter()%>
<%=odiRef.getJoin()%>
<%=odiRef.getGrpBy()%>
<%=odiRef.getHaving()%>
If it is odi variable then your code should looks like this
create or replace view <%=odiRef.getObjectNameDefaultPSchema("L", "" , "W")%><%=odiRef.getInfo("COLL_NAME")%>
<%=odiRef.getColList("", "[CX_COL_NAME]", ",\n\t", "", "")%>
as select <%=odiRef.getPop("DISTINCT_ROWS")%>
<%=odiRef.getColList("", "[EXPRESSION]", ",\n\t", "", "")%>
from <%=odiRef.getSrcTablesList("", "[SCHEMA].[RES_NAME]@ *#odi_variable_name* [POP_TAB_ALIAS]", ", ", "")%>
where (1=1)
<%=odiRef.getFilter()%>
<%=odiRef.getJrnFilter()%>
<%=odiRef.getJoin()%>
<%=odiRef.getGrpBy()%>
<%=odiRef.getHaving()%> -
Assigning stored procedure output value to java variable
I have one stored procedure which is having ref cursor as the output parameter.
How to assign refcursor value to my java variable?cstmt.registerOutParameter(1, OracleTypes.CURSOR);
cstmt.execute()
ResultSet rs = (ResultSet)cstmt.getObject(1);
==
Ashok -
Assigning javascript varibel value to java variable
Hi all
I want to find screen resolution in one jsp page.That can be done in javascript.
(though 'screen.width and screen.height')
But is there any way to assign that value to java variable.
Any body has the idea?
Help me.No, why ? becuase jsp is SERVER side
There are workarounds, You can store your javascript values in hidden fields and submit your page with them to your JSP and then use them like that -
Assigning javascript varible value to java variable
Hi all
I want to find screen resolution in one jsp page.That can be done in javascript.
(though 'screen.width and screen.height')
But is there any way to assign that value to java variable.
Any body has the idea?
Help me.No, why ? becuase jsp is SERVER side
There are workarounds, You can store your javascript values in hidden fields and submit your page with them to your JSP and then use them like that -
Assign j_user value to a java variable in umLogonPage.jsp
Hi All
I need to do some post processing immediately after login and require the user id for the same. So how do we acess the value in the user id field and assign it to a java variable in the umLogonPage.jsp..??
Java specific forums claim that this is not possible directly and can be only done on submit function or through hidden fields in the form. Any ideas with regard to the form that is present in umLogonPage.jsp..??
Thanks
DeepakHi,
we use this for saving the login time of the user. There are few therads about creating a custom login module (for example: [Custom Login Module - how to go on |http://forums.sdn.sap.com/thread.jspa?threadID=357616]).
We have created a login module which extends AbstractLoginModule, in login() method :
public boolean login() throws LoginException {
Object option = g_sharedState.get("javax.security.auth.login.name");
if (option != null && !option.equals("")) {
String l_userID = (String)option;
IUserAccount l_account = UMFactory.getUserAccountFactory().getUserAccountByLogonId(l_userID);
IUserAccount mutableAccount = accountFactory.getMutableUserAccount(account.getUniqueID());
l_mutAccount.setLastSuccessfulLogonDate(new Date());
l_mutAccount.commit();
about login modules and login stacks start here: [http://help.sap.com/saphelp_nw04/helpdata/en/8c/f03541c6afd92be10000000a1550b0/frameset.htm|http://help.sap.com/saphelp_nw04/helpdata/en/8c/f03541c6afd92be10000000a1550b0/frameset.htm]
Hope this helps,
Romano -
Using a java variable in jsp-Reports?
Hello everyone,
is it possible to use a java variable in the xml-definition of a report? Something like
<%@ taglib uri="/WEB-INF/lib/reports_tld.jar" prefix="rw" %>
<% String someSqlStatement="select * from emp"; %>
<rw:report id="myReport">
<rw:objects id="myObjects">
<report DTDVersion="9000010" name="myReport">
<data>
<dataSource name="Q_1">
<select>
<![CDATA[
<%= someSQLStatement %>
]]>
</select>
It won't work that way (as the string is not evaluated and inserted into the definition, but how could it be done? Would be great to modify the report programatically that way? Any ideas?
TIA,
Marcel JantzTo pass values to Reports, you should use the "parameters" attribute in the <rw:report> tag. In the above case you would have:
<% String myParameters="p_someSqlStatement=select%20*%20from%20emp"; %>
<rw:report id="myReport" parameters="<%= myParameters %>">
<rw:objects id="myObjects">
<report DTDVersion="9000010" name="myReport">
<data>
<dataSource name="Q_1">
<select>
<![CDATA[ &p_someSqlStatement ]]>
</select>
The body of the <rw:objects> tag isn't evaluated since the Reports Builder needs to be able to open and load the <rw:objects> tag. As the Reports builder doesn't run the .jsp on open, it only parses it, the <rw:objects> tag can't have values that need to be evaluated. -
Searching java sdk documentation
My question is: "Is there a way to search the Java 2 SDK, Standard Edition Documentation using JDeveloper?"
I know how to browse it, using either browse javadoc or through the help file, but when I do a search using the Help Navigator it does not go trough the Java reference documentation. This is rather inconvenient. I've been looking for answers on this issue in this forum but found nil.
Thanks for any help.The only references and documenation is [here|http://www.sdn.sap.com/irj/boc/sdklibrary]
Typically new methods and such are not introduced in a current product version so most likely nothing has changed in the SDK. It does sometimes happen and when it does new documenation is usually released.
Jason -
Passing a variable from Javascript to java variable in a JSP.
Here is simple test Ive been messing around with.
How do I assign the value that was selected in the radio button to a java variable in my JSP here. Javascript being client side and JSPs being serverside makes this difficult.
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
function valbutton(thisform)
myOption = -1;
for (i=0; i<thisform.myradiobutton.length; i++)
if (thisform.myradiobutton.checked)
myOption = i;
if (myOption == -1)
alert("You must select a radio button");
return false;
alert("You selected button number " + myOption + " which has a value of " + thisform.myradiobutton[myOption].value);
thisform.submit();
</SCRIPT>
<title>CreateCategoryContent</title>
</head>
<body>
<BR>
<center>
<%
for(int i = 0; i < 10; i++)
%>
<form name="myform">
<table border="1" bordercolor="#C0C0C0" width="50%" cellpadding="0" cellspacing="0" bgcolor="white">
<tr>
<td><%=i%><input type="radio" VALUE="<%=i%>" name="myradiobutton"></td>
</tr>
<%
%>
</form>
<input type="submit" name="submitit" onclick="valbutton(myform);return false;" value="Validate" />
</table>
</center>
<!--//T2-->
</body>
</html>
Thanks dudes.Please excuse me for appearing dim but my JSP skills are rather weak.
I dynamically create rows in a table from an Iterator. If the mainTopic is news then I need a third column to appear with radio buttons. I have all this done. When a radio button is selected and the UPLOAD button is selected I need to know which of the values in the table was selected.
When I ran the test below the selected value was null. Can you help me?
Thanks.
<%@ page session="false" %>
// imports etc
<%@ page errorPage="../com/digisoft/common/Error.jsp" %>
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
function valbutton(thisform)
myOption = -1;
for (i=0; i<thisform.myradiobutton.length; i++)
if (thisform.myradiobutton.checked)
myOption = i;
if (myOption == -1)
alert("You must select a radio button");
return false;
alert("You selected button number " + myOption + " which has a value of " + thisform.myradiobutton[myOption].value);
thisform.selected.value=thisform.myradiobutton[myOption].value;
thisform.submit();
</SCRIPT>
<title>CreateCategoryContent</title>
<LINK REL="stylesheet" HREF="<%=request.getContextPath() + "/stylesheets/digihostnews.css"%>" TYPE="text/css">
<%
HttpSession session = request.getSession(false);
String mainTopic = request.getParameter("mainTopic");
String subCategory = request.getParameter("subCategory");
String subCategoryId = request.getParameter("subCategoryId");
String subCategoryToBeDeleted = request.getParameter("subCategoryToBeDeleted");
String selection = request.getParameter("selection");
// other initializations etc
%>
</head>
<body>
<BR>
<!--Another table-->
<center>
<table border="1" bordercolor="#C0C0C0" width="90%" cellpadding="0" cellspacing="0" bgcolor="white">
<tr>
<td class="blue">Select Topic</td>
</tr>
<tr>
<td class="insidebox2">
<BR>
<form action="NewsUpdate.jsp" method=post>
Select Topic
<select NAME="mainTopic" class="dropdown">
<%
Iterator menuItems = myLombardiaMgr.getMainCategories();
while(menuItems.hasNext())
MainCategory aMenuItemCategory = (MainCategory)menuItems.next();
String menuItem = aMenuItemCategory.getMainCategory();
if(!menuItem.equalsIgnoreCase(mainTopic))
%>
<option VALUE="<%= menuItem %>" ><%= menuItem %></option>
<%
else
%>
<option SELECTED VALUE="<%= menuItem %>" ><%= menuItem %></option>
<%
%>
</select>
<INPUT type=submit class="newsbutton" value="LOAD" name=Submit>
</form>
<form action="AddCategoryDescription.jsp" method=post>
<INPUT TYPE=HIDDEN NAME="mainTopic" VALUE="<%=mainTopic%>">
<INPUT type=submit class="newsbuttonlong" value="EDIT DESCRIPTION" name=Submit>
</form>
</td>
</tr>
</table>
</center>
<!--//Another table-->
<!--T2-->
<center>
<table border="1" bordercolor="#C0C0C0" width="90%" cellpadding="0" cellspacing="0" bgcolor="white">
<tr><td class="blue">Categories</td></tr>
<tr>
<td class="insidebox2">
<BR>
<form action="NewsUpdate.jsp" method=post>
Add Category
<input type="text" name="subCategory" class="dropdown" id="catId" value=""/>
<INPUT TYPE=HIDDEN NAME="mainTopic" VALUE="<%=mainTopic%>">
<%
if (mainTopic != null)
%>
<INPUT type=submit class="newsbutton" value="ADD" name=Submit>
<%
else
%>
<INPUT type=submit class="newsbutton" value="ADD" name=Submit disabled>
<%
%>
</form>
<!--T3-->
<table id="categoryTable" border="1" bordercolor="#035C98" width="60%" height="60%" cellpadding="0" cellspacing="0" bgcolor="white">
<tr>
<td colspan="1" class="result"><b>Category Name</b></td>
<td colspan="1" class="result"><b></b></td>
</tr>
<%
if(myApplicationDetails != null)
myApplicationDetails = myLombardiaMgr.getAllApplicationDetails();
Iterator myMainCategories = myApplicationDetails.getMainCategories();
while(myMainCategories.hasNext())
MainCategory aMainCategory = (MainCategory) myMainCategories.next();
if(aMainCategory.getMainCategory().equalsIgnoreCase(mainTopic))
Iterator subTopics = aMainCategory.getSubTopics();
while(subTopics.hasNext())
SubTopic aSubTopic = (SubTopic) subTopics.next();
%>
<form action="NewsUpdate.jsp" method=post>
<tr>
<td class="result"><%=aSubTopic%></td>
<td class="result">
<INPUT type=submit class="newsbutton" value="REMOVE" name=Submit>
<INPUT TYPE=HIDDEN NAME="subCategoryId" VALUE="<%=aSubTopic.getId()%>">
<INPUT TYPE=HIDDEN NAME="subCategoryToBeDeleted" VALUE="<%=aSubTopic%>">
<INPUT TYPE=HIDDEN NAME="mainTopic" VALUE="<%=mainTopic%>">
<INPUT TYPE=HIDDEN NAME="subCategory" VALUE="<%=aSubTopic%>">
</form>
<form action="EditStoryItem.jsp" method=post>
<INPUT TYPE=HIDDEN NAME="subCategory" VALUE="<%=aSubTopic%>">
<INPUT TYPE=HIDDEN NAME="subCategoryId" VALUE="<%=aSubTopic.getId()%>">
<INPUT TYPE=HIDDEN NAME="mainTopic" VALUE="<%=mainTopic%>">
<INPUT type=submit class="newsbutton" value="EDIT" name=Submit>
</form>
<%
if(mainTopic.equalsIgnoreCase("News"))
%>
<td class="result">
<INPUT type="radio" name="newsitem" VALUE="<%=aSubTopic%>" >
<INPUT TYPE=HIDDEN onclick="valbutton(myform);return false;" NAME="selection" >
</td>
<%
%>
</td>
</DL>
</tr>
<%
} // end of if
%>
</table>
<table border="0" bordercolor="#C0C0C0" width="60%" cellpadding="0" cellspacing="0" bgcolor="white">
<tr><td align="right">
<form action="../../../../../../servlet/UploadXmlFiles" method=post>
<% if(myApplicationDetails == null )
System.out.println("******************* selection "+selection);
%>
<INPUT type=submit class="newsbutton" value="UPLOAD" name=Submit disabled>
<%
else
%>
<INPUT type=submit class="newsbutton" value="UPLOAD" name=Submit>
<%
System.out.println("******************* selection "+selection);
%>
</form>
</td>
</tr>
</table>
<!--//T3-->
</td>
</tr>
</table>
</center>
<!--//T2-->
</body>
</html> -
Concat java variable to a MySql select statement and exeucte
Hi,
I am trying to append a variable to a MySql select statement.
Overview: I need to retrieve data from a MySql database with a java variable as a reference and select the data in the database based on that variable.
CODE THAT I CURRENTLY HAVE:
// Declare variables
Connection conn = null;
Statement st = null;
Resultset rs2 = null;
String st2 = null;
String keyid = null;
// Connect to database
try {
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:mysql://" + mysql_host + ":3306/" + mysql_database, mysql_login, mysql_password);
st = conn.createStatement();
// Select data in Database with hanging equal sign
st2 = ("SELECT * FROM table WHERE keyid= ");
// Append keyid to hanging equal sign of select statement
rs2 = st.executeQuery(st2 + keyid);
}This is not working when I try to display the data.What is not working about it? Is there an error message? Stack Trace?
Where do you get the value of keyId from?
I would suggest that you use a prepared statement rather than building up a sql string like this. It prevents sql injection attacks
// Declare variables
Connection conn = null;
PreparedStatement stmt = null;
Resultset rs2 = null;
String sql= null;
String keyid = null;
// Connect to database
try {
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:mysql://" + mysql_host + ":3306/" + mysql_database, mysql_login, mysql_password);
// Select data in Database with place holder for parameter
sql = "SELECT * FROM table WHERE keyid= ?";
// prepare the statement
stmt = conn.prepareStatement(sql);
// set the value of key id to use with the query
stmt.setString(1, keyId);
// run the query
rs2 = st.executeQuery();
catch (Exception e){
System.out.println("An error occurred " + e.getMessage());
e.printStackTrace();
finally{
if (rs2 != null) try { rs2.close(); } catch(SQLException ex){}
if (stmt != null) try { stmt.close(); } catch(SQLException ex){}
if (conn != null) try { con.close(); } catch(SQLException ex){}
} -
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. -
Setting the value of a java variable in javascript function
How can i set the value of a java variable in a javascript function?
<%
String fName = "";
%>
now i want to define a javascript function which can set the value of fName to the value it has been passed.
<script language="javascript">
function setJValue(val)
</script>
ThanksThe only way you could simulate this, would be call the same page inside the Javascript function, and send it the parameter that was passed. Then you would have your Java code retrieve this parameter by request.getParameter("value");, and set the variable accordingly.
-
Mapviewer Java Class Documentation
Is the Mapviewer java clase documented anywhere?
TIAIt is described in the mapviewer user's guide (accessible from OTN mapviewer site or the iAS 9.0.4/10.1.2 documentation library).
Detailed JavaDoc references of this API can be accessed off the main (Welcome) page of a typical MapViewer installation, including the quick start kit. -
How to download Java API documentation?
How to download Java API documentation?
Oh my... don't the question in here just get more and
more basic?
Try and have a look at http://java.sun.com/docs/
Tell me if you need help with pressing on any of the
links at that page.
:)I keep pressing on the links and nothing happens and now my screen is covered in finger smudges.
Maybe you are looking for
-
I just bought a new Ipad mini a while ago, and created a new apple ID *********** , I can't download anything on apps store, it keeps on asking for a credit card but I don't have one. Can I create an account without a credit card? <Edited by Host>
-
Adding field in material master
Hi All, I am trying to add field manufacture part number in material master. In field selection Manufacture part number (mara-mfrpn) field is optional. I checked the field selection group at material type level, transaction code field selection group
-
How to synchronise a flash disk with a macbook
Good day I have data on a flash disk that I like to keep synchronised with my Macbook (Under Lion). How and where can I find the procedure that will allow me to do this? Many thanks in advance. Best Pierre
-
I have an iTunes debt of $2.18 and I want to pay that using my 15$ redeemed iTunes cash store credit... But when it says "You have sufficient store credit to pay your outstanding balance" I click "PAY" but it only refreshes the Purchase History page
-
Installing my apps on a new iPhone
I've purchased a new iPhone !!?? So far so good. I cannot synchronized the apps I was using on the old one onto this new iPhone !!?? Any help concerning a re-installation procedure ? Displayed message was (in french): Certaines applications n'ont pas