How to convert ResultSet's value to String
Dear JDC's
plz tell me how to convert ResultSet's value to String.
kashif
I want to read a whole array from a table into a String[]
and then send it to another servlet before I forward it all to anther servlet with request.setParameter.....
Any ideas how to solve it....that is how far I got so far:
rs=pgresult("select count (answer) from answers where qid="+idnum);
numberofquestions = rs.getInt("mynumber");
rs=pgresult("SELECT answer FROM answers WHERE qgroup="+qgroup);
allanswers = new String[numberofquestions];
allanswers = (String[])rs.getArray(1).getArray();
req.setParameter("allanswers",allanswers);
RequestDispatcher dispatcher = req.getRequestDispatcher("editanswers");
dispatcher.forward(req,res);
Tobi
Similar Messages
-
How to convert an int variable into String type
hi everybody
i want to know how to convert an interger variable into string variable
i have to implement a code which goes like this
Chioce ch;
for(int i=0;i<32;i++)
// here i need a code to convert the int variable i into a string variable
ch.add(String variable);
how do i convert that int variable i into a String type variable??
can anyone help me?Different methods:
int a;
string s=a+"";or
String.valueOf(int) is the better option because Int.toString() generated an intermediate object to get the endresult
Ema -
How to convert the character value to currency/numeric
Hi,
See the sample code here
data: v_qtr_field(7).
data: w_low_limit like glt0-kslvt,
w_amount like glt0-hslvt.
w_low_limit = 02.
w_max_period = 3.
concatenate 'HSL' w_low_limit into v_qtr_field.
*comment
*I am looking for a field formation thru above code like in GLT0 table like HSL02,HSL03 *etc based on the value user entered in the selection *screen
DO w_max_period TIMES
VARYING w_amount FROM v_qtr_field NEXT v_qtr_field + 1.
t_trans_values-dmbe2 = t_trans_values-dmbe2 + w_amount.
ENDDO.
I am facing problem in the Do loop as it wont allows multiple data types. can you suggest me how to convert the v_qtr_field whose data type is character to currency?Hi,
Please check this code .
PERFORM write_currency
USING buf_anla-urwrt t_dates-waers t_txw_anla-urwrt.
* FORM WRITE_CURRENCY *
* convert currency amount to string *
* - use decimal point *
* - remove separator characters *
* --> P_AMOUNT *
* --> P_CURRENCY_UNIT *
* --> P_STRING *
FORM WRITE_CURRENCY
USING P_AMOUNT TYPE P
P_CURRENCY_UNIT LIKE TCURC-WAERS
P_STRING TYPE C.
DATA: DEC2POINT(2) TYPE C VALUE ',.'.
* convert separator to decimal point
WRITE P_AMOUNT TO P_STRING CURRENCY P_CURRENCY_UNIT
NO-GROUPING
NO-SIGN
LEFT-JUSTIFIED.
TRANSLATE P_STRING USING DEC2POINT.
* put minus sign before number
IF p_amount < 0.
SHIFT P_STRING RIGHT.
P_STRING(1) = '-'.
ENDIF.
ENDFORM.
<i>Hope This Info Helps YOU.</i>
Regards,
Lakshmi -
How i pass table column value to string variable or return to java applete
Hi Master,
How do I pass a table column value into string variable. See my code below:
import java.sql.*;
public class Waheed {
public Waheed() {
public static void main (String args [])
String s = "9 23 45.4 56.7";
System.out.println ("going for connection");
// DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn =
DriverManager.getConnection("jdbc:oracle:thin:@fahim:1521:aamir","muhammad","mfa786");
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery("select accid from accbal");
System.out.println ("going for connection");
while (rset.next())
s= rset.getString("accid"); this line give me error
System.out.println (rset.getString("accid"));
System.out.println (s);
catch(Exception e){
e.printStackTrace();
This line give me an error:
s= rset.getString("accid");
s is string variable
Plese give me an idea how I can pass accid in s variable.
Thanks.
AamirSee the code sample in the following thread (try using upeercase).
JDBC connection
Kuassi -
How to convert a date value into week value?
How to display the date value like '20010203'
into the week number of the year 2001?
When i type in the following sql
select week(chg_time) from site;
I got this error message
ORA-00904: invalid column nameuse the to_char function, to format the date into a week number (then you might need to convert that to a number using to_number)
select to_char( sysdate, 'WW') from dual`
a description of datetime formats: http://download-west.oracle.com/otndoc/oracle9i/901_doc/server.901/a90125/sql_elements4.htm#48515 -
How to get the viewrow value by string
Using Jdev11.1.1.5.0-adfbc-ireport3.0.0
here i'll describe: what i did.
am using jsff(dynamic region) while hitting the af:tree nodes it will opens. ok fine
i had somevo with manually wroten query. and query is fine no problem with that
here i give sample not a original query
select * from sometable where acctid = :pacctidi drag and drop the pacctid from corresponding execute params vo as selectoncechoice
static vo
Data value - account payable , advance
Data Name - ap,ad
in that jsff
*page representation*
account type : account payable (ap) - select one choice type
advance (ad) - select one choice type
like this some select once choice and some inputs.
Run report - command button
.jsff code
<af:selectOneChoice value="#{bindings.ACCT_TYPE.inputValue}"
label="Account Type"
shortDesc="#{bindings.ACCT_TYPE.hints.tooltip}"
id="soc3" required="true"
autoSubmit="true"
binding="#{backingBeanScope.SUP1040V.soc3}"
valuePassThru="true"
valueChangeListener="#{backingBeanScope.SUP1040V.ValueChangeListener1}">
<f:selectItems value="#{bindings.ACCT_TYPE.items}" id="si3"/>
</af:selectOneChoice>
<af:commandToolbarButton text="Export in pdf" id="ctb2">
<af:fileDownloadActionListener method="#{backingBeanScope.SUP1040V.Report}"
/>
</af:commandToolbarButton>.java
//while hitting the button following logs are appeared i show it as commented format.
public void Report(FacesContext context, OutputStream out) throws IOException,Exception
FacesContext ctx = FacesContext.getCurrentInstance();
HttpServletRequest request =
(HttpServletRequest)ctx.getExternalContext().getRequest();
HttpServletResponse response =
(HttpServletResponse)ctx.getExternalContext().getResponse();
BindingContainer bindings1 = BindingContext.getCurrent().getCurrentBindingsEntry();
System.out.println("print binding" +bindings1 );
//while using sop i get this in my log : : print binding ReportsPageFragments_SUP1040VPageDef_WEB_INF_TaskFlows_SUP1040_V_TF_xml_SUP1040_V_TF
JUCtrlListBinding listBinding1 = (JUCtrlListBinding)bindings1.get("ACCT_TYPE");
System.out.println("print list bindings" +listBinding1 );
//while using sop i get this in my log : : print list bindings0
Object selectedValue1 = listBinding1.getSelectedValue();
System.out.println("print selected value" + selectedValue1);
//while using sop i get this in my log : : print selected valueViewRow [oracle.jbo.Key[AP ]]
request.setAttribute("ACCT_TYPE", //here i want the value "AP" in String );
if i use like this means
request.setAttribute("ACCT_TYPE", soc1.getValue() ); i get the index value.
i need the dataname "ap" so i go above method which say wrotes ...
request.getRequestDispatcher(response.encodeURL("/sup1040servlet")).forward(request,response);
System.out.println("hihihihih");
response.flushBuffer();
ctx.responseComplete();
public void ValueChangeListener1(ValueChangeEvent valueChangeEvent) {
// Add event code here...
String AcctType = valueChangeEvent.getNewValue().toString();
System.out.println("AcctType" + AcctType);
FacesContext contxt = FacesContext.getCurrentInstance();
valueChangeEvent.getComponent().processUpdates(contxt);
BindingContainer bindings1 =
BindingContext.getCurrent().getCurrentBindingsEntry();
// Get the sepecific list binding
JUCtrlListBinding listBinding1 =
(JUCtrlListBinding)bindings1.get("ACCT_TYPE");
// Get the value which is currently selected
Object selectedValue1 = listBinding1.getSelectedValue();
System.out.println(selectedValue1);
}if i get ap means my report runs. or else it will shows empty page.
how to get the viewrowimpl class value as string.
Edited by: ADF7 on Mar 24, 2012 7:27 AMADF7,
I'm not sure I understand what you are up to.
As far as I understand you want to get the display value instead of the index
I use this code
public void StatusChangedListener(ValueChangeEvent valueChangeEvent)
BindingContext lBindingContext = BindingContext.getCurrent();
BindingContainer lBindingContainer = lBindingContext.getCurrentBindingsEntry();
JUCtrlListBinding list = (JUCtrlListBinding) lBindingContainer.get("Status");
int newindex = (Integer) valueChangeEvent.getNewValue();
Object row = list.getDisplayData(); // Wichtig um die liste zu laden!!!!
Row lFromList = (Row) list.getValueFromList(newindex);
Object lAttribute = lFromList.getAttribute("Value");
String newVal = (String) lAttribute;
}to get the value from a selectOneChoice component...
Timo -
How to convert a "text variable" to String with plugin
Hello,
I am currently developing a InDesign (CS5) plugin, where I need to manipulate text variable.
From the plugin I want to convert the "text variable" to string (in principle I should use the method "VariableToString (..)" of "ITextVariable")"
My problem is, how to find the text varial from its name (I think I should use the method "FindLocationsUsed(..)" of "ITextVariableSuite") and then convert it to String
I don't know how to use interfaces ITextVariable and ITextVariableSuite
Plugin implemented in C++ language
thank youInputStreamReader in=new InputStreamReader(fis);
StringWriter out=new StringWriter();
char[] buffer=new char[8192];
int sizeRead;
while ( ( sizeRead=in.read(buffer, 0, 8192) ) != -1 )
out.write(buffer, 0, sizeRead);
String content=out.toString(); -
How to convert ResultSet of MySQL to XML
How can we convert ResultSet of MySQL using Hibernate into XML packet for JSP?
maybe something like this
http://beansource.sourceforge.net -
How to convert some row values in columns
Hello guys,
I'm using Oracle 10g in a windows platform, I have the following data:
with test as
select '000-ME-001' tag_number, 'Capacity 150' tag_details1, '000-TS-M-226' tag_details2 from dual union all
select '000-ME-001' tag_number, 'Capacity 250' tag_details1, '000-TS-M-227' tag_details2 from dual union all
select '000-ME-001' tag_number, 'Capacity 350' tag_details1, '000-TS-M-228' tag_details2 from dual union all
select '000-ME-002' tag_number, 'Capacity 150' tag_details1, '000-TS-M-226' tag_details2 from dual union all
select '000-ME-002' tag_number, 'Capacity 250' tag_details1, '000-TS-M-227' tag_details2 from dual union all
select '000-ME-002' tag_number, 'Capacity 350' tag_details1, '000-TS-M-228' tag_details2 from dual union all
select '000-ME-003' tag_number, 'Capacity 150' tag_details1, '000-TS-M-226' tag_details2 from dual union all
select '000-ME-003' tag_number, 'Capacity 250' tag_details1, '000-TS-M-227' tag_details2 from dual union all
select '000-ME-003' tag_number, 'Capacity 350' tag_details1, '' tag_details2 from dual
)How can I covert the values of tag_details1 as column name to achieve this result:
tag_number Capacity 150 Capacity 250 Capacity 350
000-ME-001 000-TS-M-226 000-TS-M-227 000-TS-M-228
000-ME-002 000-TS-M-226 000-TS-M-227 000-TS-M-228
000-ME-003 000-TS-M-226 000-TS-M-227Hope you can help me, best regards.select tag_number
, max (decode (tag_details1, 'Capacity 150', tag_details2))
, max (decode (tag_details1, 'Capacity 250', tag_details2))
, max (decode (tag_details1, 'Capacity 350', tag_details2))
from test
group by tag_numberas in
SQL> with test as
2 (
3 select '000-ME-001' tag_number, 'Capacity 150' tag_details1, '000-TS-M-226' tag_details2 from dual union all
4 select '000-ME-001' tag_number, 'Capacity 250' tag_details1, '000-TS-M-227' tag_details2 from dual union all
5 select '000-ME-001' tag_number, 'Capacity 350' tag_details1, '000-TS-M-228' tag_details2 from dual union all
6 select '000-ME-002' tag_number, 'Capacity 150' tag_details1, '000-TS-M-226' tag_details2 from dual union all
7 select '000-ME-002' tag_number, 'Capacity 250' tag_details1, '000-TS-M-227' tag_details2 from dual union all
8 select '000-ME-002' tag_number, 'Capacity 350' tag_details1, '000-TS-M-228' tag_details2 from dual union all
9 select '000-ME-003' tag_number, 'Capacity 150' tag_details1, '000-TS-M-226' tag_details2 from dual union all
10 select '000-ME-003' tag_number, 'Capacity 250' tag_details1, '000-TS-M-227' tag_details2 from dual union all
11 select '000-ME-003' tag_number, 'Capacity 350' tag_details1, '' tag_details2 from dual
12 )
13 select tag_number
14 , max (decode (tag_details1, 'Capacity 150', tag_details2))
15 , max (decode (tag_details1, 'Capacity 250', tag_details2))
16 , max (decode (tag_details1, 'Capacity 350', tag_details2))
17 from test
18 group by tag_number
19 /
TAG_NUMBER MAX(DECODE(T MAX(DECODE(T MAX(DECODE(T
000-ME-002 000-TS-M-226 000-TS-M-227 000-TS-M-228
000-ME-001 000-TS-M-226 000-TS-M-227 000-TS-M-228
000-ME-003 000-TS-M-226 000-TS-M-227Edited by: Alex Nuijten on Jun 3, 2009 4:03 PM -
How to convert an int array to string array?
Hi,
Can anyone please help me with this question?
int number={4,6,45,3,2,77};
I like to convert this into a list and sort
List mylist = Arrays.asList(number);
Collections.sort(mylist);
But first I need to convert the int array to String array.
Please advise. Thanks.If you want to convert your int array to a String array, you have no choice but doing a conversion element by element in a for loop.
However, if the sort method doesn't behave as desired, you can use the one with 2 parameters, the second parameter being a comparator class.
Check the javadoc for more information : http://java.sun.com/j2se/1.3/docs/api/java/util/Collections.html
/Stephane -
Hi,
How can I convert HEX value to CHAR value.
The Code in <b>non Unicode</b> system is:
DATA: t_text LIKE tline OCCURS 0 WITH HEADER LINE.
constants: c_hex_20a5(2) TYPE x VALUE '20A5'.
t_text-tdline = 'seller of the item so listed. A legend of the Seller Code(s) is as'.
TRANSLATE t_text-tdline USING c_hex_20a5.
The same code give error in <b>Uni-Code</b> system:
<b>error is "c_hex_20a5 must be an character type object (C, N, D, T or String type)."</b>
If anyone know, what is the solution, please let me know.
Thanks!
Puneet.Hi,
Try declaring the Hex chars using the ABAP char utilities. This is just a sample piece of code on how to declare and use:
CLASS cl_abap_char_utilities DEFINITION LOAD.
DATA: ws_lf TYPE c VALUE cl_abap_char_utilities=>cr_lf.
data: c_newline TYPE x VALUE '0D'. [ it is zero D, for carriage return ]
ws_lf = c_newline.
CONCATENATE it_tab-maktx
ws_lf
ws_template
INTO it_notificatn-template.
Hope this helps...
Regards
Subramanian -
Error While trying to Convert a Date Value to string in POI API (Excel)
Hi
How can I convet a date value in excel to string value ? I am using POI API for excel sheet reading in JSP .Hello Esther,
the problem seems to be that the temp folder of the target Integration Builder system can't be found:
'The system cannot find the path specified
at [..] FileAccess.getTempDirectory([..])'.
You'll experience the same problem if you try a file based import or export within the Integration Builder directly.
I would recommend to continue the search there. You could check if the environment variables (for Windows: TEMP and TMP) of the OS of the system with the target Integration Builder to an existing path. Check also if the WebAs can access this path.
Good luck
Frank -
How to convert a measure value to null when the actual measure value is 0
Hello Gurus,
I have year, products, measure 1, measure 2, measure 3. I am added three products into one category by using bin in the analysis i am getting zeros for some of the measure cells when it should be null values, because the actual measure values are null for indivudual product. How can i convert that 0's to null. Please advise.
Thanks,
RCTo answer your immediate question, you can write this:
CASE WHEN table.column = 0 THEN NULL ELSE table.column END
Remember though, that any aggregations done on a record that is NULL will not yield a sum. That is why the usual case is to convert NULLs to 0s. But that may not be a concern for what you are doing. Good luck! -
How to convert resultset variable to integer variable
hii..i am making a jsp page in which i get the name of the product from the available products in the database and i give the quantity of the product from the jsp page which get stored in the database.Now the problem is when i give I want that only the product which i want come to the screen from the available products..for this i had made a combobox which selects the next item I want,but it is not working.Can anyone help me out.I am wriiting the code which I have written,Although it's not working.
<%@page language="java"%>
<%@page import="java.sql.*"%>
<%@page import="connect.connection"%>
<%
String productId = request.getParameter("pname")==null? "": request.getParameter("pname");
String strQuantity="";
%>
<%
Connection con1=null;
connection conn1=null;
con1=conn1.getconnection();
Statement st=null;
ResultSet rs=null;
st=con1.createStatement();
%>
<!--<script>
function subject()
document.registration.action="buyerForm2.jsp";
//document.registration.submit();
</script>-->
<HTML>
<HEAD>
<TITLE>Shree Cement : Register Buyer</TITLE>
<script language="javascript" src="../js/buyervalidate.js"></script>
</HEAD>
<body bgColor=3F7790 text=#000000 topMargin=12 border="0">
<!-- Begin header section -->
<jsp:include page="../header/header.jsp" />
<!-- End header section -->
<table width="800" align="center" border="0">
<tr>
<td bgcolor="#EBEBEB" width="135" valign="top">
<!--Begin left nav section-->
<jsp:include page="../include/left-nav-main.jsp" />
<!-- End left nav section-->
</td>
<!--main section of pp Buyer-->
<br>
<td rowspan=7 valign=top width="58%" align="center">
<table>
<tr>
<td class="img">Registration Form</td>
<td width="60%"></td>
<td align="left" class="img1">Buyer</td>
</tr>
</table>
<form name="login" method="post">
<table cellpadding=3 class="pp">
<tr>
<td>Online bid date :</td>
<td colspan=3 >
<select name="monthonline" class="formfield1" value="month" >
<option value="Month">-Month-
<option value=1> January
<option value=2>February
<option value=3>March
<option value=4>April
<option value=5> May
<option value=6> June
<option value=7> July
<option value=8> August
<option value=9> September
<option value=10> October
<option value=11> November
<option value=12> December
</select>
</td>
<td colspan=3 >
<select name="dateonline" class="formfield1" value="date">
<option value="Day">-Day-
<option value=1>1
<option value=2>2
<option value=3>3
<option value=4>4
<option value=5>5
<option value=6>6
<option value=7>7
<option value=8>8
<option value=9>9
<option value=10>10
<option value=11>11
<option value=12>12
<option value=13>13
<option value=14>14
<option value=15>15
<option value=16>16
<option value=17>17
<option value=18>18
<option value=19>19
<option value=20>20
<option value=21>21
<option value=22>22
<option value=23>23
<option value=24>24
<option value=25>25
<option value=26>26
<option value=27>27
<option value=28>28
<option value=29>29
<option value=30>30
<option value=31>31
</select>
</td>
<td >
<select name="yearonline" class="formfield1" value="year" align="left">
<option value="Year">-Year-
<option value=2003>2003
<option value=2004>2004
<option value=2005>2005
<option value=2006>2006
<option value=2007>2007
<option value=2008>2008
<option value=2009>2009
<option value=2010>2010
</select>
</td>
</tr>
<tr>
<td>Start time :</td>
<td colspan=3 width="296">
<select name="starttime" class="formfield1" size=1>
<option selected value="08:00:00">8 : 00 am
<option value="08:15:00">8 : 15 am
<option value="08:30:00">8 : 30 am
<option value="08:45:00">8 : 45 am
<option value="09:00:00">9 : 00 am
<option value="09:15:00">9 : 15 am
<option value="09:30:00">9 : 30 am
<option value="09:45:00">9 : 45 am
<option value="10:00:00">10 : 00 am
<option value="10:15:00">10 : 15 am
<option value="10:30:00">10 : 30 am
<option value="10:45:00">10 : 45 am
<option value="11:00:00">11 : 00 am
<option value="11:15:00">11 : 15 am
<option value="11:30:00">11 : 30 am
<option value="11:45:00">11 : 45 am
<option value="12:00:00">12 : 00 pm
<option value="12:15:00">12 : 15 pm
<option value="12:30:00">12 : 30 pm
<option value="12:45:00">12 : 45 pm
<option value="13:00:00">1 : 00 pm
<option value="13:15:00">1 : 15 pm
<option value="13:30:00">1 : 30 pm
<option value="13:45:00">1 : 45 pm
<option value="14:00:00">2 : 00 pm
<option value="14:15:00">2 : 15 pm
<option value="14:30:00">2 : 30 pm
<option value="14:45:00">2 : 45 pm
<option value="15:00:00">3 : 00 pm
<option value="15:15:00">3 : 15 pm
<option value="15:30:00">3 : 30 pm
<option value="15:45:00">3 : 45 pm
<option value="16:00:00">4 : 00 pm
<option value="16:15:00">4 : 15 pm
<option value="16:30:00">4 : 30 pm
<option value="16:45:00">4 : 45 pm
<option value="17:00:00">5 : 00 pm
<option value="17:15:00">5 : 15 pm
<option value="17:30:00">5 : 30 pm
<option value="17:45:00">5 : 45 pm
<option value="18:00:00">6 : 00 pm
<option value="18:15:00">6 : 15 pm
<option value="18:30:00">6 : 30 pm
<option value="18:45:00">6 : 45 pm
<option value="19:00:00">7 : 00 pm
<option value="19:15:00">7 : 15 pm
<option value="19:30:00">7 : 30 pm
<option value="19:45:00">7 : 45 pm
<option value="20:00:00">8 : 00 pm
</select>
</td>
</tr>
<tr>
<td>End
time :</td>
<td colspan=3 width="296">
<select name="endtime" class="formfield1" size=1><br>
<option selected value="08:00:00">8 : 00 am
<option value="08:15:00">8 : 15 am
<option value="08:30:00">8 : 30 am
<option value="08:45:00">8 : 45 am
<option value="09:00:00">9 : 00 am
<option value="09:15:00">9 : 15 am
<option value="09:30:00">9 : 30 am
<option value="09:45:00">9 : 45 am
<option value="10:00:00">10 : 00 am
<option value="10:15:00">10 : 15 am
<option value="10:30:00">10 : 30 am
<option value="10:45:00">10 : 45 am
<option value="11:00:00">11 : 00 am
<option value="11:15:00">11 : 15 am
<option value="11:30:00">11 : 30 am
<option value="11:45:00">11 : 45 am
<option value="12:00:00">12 : 00 pm
<option value="12:15:00">12 : 15 pm
<option value="12:30:00">12 : 30 pm
<option value="12:45:00">12 : 45 pm
<option value="13:00:00">1 : 00 pm
<option value="13:15:00">1 : 15 pm
<option value="13:30:00">1 : 30 pm
<option value="13:45:00">1 : 45 pm
<option value="14:00:00">2 : 00 pm
<option value="14:15:00">2 : 15 pm
<option value="14:30:00">2 : 30 pm
<option value="14:45:00">2 : 45 pm
<option value="15:00:00">3 : 00 pm
<option value="15:15:00">3 : 15 pm
<option value="15:30:00">3 : 30 pm
<option value="15:45:00">3 : 45 pm
<option value="16:00:00">4 : 00 pm
<option value="16:15:00">4 : 15 pm
<option value="16:30:00">4 : 30 pm
<option value="16:45:00">4 : 45 pm
<option value="17:00:00">5 : 00 pm
<option value="17:15:00">5 : 15 pm
<option value="17:30:00">5 : 30 pm
<option value="17:45:00">5 : 45 pm
<option value="18:00:00">6 : 00 pm
<option value="18:15:00">6 : 15 pm
<option value="18:30:00">6 : 30 pm
<option value="18:45:00">6 : 45 pm
<option value="19:00:00">7 : 00 pm
<option value="19:15:00">7 : 15 pm
<option value="19:30:00">7 : 30 pm
<option value="19:45:00">7 : 45 pm
<option value="20:00:00">8 : 00 pm
</select>
</td>
</tr>
</table>
<table class="log" cellpadding=3 cellspacing=0 border="0">
<% String strname="";
rs=st.executeQuery("select name from product");
if(rs.next())
strname=rs.getString(1);
%>
<tr>
<td align="left"><%=strname%></td>
<td></td>
<td>Quantity(in lacs):</td>
<td><input type="text" class="formfield" name="items2" onkeypress="if(event.keyCode >47 && event.keyCode < 58){event.returnValue = true;} else{event.returnValue = false;}"></td>
</tr>
<tr>
<td>Select Product Name :</td>
<td></td>
<td>
<select name="pname"><option>select</option>
<%
String username="";
rs=st.executeQuery("select name from product");
while(rs.next())
username = rs.getString(1);
%>
<option <%if(productId.equals(username)){%> <%}%>><%=username%></option>
<% } %>
</select>
</td>
</tr>
<%
int count=1;
rs=st.executeQuery("select max(auction_id) from auction1");
int num = Integer.parseInt(pageContext.findAttribute("num").toString());
out.println(num);
//for(count=1;count < num;count++)
//out.println(rs);
String name="";
rs=st.executeQuery("select name from product where name='"+username+"'");
//out.println(rs);
if(rs.next())
name=rs.getString(1);
if(name.equals(username))
{%>
<tr>
<td align="left"><%=name%></td>
<td>Quantity(in lacs):</td>
<td><input type="text" class="formfield" name="items2" onkeypress="if(event.keyCode > 47 && event.keyCode < 58){event.returnValue = true;} else{event.returnValue = false;}"></td>
</tr>
<%}
%>
</table>
<table cellpadding="5" align="center" bgcolor=#FFFFFF width="397">
<tr>
<td>
<input type="submit" value="Add more Items" onClick="add();">
</td>
<td width="115"align="right">
<input type="submit" value="Continue"onClick="return validate();" name="submit">
</td>
<td>
<input type="reset" value="Clear all fields" name="reset">
</td>
</tr>
</table>
</form>
</td>
<!-- End Main section -->
<td width="23%" valign="top" bgcolor="#EBEBEB" border="0">
<!--Begin right nav section-->
<jsp:include page="../include/rightbar2.jsp" />
<!-- End right nav section -->
</td>
<!-- Begin footer section -->
<jsp:include page="../footer/footer.jsp" />
<!-- End footer section -->It's highly recommended to use any business, logic and DB access tasks in a Servlet. JSP should be used only to display HTML forms/results.
<%@page language="java"%>
<%@page import="java.sql.*"%>
<%@page import="connect.connection"%>
<% String productId = request.getParameter("pname")==null? "": request.getParameter("pname"); String strQuantity=""; %>
<% Connection con1=null; connection conn1=null; con1=conn1.getconnection(); Statement st=null; ResultSet rs=null; st=con1.createStatement(); %>
<!--<script> function subject() { document.registration.action="buyerForm2.jsp"; //document.registration.submit(); } </script>-->
<HTML>
<HEAD>
<TITLE>Shree Cement : Register Buyer</TITLE>
<script language="javascript" src="../js/buyervalidate.js"></script>
</HEAD>
<body bgColor=3F7790 text=#000000 topMargin=12 border="0">
<!-- Begin header section -->
<jsp:include page="../header/header.jsp" />
<!-- End header section -->
<table width="800" align="center" border="0">
<tr>
<td bgcolor="#EBEBEB" width="135" valign="top"><!--Begin left nav section--> <jsp:include
page="../include/left-nav-main.jsp" /> <!-- End left nav section--></td>
<!--main section of pp Buyer-->
<td rowspan=7 valign=top width="58%" align="center">
<table>
<tr>
<td class="img">Registration Form</td>
<td width="60%"></td>
<td align="left" class="img1">Buyer</td>
</tr>
</table>
<form name="login" method="post">
<table cellpadding=3 class="pp">
<tr>
<td>Online bid date :</td>
<td colspan=3><select name="monthonline" class="formfield1" value="month">
<option value="Month">-Month-
<option value=1>January
<option value=2>February
<option value=3>March
<option value=4>April
<option value=5>May
<option value=6>June
<option value=7>July
<option value=8>August
<option value=9>September
<option value=10>October
<option value=11>November
<option value=12>December
</select></td>
<td colspan=3><select name="dateonline" class="formfield1" value="date">
<option value="Day">-Day-
<option value=1>1
<option value=2>2
<option value=3>3
<option value=4>4
<option value=5>5
<option value=6>6
<option value=7>7
<option value=8>8
<option value=9>9
<option value=10>10
<option value=11>11
<option value=12>12
<option value=13>13
<option value=14>14
<option value=15>15
<option value=16>16
<option value=17>17
<option value=18>18
<option value=19>19
<option value=20>20
<option value=21>21
<option value=22>22
<option value=23>23
<option value=24>24
<option value=25>25
<option value=26>26
<option value=27>27
<option value=28>28
<option value=29>29
<option value=30>30
<option value=31>31
</select></td>
<td><select name="yearonline" class="formfield1" value="year" align="left">
<option value="Year">-Year-
<option value=2003>2003
<option value=2004>2004
<option value=2005>2005
<option value=2006>2006
<option value=2007>2007
<option value=2008>2008
<option value=2009>2009
<option value=2010>2010
</select></td>
</tr>
<tr>
<td>Start time :</td>
<td colspan=3 width="296"><select name="starttime" class="formfield1" size=1>
<option selected value="08:00:00">8 : 00 am
<option value="08:15:00">8 : 15 am
<option value="08:30:00">8 : 30 am
<option value="08:45:00">8 : 45 am
<option value="09:00:00">9 : 00 am
<option value="09:15:00">9 : 15 am
<option value="09:30:00">9 : 30 am
<option value="09:45:00">9 : 45 am
<option value="10:00:00">10 : 00 am
<option value="10:15:00">10 : 15 am
<option value="10:30:00">10 : 30 am
<option value="10:45:00">10 : 45 am
<option value="11:00:00">11 : 00 am
<option value="11:15:00">11 : 15 am
<option value="11:30:00">11 : 30 am
<option value="11:45:00">11 : 45 am
<option value="12:00:00">12 : 00 pm
<option value="12:15:00">12 : 15 pm
<option value="12:30:00">12 : 30 pm
<option value="12:45:00">12 : 45 pm
<option value="13:00:00">1 : 00 pm
<option value="13:15:00">1 : 15 pm
<option value="13:30:00">1 : 30 pm
<option value="13:45:00">1 : 45 pm
<option value="14:00:00">2 : 00 pm
<option value="14:15:00">2 : 15 pm
<option value="14:30:00">2 : 30 pm
<option value="14:45:00">2 : 45 pm
<option value="15:00:00">3 : 00 pm
<option value="15:15:00">3 : 15 pm
<option value="15:30:00">3 : 30 pm
<option value="15:45:00">3 : 45 pm
<option value="16:00:00">4 : 00 pm
<option value="16:15:00">4 : 15 pm
<option value="16:30:00">4 : 30 pm
<option value="16:45:00">4 : 45 pm
<option value="17:00:00">5 : 00 pm
<option value="17:15:00">5 : 15 pm
<option value="17:30:00">5 : 30 pm
<option value="17:45:00">5 : 45 pm
<option value="18:00:00">6 : 00 pm
<option value="18:15:00">6 : 15 pm
<option value="18:30:00">6 : 30 pm
<option value="18:45:00">6 : 45 pm
<option value="19:00:00">7 : 00 pm
<option value="19:15:00">7 : 15 pm
<option value="19:30:00">7 : 30 pm
<option value="19:45:00">7 : 45 pm
<option value="20:00:00">8 : 00 pm
</select></td>
</tr>
<tr>
<td>End time :</td>
<td colspan=3 width="296"><select name="endtime" class="formfield1" size=1>
<option selected value="08:00:00">8 : 00 am
<option value="08:15:00">8 : 15 am
<option value="08:30:00">8 : 30 am
<option value="08:45:00">8 : 45 am
<option value="09:00:00">9 : 00 am
<option value="09:15:00">9 : 15 am
<option value="09:30:00">9 : 30 am
<option value="09:45:00">9 : 45 am
<option value="10:00:00">10 : 00 am
<option value="10:15:00">10 : 15 am
<option value="10:30:00">10 : 30 am
<option value="10:45:00">10 : 45 am
<option value="11:00:00">11 : 00 am
<option value="11:15:00">11 : 15 am
<option value="11:30:00">11 : 30 am
<option value="11:45:00">11 : 45 am
<option value="12:00:00">12 : 00 pm
<option value="12:15:00">12 : 15 pm
<option value="12:30:00">12 : 30 pm
<option value="12:45:00">12 : 45 pm
<option value="13:00:00">1 : 00 pm
<option value="13:15:00">1 : 15 pm
<option value="13:30:00">1 : 30 pm
<option value="13:45:00">1 : 45 pm
<option value="14:00:00">2 : 00 pm
<option value="14:15:00">2 : 15 pm
<option value="14:30:00">2 : 30 pm
<option value="14:45:00">2 : 45 pm
<option value="15:00:00">3 : 00 pm
<option value="15:15:00">3 : 15 pm
<option value="15:30:00">3 : 30 pm
<option value="15:45:00">3 : 45 pm
<option value="16:00:00">4 : 00 pm
<option value="16:15:00">4 : 15 pm
<option value="16:30:00">4 : 30 pm
<option value="16:45:00">4 : 45 pm
<option value="17:00:00">5 : 00 pm
<option value="17:15:00">5 : 15 pm
<option value="17:30:00">5 : 30 pm
<option value="17:45:00">5 : 45 pm
<option value="18:00:00">6 : 00 pm
<option value="18:15:00">6 : 15 pm
<option value="18:30:00">6 : 30 pm
<option value="18:45:00">6 : 45 pm
<option value="19:00:00">7 : 00 pm
<option value="19:15:00">7 : 15 pm
<option value="19:30:00">7 : 30 pm
<option value="19:45:00">7 : 45 pm
<option value="20:00:00">8 : 00 pm
</select></td>
</tr>
</table>
<table class="log" cellpadding=3 cellspacing=0 border="0">
<% String strname="";
rs=st.executeQuery("select name from product");
if(rs.next()) {
strname=rs.getString(1);
%>
<tr>
<td align="left"><%=strname%></td>
<td></td>
<td>Quantity(in lacs):</td>
<td><input type="text" class="formfield" name="items2"
onkeypress="if(event.keyCode >47 && event.keyCode < 58){event.returnValue = true;} else{event.returnValue = false;}"></td>
</tr>
<tr>
<td>Select Product Name :</td>
<td></td>
<td><select name="pname">
<option>--select--</option>
<%
String username="";
rs=st.executeQuery("select name from product");
while(rs.next()) { username = rs.getString(1); %>
<option>
<%if(productId.equals(username)){%>
<%}%>
<%=username%>
</option>
<% } %>
</select></td>
</tr>
<%
int count=1;
rs=st.executeQuery("select max(auction_id) from auction1");
int num = Integer.parseInt(pageContext.findAttribute("num").toString());
out.println(num);
//for(count=1;count < num;count++) //{ //out.println(rs); String name=""; rs=st.executeQuery("select name from product where name='"+username+"'"); //out.println(rs); if(rs.next()) { name=rs.getString(1); } //} if(name.equals(username)) {
%>
<tr>
<td align="left"><%=num%></td>
<td>Quantity(in lacs):</td>
<td><input type="text" class="formfield" name="items2"
onkeypress="if(event.keyCode > 47 && event.keyCode < 58){event.returnValue = true;} else{event.returnValue = false;}"></td>
</tr>
</table>
<table cellpadding="5" align="center" bgcolor=#FFFFFF width="397">
<tr>
<td><input type="submit" value="Add more Items" onClick="add();"></td>
<td width="115" align="right"><input type="submit" value="Continue" onClick="return validate();" name="submit">
</td>
<td><input type="reset" value="Clear all fields" name="reset"></td>
</tr>
</table>
</form>
</td>
<!-- End Main section -->
<td width="23%" valign="top" bgcolor="#EBEBEB" border="0"><!--Begin right nav section-->
<jsp:include page="../include/rightbar2.jsp" /> <!-- End right nav section --></td>
<!-- Begin footer section -->
<jsp:include page="../footer/footer.jsp" />
<!-- End footer section --> -
How to convert a datetime value to UTC (or GMT)
I have this problem.
The user should provide the following inputs:
- A date time value - i.e: 10 september 2006, 10:40 AM
- The world location to which that value refers - i.e.: Rome/Italy
I need as output, the UTC date time value:
- i.e: 10 september 2006, 8:40 AM
in this case it is two hours before because during summer time, the Italian timezone is GMT+2
And if the user enters:
- A date time value - i.e: 25 december 2006, 10:40 AM
- The world location to which that value refers - i.e.: Rome/Italy
The output should be: (UTC time)
- i.e: 25 december 2006, 9:40 AM
It only only one hour before because during winter, in italy the timezone is GMT+1
In few words I need that Java can do by itself all the calculations about the timezone and daylight saving around different places in the world, so that I can store in my DB the universal UTC time.
Can you suggest me some code or some good URLs?
Thanks in advanceI wrote this code, it works but I have still some issues.
GregorianCalendar abroad = new GregorianCalendar(TimeZone.getTimeZone("Asia/Tokyo"));
abroad.set(Calendar.YEAR, 2006);
abroad.set(Calendar.MONTH, 11);
abroad.set(Calendar.DATE, 25);
abroad.set(Calendar.HOUR_OF_DAY, 1);
abroad.set(Calendar.MINUTE, 0);
abroad.set(Calendar.SECOND, 0);
System.out.println(abroad.getTime());
DateFormat df1 = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL);
df1.setTimeZone(TimeZone.getTimeZone("Asia/Tokyo"));
System.out.println(df1.format(abroad.getTime()));
DateFormat df2 = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL);
df2.setTimeZone(TimeZone.getTimeZone("America/New_York"));
System.out.println(df2.format(abroad.getTime()));
DateFormat df3 = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL);
df3.setTimeZone(TimeZone.getTimeZone("Etc/UTC"));
System.out.println(df3.format(abroad.getTime())); It outputs:
Sun Dec 24 17:00:00 CET 2006
luned� 25 dicembre 2006 1.00.00 JST
domenica 24 dicembre 2006 11.00.00 EST
domenica 24 dicembre 2006 16.00.00 UTCIn few words this code is able to compute any date from a specific timezone, to other timezone.
My questions are:
- Why the first output is in english ? and the other are in italian? (my OS is italian) but I didn't changed the locale in the code, so I don't understand why it outputs english text.
- When I get the date value in other timezones, I just get a "string" computed by the "format(...)" method of the DateFormat class.
But I really need to get something "numeric" for every specific value: minutes, hours, day of the month, month, year. Because this class will be used outside java and I don't need a string but something that the user will have formatted in his choosen locale setting for its website. (i think that I was not good to explain this point, i hope that someone can understand)
However thank you all :)
Maybe you are looking for
-
Error in converting to To_number
i'm using an employee table in which the phone number is stored as a character.. eg: 515.123.4567. i want to extract the last 8 numbers and convert it into a number format.. i user the following query.. select substr(phone_number,-8) from employees a
-
No reqmts/caps exists or not relevant to finite shceduling
Hi All, I am getting above warning message if click on capacity tab in process order. I have maintauned finite scheduling tick all reources in which is applicalbel for this process order. also i am getting information message Capacity availability:
-
Hello, I wrote below code to catch key event. Does anyone can write / suggest better code ? I am desperate on Capturing key event : (( import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Anim extends JPanel implements Runna
-
Open Link in new window, when field or column type is of Hyperlink
Hi I have created a column by name Registration of 'Hyperlink or picture' type, and i want to open the link entered by the user in the new window as it is opening in the same window by default. Please help its a very major requirement. Thanks Paru
-
Correction to LD / UUP Portal Example
In the LD / UUP example - in deployment_descriptor_entries.txt - in the following snippet - PropertyMapping/UUPExample should be PropertyMapping/LDUserFull(the name of the Property Set) <!-- map all properties in UUPExample property set to LDEntityPr