How can I write the action attribute of a form dynamically using JSP
I would like to do something like this:
If the 'Accept-Language' of the http request is 'en', write out this in JSP:
<form name='myform action="http://127.0.0.1/myservlet/en/>
else if
the 'accept-language' is 'es', write out this instead:
<form name='myform action="http://127.0.0.1/myservlet/es/>
else if no match
<form name='myform action="http://127.0.0.1/myservlet/default/>
How can I do that in JSP? I think this is simple enough so that I don' t need to use any of the Java Web framework/Java Beans.
Thank you for any help.
you can use a simple javascript for this:
function setAction(lang){
if(lang=="en"){
document.forms[0].action="putYourservletUrlhere";
}else if(lang=="es"){
document.forms[0].action="putYourservletUrlhere";
}else{
document.forms[0].action="putYourservletUrlhere";
}
Similar Messages
-
How can i write the floats value in Unitronics vision230 plc using modbus Ethernet
How can i write the Float value in unitronics Vision230 PLC usinsg modbus ethernet (MB Ethernet Master Query.vi) I read and write the 32 bit register, for e.g i want to write the 23.45 value on 2nd add. of MF. And MF register is 32 bit register. I read and write the 32 bit register.
Narendra.
Solved!
Go to Solution.Thanks Amit for your solution but i can not use the string to write the value because MB Ethernet master Query.vi only accepet the integer value its not take string values or any other i.e floats values etc.....otherwise i have no problem to write or read the 32 bit register values , only problem is that the MB Ethernet master Query.vi only accept the integer value there4 how can write the float value.
Narendra
Message Edited by Artemistech on 01-30-2009 11:06 PM -
How can send to the print Queue in Ring Barcode printer using jsp?
Any one help me Please
I Tried it in Servlets But i wont detect the printer......
My Coding in Servlet.....
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.lang.*;
import java.security.*;
import java.awt.*;
import java.awt.print.*;
public class BarCodeServlet2 extends HttpServlet implements Printable, Servlet
// The following function is a placeholder for control initialization.
// You should call this function from a constructor or initialization function.
public void vcInit() {
//{{INIT_CONTROLS
// Our barcode string //
String s="FMT(1,576d,414d,0,0,1)\n" +
"DMD(1)\nDPD(1)\nACL()\nCOL(0)\nFAG(2)\nCFL(1,420d,376d,8,2,2)\nCFL(2,416d,352d,8,2,2)\n" +
"CFL(2,416d,352d,8,2,2)\nLIN(3,0d,330d,529d,330d,1,3)\nCFL(4,504d,280d,6,1,1)\nCFL(5,504d,233d,6,1,1)\n" +
"CFL(6,504d,327d,6,1,1)\nCFL(7,504d,185d,6,1,1)\nCFL(8,504d,138d,6,1,1)\nCFL(9,339d,116d,8,2,2)\n" +
"BDN(2,4)\nBFL(10,458d,94d,0,28,59d)\nCFL(11,435d,24d,6,1,1)\nCFL(12,413d,406d,2,1,1)\n" +
"DAT(1,[email protected])\nDAT(2,[email protected])\nDAT(3,LIN)\n" +
"DAT(4,COLOUR :RED)\nDAT(5,SIZE :S28)\nDAT(6,NAME :ST0060)\n" +
"DAT(7,STYLE :HALF SLEEVES)\nDAT(8,PRICE :600)\n" +
"DAT(9,:(Incl of all Taxes//))\nDAT(10,/6ST1D003J-134N)\nDAT(11,ST1D003J-134N)\n" +
"DAT(12,BLAZE APPARELS-INDIA)\nPRT(1,0,1)";
public static int count=0;
public void service(HttpServletRequest req, HttpServletResponse res)
throws ServletException,IOException
PrintWriter out = res.getWriter();
res.setContentType("text/html");
out.println("<html><head><title>My Servlet!</title></head>");
out.println("<body><h1>Hello Test ,updated!"+ s + "</h1></body></html>");
PrinterJob job=PrinterJob.getPrinterJob();
JobAttributes ja = new JobAttributes();
// Make sure the print dialog box doesn't open because were in a Servlet//
ja.setDialog(JobAttributes.DialogType.NONE);
// Get the page format /.
PageFormat page = job.defaultPage();
// Get the paper object //
Paper paper =page.getPaper();
// Make the whole page imageable ..
paper.setImageableArea(0,0,page.getHeight(),page.getWidth());
page.setPaper(paper);
job.defaultPage(page);
job.setPrintable(this,page);
try{
// Print //
job.print();
}catch(Exception e)
out.println("Exception caught");
out.println(e.getMessage()+ "Exception caught");
out.flush();
public int print(Graphics g, PageFormat f, int pageIndex)
if(pageIndex >0)
return NO_SUCH_PAGE;
//g.drawString(s,0,9 );
g.drawString(s,0,32 );
return PAGE_EXISTS;
//{{DECLARE_CONTROLS
}FileOutputStream printOut = new
= new FileOutputStream("Samsung ML-1450 Series on
JPRASAD");If that is supposed to be the name of the printer, I am afraid that is not the way it is done. As much as I could help you, I would suggest you to take a look at the API docs and check the classes under the javax.print package. -
Excel MySQL - To set the action attribute in a form
Hi All
I am working on an application that requires to read data from Excel and update the table in MySQL. My java code works well and does the required. For the user to select an excel file, i have designed a form using JSP. This JSP form gets loaded through Tomcat..When the user browses and selects the required file, he then will click on the update button and the java code then should be executed.
How can i set the action attribute in form tag to execute java code.
Following is my code.
<%@page
language="java"
import="javax.servlet.*,javax.servlet.http.*,java.io.*,java.util.*,java.sql.*"
info="BulkUpdate"
session="true"
%>
<html>
<head></head>
<title>Bulk Update Page</title>
<body bgcolor="#FFcc00">
<p style="margin-top: 0; margin-bottom: 0">
<u><b><font color="#800000" size="4"><center>Update Data from Excel Sheet to Database</center></font></b></u></p><br>
<p style="margin-top: 0; margin-bottom: 0">
<font face="arial" color="#000080" align="left"><b>Bulk Update on :</b>
<%
java.util.Date date = new java.util.Date();
%></font>
<%
out.print( date );
%>
<br><br>
<b><font size="2" face="Arial" color="#000080">This page is used to Select the
data and configuration file in the browser and update MYSQL database
</font></b></p>
<form action="http:\\localhost:8080\itasm\ExcelTest3.java" method="post" enctype="multipart/form-data">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="98%" id="AutoNumber1">
<tr>
<td width="34%" bgcolor="#800000"><b>
<font face="Arial" color="#FFFF00" size="2">Select the Excel File to update </font>
</b></td>
<td width="53%" bgcolor="#800000">
<p align="left"><input size="34" type="file" name="spreadsheet" /></td>
<td width="17%" bgcolor="#800000"><input type="submit" value="Update File" /></td>
</tr><br>
<tr>
<td width="34%" bgcolor="#800000"><b>
<font face="Arial" color="#FFFF00" size="2">Select the corresponding Configuration File</td>
<td width="17%" bgcolor="#800000"><input size="34" type="file" name="configfile" /></td>
<td width="53%" bgcolor="#800000"></td>
</tr></font>
</table>
</form>
<p style="margin-top: 0; margin-bottom: 0">
</p>
</body>
</html>When i execute the above code rather than executing the code, it just displays it in the browser.
Please help.
RegardsHi Andy!
I just started to set the tabindex on each item... it wasn't working.. I copied the example you gave.. ha.. you had taxindex --- TAX and I too didn't notice it.. so just want to mention it incase anyone does what I did.. copies without thinking..
As you said in the previous post it is TABINDEX="n"
Ha.. its a Monday.. Bill -
How can i write the below code using "For all entries"
Hi
How can we write the below code using "for all entries" and need to avoid joins...
Please help
SELECT aaufnr aobjnr aauart atxjcd a~pspel
agstrp awerks carbpl cwerks
INTO TABLE t_caufv
FROM caufv AS a
INNER JOIN afih AS b
ON aaufnr = baufnr
INNER JOIN crhd AS c
ON bgewrk = cobjid
AND c~objty = 'D'
WHERE ( a~pspel = space
OR a~txjcd = space
OR NOT a~objnr IN
( select OBJNR from COBRB AS e
WHERE objnr = a~objnr ) )
AND a~werks IN s_plant
AND a~auart IN s_wtype
AND NOT a~objnr IN
( select OBJNR from JEST AS d
WHERE objnr = a~objnr
AND ( dstat = 'A0081'OR dstat = 'A0018' )
AND d~inact 'X' ).
Reward points for all helpfull answers
Thanks
Ammi.Hi,
SELECT objnr objid aufnr
from afih
into table t_afih.
SELECT objnr
from JEST
into table t_JEST
where stat = 'A0045'
OR stat = 'A0046'
AND inact 'X'.
SELECT objnr
from COBRB
into table t_cobrb.
SELECT arbpl werks objid objty
from crhd
INTO table it_crhd
FOR ALL ENTRIES IN it_afih
WHERE objty eq 'D'
AND gewrk = it_afih-objid.
SELECT aufnr objnr auart txjcd pspel gstrp werks aufnr
FROM caufv
INTO table t_caufv
FOR ALL ENTRIES IN it_afih
WHERE aufnr = it_afih-aufnr
And pspel = ' '
AND txjcd = ' '
ANd objnr ne it_crhd-objnr
AND auart in s_wtype
AND werks in s_plant.
AND objnr ne it_jest-objnr.
dont use NE in the select statements, it may effect performance also. Instead use if statements inside
loops.
loop at t_caufv.
read table it_chrd............
if t_caufv-objnr ne it_chrd-objnr.
read table it_jest..........
if if t_caufv-objnr ne it_jest-objnr.
(proceed further).
endif.
endif.
endloop.
hope this helps.
Reward if useful.
Regards,
Anu -
How can we write the code for opening the command prompt and closing the
how can we write the code in java for opening the command prompt and closing the cmd prompt from eclipse (cmd prompt should close when click on the turminate button in eclipse)
rakeshsikha wrote:
how can we write the code for opening the command prompt and closing theBy typing in Eclipse (which you seemingly have)? -
How can i write the trigger for Global Temporary Table
Hi Grus,
How can i write the trigger for Global Temporary Table.
I was created the GTT with trigger using the below script .
CREATE GLOBAL TEMPORARY TABLE GLOBAL_TEMP
EMP_C_NAME VARCHAR2(20 BYTE)
ON COMMIT PRESERVE ROWS;
CREATE OR REPLACE TRIGGER TRI_GLOBAL_TEMP
BEFORE DELETE OR UPDATE OR INSERT
ON GLOBAL_TEMP
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
BEGIN
INSERT INTO EMPNAME VALUES (:OLD.EMP_C_NAME);
END;
trigger was create successfully, but the wouldn't insert into to EMPNAME Table..
Please guide whether am correct or not? if not kindly give a correct syntax with example
Thanks in Advance,
Arun M MBEGIN
INSERT INTO EMPNAME VALUES (:OLD.EMP_C_NAME);
END;
you are referencing old value in insert stmt.
BEGIN
INSERT INTO EMPNAME VALUES (:new.EMP_C_NAME);
END;then run ur application it works fine...
CREATE GLOBAL TEMPORARY TABLE GLOBAL_TEMP
EMP_C_NAME VARCHAR2(20 BYTE)
ON COMMIT PRESERVE ROWS;
CREATE OR REPLACE TRIGGER TRI_GLOBAL_TEMP
BEFORE DELETE OR UPDATE OR INSERT
ON GLOBAL_TEMP
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
BEGIN
dbms_output.put_line(:OLD.EMP_C_NAME||'yahoo');
INSERT INTO EMPNAME VALUES (:new.EMP_C_NAME);
dbms_output.put_line(:OLD.EMP_C_NAME);
END;
create table EMPNAME as select * from GLOBAL_TEMP where 1=2
insert into GLOBAL_TEMP values('fgfdgd');
commit;
select * from GLOBAL_TEMP;
select * from EMPNAME;
output:
1 rows inserted
commit succeeded.
EMP_C_NAME
fgfdgd
1 rows selected
EMP_C_NAME
fgfdgd
1 rows selectedgot it Arun
Edited by: OraclePLSQL on Dec 28, 2010 6:07 PM -
How can i write the data to PIC16F819 using labview?
how can i write the data to PIC16F819 using labview?
Need help!
im using labview in gathering the datas that i need to right to the PIC, then after getting all the datas i am using another program which is ICD2 in order to write it to the PIC. Is it possible to do this task through LV? coz we are spending a lot of time transferring the data from LV to ICD2 manually and its prone to mistake as well.
any suggestion?
thanks,
PedzLabVIEW does not currently have a built-in method to communicate with
i2c, but there are other vendors that sell devices to communicate in
this manner with LabVIEW development kits. One that I know of is
from MCC... here is a link: http://www.mcc-us.com
They sell a device called iPort, and then you can buy LabVIEW VIs to go with it. I hope this is helpful to you!
john m -
How can I write the analogous code to the logic:iterate tag functionality
Hai This is Rayalu .And I am very new to the Java World. I have a doubt?.How can I write the analogous code to the<logic:iterate> tag functionality using the JSP Tag Libraries . Pleae Send me some examples .
Hi,
SELECT objnr objid aufnr
from afih
into table t_afih.
SELECT objnr
from JEST
into table t_JEST
where stat = 'A0045'
OR stat = 'A0046'
AND inact 'X'.
SELECT objnr
from COBRB
into table t_cobrb.
SELECT arbpl werks objid objty
from crhd
INTO table it_crhd
FOR ALL ENTRIES IN it_afih
WHERE objty eq 'D'
AND gewrk = it_afih-objid.
SELECT aufnr objnr auart txjcd pspel gstrp werks aufnr
FROM caufv
INTO table t_caufv
FOR ALL ENTRIES IN it_afih
WHERE aufnr = it_afih-aufnr
And pspel = ' '
AND txjcd = ' '
ANd objnr ne it_crhd-objnr
AND auart in s_wtype
AND werks in s_plant.
AND objnr ne it_jest-objnr.
dont use NE in the select statements, it may effect performance also. Instead use if statements inside
loops.
loop at t_caufv.
read table it_chrd............
if t_caufv-objnr ne it_chrd-objnr.
read table it_jest..........
if if t_caufv-objnr ne it_jest-objnr.
(proceed further).
endif.
endif.
endloop.
hope this helps.
Reward if useful.
Regards,
Anu -
How can I write the chinese characters in a web with my magic mouse?
How can I write the chinese characters in the search box with my magic mouse?
You can do it with a trackpad but I am not sure about the mouse. Take a look at his link, http://support.apple.com/kb/HT4288
-
How can i write the image in gif or jpeg format??
how can i write the image in gif or jpeg format??
thx someone else help me in another topic
-
How can i stop the Action Wizard from putting the original file into the Source folder with my changed documents?
[discussion moved to Creating, Editing & Exporting PDFs forum]
-
How do we write the sub routines in smart forms?
1) How do we write the sub routines in smart forms?
2) What is the form interface in smart forms?
3) Write down the path for writing for select queries in smart forms?
4) How do we put dynamic page break in smart forms?
5) in which system field contain the total page number of all forms in the currently processed print request in smart forms?
6) What is the name of function module used to calling smart forms?
1) What is the functionality of function module controal_form?
2) How do we print the system date in this format 15th Jan 2008 on scripts?
3) What r the various print modes available in scripts?
4) What is the tcode for text element?
5) How do we draw horizontal line in scripts?
6) How can we suppress the leading zeros for a field in scripts?
7) In which system field is used to print current no page in scripts?
Which f.m is used to reads text in sap scripts1) How do we write the sub routines in smart forms?
after opening form see global definitions
click on that there one tab called form routines inthat you can write subroutines logic.
You can call in program lines .
2) What is the form interface in smart forms?
It is an interface between program and form .
like function module we provide import,export,tables,exceptions
Based on import and export parameters form will display for us.
3) Write down the path for writing for select queries in smart forms?
On window give right click in that command->programlines
you can write all select statements.
4) How do we put dynamic page break in smart forms?
you can define break point using break-point<>. syntax.
5) in which system field contain the total page number of all forms in the currently processed print request in smart forms?
SFSY-PAGE
SFSY-JOBPAGES
6) What is the name of function module used to calling smart forms?
SSF_FUNCTION_MODULE_NAME
=================
1) What is the functionality of function module control_form?
This function module is used to insert SAPScript control commands like NEW-PAGE etc from whithin the ABAP program.
CALL FUNCTION 'CONTROL_FORM'
EXPORTING
COMMAND =
EXCEPTIONS
UNOPENED = 1
OTHERS = 3
IF SY-SUBRC NE 0.
MESSAGE ...
ENDIF.
2) How do we print the system date in this format 15th Jan 2008 on scripts?
Use SET DATE MASK to change format of date display.
3) What r the various print modes available in scripts?
4) What is the tcode for text element?
se91
5) How do we draw horizontal line in scripts?
&ULINE&
6) How can we suppress the leading zeros for a field in scripts?
&it_vbak-vbeln(Z)&
7) In which system field is used to print current no page in scripts?
&SYST-PAGE& of &SYST-FORMPAGES&
Which f.m is used to reads text in sap scripts
READ_TEXT functiomodule.
Reward points -
How can I change the tax formula in system form ?
Hi,
Usually the tax is extra-added for 5% in calcaulating.
But now I need to change the formula of tax to be embeded.
How can I change the tax formula in system form ?
Besr regard!Great!
I suppose "Speed-button" is the same as "toolbar button", right?
To all (more or less):
It confirms that I am on the right track when I bother the participants in this forum time-after-time with remarks to train themselves - or get trained - in application + customization features (+ SDK).
Of course as developers we can use the SDK for whatever purpose and try to develop additional functionality - ... that might already be there, but we just don't know about it
In addition the power of customization features (UDFs/UDTs/queries/formatted searches (also bound to fields on SAP Business One forms)...) should not be underestimated!!!
When starting development with SDK you - or the person who writes the specifications for an Add-On must IMHO be familiar with the application + the customization features + being trained with SDK to avoid unnecessary development or getting into trouble latest when the solution is shipped to a customer...
Please again note that there's a lot of eLearning available in the education area in the SMB Portal on SAP Service Marketplace.
Regards,
Frank -
How can I measure the hertz in a wave form?
How can I measure the hertz in a wave form?
As an example, this is from BBC Technical Requirements for HD material:
3.1.1 Stereo line-up tones
All stereo tracks must use EBU 1KHz tone (left ident). All tones must be sinusoidal, free of distortion and phase coherent between channels.
Digital Audio Reference level is defined as 18dB below the maximum coding value (-18dBFS) as per EBU recommended practice R68.
See also:
http://www.bbc.co.uk/guidelines/dq/pdf/tv/tv_delivery_to_network_programmes_v1.2-2011.pdf
for full document.
And for BBC Radio:
Not every Network requires tone. Check the delivery requirements with the commissioning network or click here.
Reference tone, where used, should be at -18dBFS or PPM 4 on A, B and/or M.
If submitting material with reference tone, tone and programme material must be have been monitored and measured through the same technical chain. The level of the tone must be equivalent to 0dBu and no less than 8dB below peak audio level for the programme material.
THE LEVEL OF TONE MUST HAVE A KNOWN RELATIONSHIP WITH THE LEVEL OF THE PROGRAMME MATERIAL AND THIS MUST BE STATED; for example: “Tone at 8dB below peak programme level”.
As a newcomer to digital sound (my background is camera) I confess to being somewhat confused. We are normally told to record at the highest level possible. So for voice podcasts I tend to record at about -6dB below peak for maximum volume, distributeds on MP3 files.
But I can underatand that televison and radio especially for analogue transmission) may have limited headroom, hence the requirement for -18dB peak = 0dBM.
I remember when we first rented out Digital Betacam cameras, some recordists were recording almost everything OVER -18dBM.
I suspect that until we have an all-digital world, these requiremnents will still be in place.
Many thanks to all. It's a ghreat community!
Brian Rose
Maybe you are looking for
-
DNS name lookup in clustering environment
Hi, I have 2 managed servers hosted on different IP addresse in a cluster. I have configured Cluster address in weblogic console to these 2 IP addreses seperated by a comma. If I am doing lookup for a
-
Hello. I'm having a problem with a project which was first edited with a low res proxy; The editor sent me the complete edit, and I switched the source file to the uncompressed file. They are both exactly the same duration, frame size, etc, but the p
-
I can upgrade to iphone 3gs for free but.......
Since I have the bestbuy(canada) exclange plan, I can exchange my 3g 8Gb for 16gb 3gs since I paid $200 for the 3g. They will give me a brand new 3gs only if theres a problem with my iphone 3g, unfortunately thers none but I wouldnt mind to lie for a
-
Properties Bar not active on occasion
Occasionally I can open a pdf, either through Adobe or by double clicking the file, and the properties bar will be in active (visible but gray). When this condition occurs and I attempt to modify a property the program freezes and closes with an erro
-
Books not downloaded on iBooks
Books appear dimmed on iPad after purchasing but can't be opened or deleted.How do I overcome