JSP to get the JVM
Hi,
I'm rather new to JSP / java in general. wondering if some of the experts could tell me how i could get the JVM I'm running on (JVM ID or name) from a JSP.
Thanks in advance for your time and efforts.
you can use
System.getProperty(<property_name>);
for example :
if you want to get the JVM name
you can do this
System.getProperty("java.vm.name");
Similar Messages
-
How can I get the jvm or kvm resource?
I am interested in the jvm,kvm.But I don't know very clearly the archicheture of the kvm or jvm. Where can I get the resource of kvm or jvm? Can I get a source code sample of kvm?
Do you mean source code?
The source code for the Sun jdk 1.3.1 is here...
http://java.sun.com/j2ee/download.html -
Need Help regarding the JVM for the ARM926EJS Processor
I Want to develop an application in java for the IMX.27 board which has ARM926EJS Procesor. This processor is jazelle enabled hardware.
My questiion is that how to get the JVM for this. So that i will use my Java appliaction. I am using linux OS.
Thanks in advance.Hi Narendra,
Sun actually has a VM for the ARM ... well, actually 2 VMs for the ARM. Depending on your needs, there's a solution for JavaME CLDC, JavaME CDC, or JavaSE. There's also the open source implementations for CLDC and CDC. Here's how to get more info:
JavaME: http://java.sun.com/javame/index.jsp
CLDC open source project: phoneME Feature: https://phoneme.dev.java.net/content/phoneme_platforms.html#phonemefeature
CDC open source project: phoneME Advanced: https://phoneme.dev.java.net/content/phoneme_platforms.html#phonemeadvanced
Embedded SE: http://java.sun.com/j2se/embedded/offerings.html
email inquiry to: [email protected]
Regards,
Mark -
How to get the latest filename in a specify directory in client's machine
Hi all,
I've created a web application which user need to input some text and upload a file to server, It's simple that user just need to browse the directory to select the file. submit the form to server then ........
However, after user's review and they prefer the system can upload the latest file in a directory in the cilent's computer (as all files are stored in the same directory) and upload to server after user click submit button automatically. User only input the text in the form, no need to search the picture in the computer (can save time) .
I understand that there has some security issue. but just want to know is it possible to do this?
The question I would like to ask is
Can Java (servlet / jsp) can get the latest file in a pre-defined directory in client's machine?
pls help
thanks a lot.
Kin.JSP and servlets run on the server, not the client. The client receives the output of the JSP/servlet, usually as an HTML page. Your question is: can an HTML page read a directory on the user's computer. The answer is obvious: no, it can't.
You may be able to work around this problem with some kind of plug-in, but this would likely create more inconvenience for the user, not less. -
How to get the file content after uploading file
Hello everyone!
I have a question. Anyone can provide an example code by jsp that getting the uploaded file content after user uploading a file?
Your help is highly appreciated!!!My experience is you need to do it twice: first read it to a StringBuffer and readline. Then write the file to server. See the code below
MultipartParser parser = new MultipartParser(request, 10000000);
Part part = null;
FilePart filePart = null;
File uploadDir = new File("/Uploads/");
if (!uploadDir.exists()) {
uploadDir.mkdir();
while(true){
part = parser.readNextPart();
if(part == null)
break;
if(part instanceof FilePart){
filePart = (FilePart)part;
filename = filePart.getFilePath();
//You can do one of the following option. Here is read line to a buffer and display to screen
//if (filename != null) {
//Do not store the file to server machine.
//long size = filePart.writeTo(uploadDir);
// System.out.println("The number of bytes written is "+size);
reader = new BufferedReader(new InputStreamReader(filePart.getInputStream()));
String newline=reader.readLine();
if(newline!=null) {
reconcileContent.append("<table border=\"1\"><tr><th>Destination ID</th><th>File ID</th><th>Rept Date</th><th>As of Date</th><th -
JSP compiler reading the web.xml file?
Hi,
I am trying to use the weblogic JSP compiler (weblogic.jspc) to
pre-compile some JSP that use custom tags. Does the compiler
read the web.xml file if there is one? In particular the taglib
elements in that file so that the compiler understands the
<%@ taglib ... %> directive.
In the JSP I try to compile I use this statement to declare a taglib:
<%@ taglib uri="xyz/xyz-taglib" prefix="xyz" %>
and in my web.xml I have:
<taglib>
<taglib-uri>xyz/xyz-taglib</taglib-uri>
<taglib-location>/WEB-INF/tlds/xyz.tld</taglib-location>
</taglib>
When I try to compile the JSP I get the following error:
Could not parse embedded JSP code: weblogic.utils.ParsingException: nested
IOException: java.io.IOException: cannot resolve 'xyz/xyz-taglib' into a
valid tag library.
Any ideas how I can resolve this?
In advance thank you for any help.
Florian
open it in a text editor and modify it.
% -
How to get the Clinet IP address in PAR files
Hi Frndzz...
My requirement is to get the log on details of portal users, here i need the User ID n client IP address .
Am trying to get these details from masthead iview PAR file, and this details am passing to a java(custom) class which can create a log_Test.txt file with these details.
User ID am gettiing using UME API like this in masthead PAR file
public void GetWelcomeID(IPortalComponentRequest request, String welcomeClause)
IUserContext userContext = request.getUser();
String usr =userContext.getLogonUid();
But am unable to get the Client IP
In normal JSP will get the client IP like this request.getRemoteAddress()
So in par file i used the IPORTALCOMPONET request to get the client IP, i thought IPORTALCOMPONET request is equalent to HTTPSERVLETRequest request interface.
Any one suggest me that how we can get the Client IP in PAR files .
Thanks in Advance
Regards
RajeshHi,
This is a very interesting question, i searched many time before to get an answer for this on sdn. I havn't found solution. As i know, It is very diffcult to find the ip address from request object.
The main reason is, before reaching the servlet class the request is by pass through other node like dispatcher/central node. If you try to fetch request objects ip from server class i think it will only return you the dispatcher server ip only.
There is a solution for this problem.. if you are able to fetch the ip using some client side scripting and pass it to the servelet as parameter, i hopes you can acheive this.
I will try this and let u know the result.
Others please share your thoughts on this topic.
Regards
Baby -
How can I get the client IP address correctly?
Hi,
I am having a problem with getting the client ip address correctly using jsp. I am currently using the method request.getRemoteAddr() (JSP)to get the remote client IP. This method works fine with intranet addresses.
However, when I am using a dial-up connection through a ISP (internet service provider), it could not detect the actual IP that is assigned to my client PC, but instead got another IP address.
Could anyone advise me on that? And could anyone advise me on how to obtain the correct client ip address correctly using any of the java technologies?
Thanks,
Damien>
I don't believe so. You can't establish aconnection
over the internet using a private IP. As far as I
know most, if not all routers, block them so itwon't
even move over the backbone.Well with port-mapping it is definately possible to
allow an external ip to "connect" to an internal ip, i
have done this very thing myself...Not the same.
You are addressing the external server with a public IP address. That is then translated into the internal connection.
That is not the same as using a private IP on the internet.
As I said, the backbone will not let a private IP through.
>
>
Yes, but my point is that at any given time, in the
world, many boxes might have one address. Even ifit
is a private IP is it still that IP for aparticular
box. So if you use java to get its IP that is theIP
that it gets. And that IP is useless for anything
unless that IP is meaningful for the othercomputer.
But all ips must be unique in a designated "internet"
be it an "intranet" or whatever, there cannot be a
situation where two identical ips in the same
"internet", such that an ip that is achieved from a
page-hit is valid and meangingful in order to send the
data it is requesting back to it, or find out more
about that computer, or log and report it if it is
doing something illegal; i don't think its that
meangingless is it?Yes it is. You can't use an IP to uniquely identify a box, and that is the sole criteria, when there might be two boxes with the same IP.
When you use java on a client box to get the IP of the box, it doesn't necessarily return an IP that it meaningful to the anyone outside the lan on which the box lives.
Because of this internet systems must do one of the following:
-Do not use the IP as an identifier.
-Require that the client has a public IP. This is often static. At least some security systems use this to validate users. -
Where do I get the oracle.jsp.dbutil library
Where do I get the oracle.jsp.dbutil library.
ThanksBernhard (guest) wrote:
: thanx for the advice. I think the links you posted will be
: helpful in the future.
: I found the source of my troubles on the SUSE homepage (ver 6.1
: does not use glibc 2.1).
: So now I needto find out how to upgrade to glibc 2.1
Upgrading to SuSe 6.2 would probably do the trick. Upgrade is
really smooth, and will take approximately 1h. I was able
to run oracle 8i client install on my PC and it works (32M,
160MHZ pentium) quite satisfactory. On my server machine
(450MHZ, 128MB) I'm running RH 6.0 and it also works fine.
On SuSe, I removed the "Kaffee" JVM installed by default and
downloaded JRE 1.1.7 from www.blackdown.org. I haven't tried
the "kaffe" engine but Oracle documentation requires blackdown.
Michael, if you read this, have you tried installing with the
default JVM engine delivered with SuSe 6.2?
As long as your operating system name doesn't start with "MS"
you should be OK.
: But first I will buy me a book about LINUX administration and
: hope to find the time reading it.
: Colin. (guest) wrote:
: : Bernhard (guest) wrote
: : : But anyway: This is my first try to install anything on
: LINUX.
: : : If anybody has some good advise for a rookie re.
: installation
: : : of ORACLE SERVER 8.15 on Linux I would be very thankful.
: : Try these links, there's lots of good tips to be found (and
: : thanks to the authors of these sites).
: : => A SuSE developers home page for Oracle.
: : www.suse.de/~mha/oracle/
: : => Install Guide for Redhat.
: : jordan.fortwayne.com/oracle/
: : => Oracle tips & scripts
: : www.akadia.com/html/dod-frame.html
: : amoeba.sagemediagroup.com/oracle_linux_howto/
: : www.orafaq.org/
: : www.oracle-dba.com/
: : www.kevinloney.com/
: : www.bf.rmit.edu.au/~orafaq/contents.html
: : www.lazydba.com/
: : www.dbasupport.com/
: : www.dbspecialists.com/
: : altern.org/place4oracle/oracle_contents.html
: : www.dbdomain.com
null -
Problem Using HTTP Dispatcher -- Could Not able to get the data in JSP
Hi, I am using HTTP Dispatcher to send my events to particular URL which is a JSP page. I am trying to populate the received event through URL and populate to a oracle data base. But could not able to get the data in Oracle database.
Code is :
<h1>JSP Page</h1>
<%
long type = 0;
String tagId = null;
String timeStr = "0";
String deviceName = "";
// Get Event Parameters
// Available Parameters: id, siteName, deviceName, data, time, type, subtype, sourceName, correlationId
try
type = Long.parseLong(request.getParameter("type")); // Get type
tagId = request.getParameter("id"); // Get tagId
timeStr = request.getParameter("time"); // Get time
deviceName = request.getParameter("deviceName");
catch (Exception e)
out.println( "Error: "+e.getMessage() );
// Write into DB.
try {
if ((tagId == null) || (type != 200) ){
// Do Nothing
//return;
} else {
OracleDataSource ods = new OracleDataSource();
String URL = "jdbc:oracle:thin:@//3.235.173.16:1525/vislocal";
ods.setURL(URL);
ods.setUser("cus");
ods.setPassword("cus");
Connection myConn = ods.getConnection();
Statement stmt = myConn.createStatement();
String selectQuery =
"SELECT MAX(rfid_raw_reads_id) as max_id FROM "+
"cus.rfid_raw_reads ";
ResultSet rs = stmt.executeQuery(selectQuery);
String maxId = "1";
if (rs.next()) {
maxId = rs.getString(1);
String selectMaxTagIDQuery =
"SELECT MAX(rfid_raw_reads_id) as max_id FROM "+
"cus.rfid_raw_reads WHERE tag_id = '" + tagId + "'" ;
stmt = myConn.createStatement();
rs = stmt.executeQuery(selectMaxTagIDQuery);
String maxTagId = "1";
if (rs.next()) {
maxTagId = rs.getString(1);
long primaryKey = 1;
long tagKey = 1;
try {
primaryKey = Long.parseLong(maxId) + 1;
tagKey = Long.parseLong(maxTagId) + 1;
} catch (Exception e) {
long currentTime = System.currentTimeMillis();
long updateKey = (tagKey - 1);
String updateQuery = " UPDATE cus.rfid_raw_reads SET read_end_time = " + currentTime + " WHERE rfid_raw_reads_id = " + updateKey;
Statement updateStmt = myConn.createStatement();
updateStmt.execute(updateQuery);
String query =
"INSERT INTO cus.rfid_raw_reads (rfid_raw_reads_id, tag_id,device_name,read_start_time) VALUES ("+ primaryKey + ",'" + tagId + "'," + deviceName + "'," + System.currentTimeMillis() + " )" ;
Statement insertStmt = myConn.createStatement();
insertStmt.execute(query);
myConn.commit();
myConn.close();
} catch (Exception e) {
%>
<p>For browser debug:
<%
out.println( "Type="+type+" ID="+tagId +" time="+timeStr );
%>
Kindly suggest where is the problem...
Thanks and regards
Mohammad Nasim AkhtarHI Prabhat,
Thanx for your reply, I worked out and able to receive the data in oracle database, Actually there was some problem in insert Query. Now I have tested the same... and able to edit the same in the Database.....
But I am facing a new problem, Http Dispatcher in SES console is displaying all the Events generated as well as event in Que but there is no events in the Event Send. I guess it is not able to send the events.....?????
Event statical is showing like this
Events Received: 0 (0.00/sec)
Events Generated: 311 (0.19/sec)
Events Sent: 2 (0.19/sec)
Queued Events: 309 (0.19/sec)
Kindly suggest where is the problem, Is it a JSP problem or OSES end problem.....
Thanks and regards
Nasim -
How to get the values of an Array using JSP Tags
Hey guys,
I need some help. I've splited a String using
fn:split(String, delim) where String = "1,2,3,4" and delim is ,
This method returns an Array of splited Strings. how do i get the values from this array using jsp tags. I don't wanna put java code to achive that.
Any help would be highly appreciated
ThanksThe JSTL forEach tag.
In fact if all you want to do is iterate over the comma separated list, the forEach tag supports that without having to use the split function.
<c:set var="list" value="1,2,3,4"/>
<c:forEach var="num" items="${list}">
<c:out value="${num}"/>
</c:forEach>The c:forTokens method will let you do this with delimiters other than a comma, but the forEach tag works well just with the comma-delimited string. -
How to get the value from a database without submitting a jsp page
I have a jsp which has a text box depending on the value entered I want to get the value from a database for other two fields with out submitting jsp page. I am using struts.
Thanks For any assistance provided.Alright,here is an example for you for the first case.
Present.jsp:
============
<html:html>
<head>
<title><html:message key="page.title"/></title>
</head>
<body>
<html:form action="ChangeEvent.do">
<html:hidden property="method"/>
<!-- Submitting the Form onKeyUp of EmpId field and trying to save the
state of the Form in the scope of session -->
Emp Id:<html:text property="empId" size="5" onkeyup="if(true){this.form.elements[0].value='populateDetails';this.form.submit();}"/>
Emp Name:<html:text property="empName" size="10" />
Email Address:<html:text property="email" size="10" />
<html:submit>Submit</html:submit>
</html:form>
</body>
</html:html>struts-config.xml:
==================
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<!-- Form bean which stores the properties of all the Form elements -->
<form-beans>
<form-bean name="employeeFormBean" type="org.apache.struts.action.DynaActionForm">
<form-property name="empId" type="java.lang.String"/>
<form-property name="empName" type="java.lang.String"/>
<form-property name="email" type="java.lang.String" />
</form-bean>
</form-bean>
<action-mappings>
<action path="/ChangeEvent" type="Test.GetChangeAction" name="employeeFormBean" scope="request" parameter="method">
<!-- On successful call of DB the Page has to be forwarded to the same page again by
uploading updated form bean values. -->
<forward name="success" path="/Present.jsp"></forward>
<forward name="failed" path="/error.jsp"></forward>
</action>
</action-mappings>
</struts-config>GetChangeAction.java:
=====================
public class GetChangeAction extends DispatchAction{
public ActionForward populateDetails(ActionMapping mapping,ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
DynaActionForm dForm = (DynaActionForm)form;
String empId = dForm.get("empId");
// calling Model / Db and then getting back Employee Details
EmployeeBean eb = ModelUtils.getDetails(empId);
// Updating form bean by updating values from the Model
dForm.set("empName".eb.getEmpName());
dForm.set("email".eb.getEmail());
return mapping.findForward("success");
}well to me this should work regardless to any browser but we need to make sure we put in our logic properly. -
Help needed urgently to get the values from the jsp page.
hi,
I am badly stuck into this problem.Please help me and find a solution.
I am using ms-access and jsp.
my database structure is as given below:
m_emp_no | from_date | to_date | approver| status |
1002 | 22/9/2008 | 23/9/2008|1003 |pending
1004 | 29/9/2008 | 30/9/2008|1003 |pending
2044 | 15/9/2008 | 16/9/2008|3076 |pending
now this is exactly a leave apply scenario where a page is displayed and the user has to fill in the details to apply leave.then the approver has to approve that leaves so even, he should get the details in his account.
for example here 1003 has to approve leaves for 1002 & 1004.i am able to fetch data from database for the particular approver here is the coding:
<html>
<body>
<h2 align="center"><u><b><span style="background-color: #FFFFFF"><font color="#C0C0C0" face="Comic Sans MS">Leave
Approval Requests</font></span></b></u></h2>
<form method="POST" name="f1" action="update.jsp">
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:employee_details");
PreparedStatement p=null;
p=con.prepareStatement("select * from emp_leave_application where approver='"+username+"'");
ResultSet r=p.executeQuery();
while(r.next())
%> <table border="1" width="100%" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
<tr>
<td width="100%" bgcolor="#999966"><b><u><%=r.getString(2)%></u></b></td>
</tr>
</table>
<table border="1" width="100%" height="171" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
<tr>
<td width="100%" height="165" valign="top">
<p align="left"><b>User ID</b> :
<input type="text" name="id" value="<%=r.getString(1)%>" size="4
<b>status</b>:<%=r.getString(5)%</p>
<p><b>Leave From</b> : <%=r.getString(2)%></p>
<p><b>Leave From</b> : <%=r.getString(3)%></p>
<p><b>Approve</b> : <select size="1" name="approved">
<option value="Approved">Approved</option>
<option value="Cancelled">Cancelled</option> </select></p>
<%
con.close();
%>
<table border="1" width="100%" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
<tr>
<td width="100%" bgcolor="#999966">
<p align="center"><input type="reset" value="Clear" name="B1">
<input type="submit" value="Submit" name="B2"></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>{code}
this will display both the rows but when i try to retrieve the values into update.jsp using the code given below it gives me only one value which is the first 1002.
{code}approved=(String)request.getParameter("approved");
id=(String)request.getParameter("id");{code}
but i need both the values to be inserted into the update.jsp only then the approver will be able to approve the leaves individually with respect to the m_emp_no.
please help me out.
thanks in advance.My comments below are all between (((((( and ))))))
<html>
<body>
<h2 align="center"><u><b><span style="background-color: #FFFFFF"><font color="#C0C0C0" face="Comic Sans MS">Leave
Approval Requests</font></span></b></u></h2>
<form method="POST" name="f1" action="update.jsp">
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:employee_details");
PreparedStatement p=null;
p=con.prepareStatement("select * from emp_leave_application where approver='"+username+"'");
ResultSet r=p.executeQuery();
while(r.next())
%> <table border="1" width="100%" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
<tr>
<td width="100%" bgcolor="#999966"><b><u><%=r.getString(2)%></u></b></td>
</tr>
</table>
<table border="1" width="100%" height="171" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
<tr>
<td width="100%" height="165" valign="top">
<p align="left"><b>User ID</b> :
<input type="text" name="id" value="<%=r.getString(1)%>" size="4
((((((( in the statement above, name="id" should be changed to something like name="id"<%=ii%>
Where ii is a counter that tells you how many times you have gone through the loop so far.
The reason for this is that each textfield you generate must have a unique name rather than all have the same name
such as 'id'. This change will give them names such as id0, id1, id2. Then when you submit the page, you can uniquely
identify each input textfield.))))))
<b>status</b>:<%=r.getString(5)%</p>
<p><b>Leave From</b> : <%=r.getString(2)%></p>
<p><b>Leave From</b> : <%=r.getString(3)%></p>
<p><b>Approve</b> : <select size="1" name="approved">
(((( the above select also has to have a unique name for each time through the loop. Change it to name="approved"<%=ii%>
<option value="Approved">Approved</option>
<option value="Cancelled">Cancelled</option> </select></p>
<%
con.close();
%>
<table border="1" width="100%" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
<tr>
<td width="100%" bgcolor="#999966">
<p align="center"><input type="reset" value="Clear" name="B1">
<input type="submit" value="Submit" name="B2"></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>
(((((((note you would be better off long term to put your business logic in a servlet and dispatch to the JSP page which will only have the responsiblity to display the data.
Also, connection pooling is better than the above. -
Unable to get the value from the jsp page.
Hi,
I have developed a JSP, having two split fields seperated by some buttons..The sample code for the same is like this..
(Only the required portion is included)
<script>
function reloadPageOK() {
document.product.method="post"
document.product.action="./TheSamePage.jsp?status=OK"
document.product.submit()
function moveValue(from,to) {
if(from.selectedIndex>=0) {
var text=from[from.selectedIndex].text
var length= to.length
to[length]=new Option(text,from.value,false,false)
from.remove(from.selectedIndex)
function moveAll(from,to) {
if(from.length>0) {
var menutext="";
var i;
var len=from.length
for(i=0;i<len;i++) {
from.selectedIndex=0
menutext=from[0].text
var length= to.length
to[length]=new Option(menutext,from.value,false,false)
from.remove(from.selectedIndex)
</script>
<table width="100%" border="0" cellspacing="0" >
<tr class="contactDetail">
<td width="10%" class="table_grid1" rowspan="4">
<div class="contactDetail">
<select name="lstProviderLeft" size="7" style="width:111">
<option> PDP</option>
<option> Net</option>
<option> Par</option>
<option> Non-Par</option>
</select>
</div>
</td>
<td width="20%" bgcolor="#FFFFFF" class="contactDetail">
<input type="button" value=" > " name="btnLtrProvider" class="button" onclick="moveValue(lstProviderLeft,lstProviderRight)">
</td>
<td width="10%" bgcolor="#FFFFFF" rowspan="4" class="contactDetail"> <font face="Arial, Verdana, Helvetica, sans-serif" size="2" >
<select name="lstProviderRight" size="7" style="width:111"></select>
</font></td>
<tr>
<td width="8%" class="contactDetail">
<input type="button" value=" >> " name="btnLtrAllProvider" class="button" onclick="moveAll(lstProviderLeft,lstProviderRight)" >
</td>
</tr>
<tr>
<td width="8%" class="contactDetail">
<input type="button" name="btnRtlProvider" value=" < " class="button" onclick="moveValue(lstProviderRight,lstProviderLeft)" >
</td>
</tr>
<tr>
<td width="8%" class="contactDetail" height="22">
<input type="button" name="btnRtlAllProvider" value=" << " class="button" onclick="moveAll(lstProviderRight,lstProviderLeft)" >
</td>
</tr>
</table>
<p align = "center"> <input type="button" value=" OK " onclick="reloadPageOK()">
The page is working fine. That is we can move the values in the left field to right as single or group.After submitting I need to get the values in the left & right fields respectively.
I have used the method
request.getParameterValues("lstProviderLeft");
and pointed this to an array of strings,but it returns 'null' .
How can I solve the above problem....Post your comments on this issue
Thanking uprobably the request.getParmeterValues will not work in this case as the name of the 2 select boxes are different....
You can do this utility by using Javascript....concantinate the values of the 2 select boxes and put the concantinated strings (with a delimiter) in two hidden fields and capture the same fields in the target JSP/Servlet.
I have modified ur code...have a look...
--------------------Start-----------------
<html>
<head></head>
<title></title>
<body>
<script language="Javascript">
function reloadPageOK()
document.product.method="post" ;
document.product.action="./TheSamePage.jsp?status=OK" ;
document.product.submit();
function moveValue(from,to)
if(from.selectedIndex>=0)
var text=from[from.selectedIndex].text;
var length= to.length ;
to[length]=new Option(text,from.value,false,false);
from.remove(from.selectedIndex);
function moveAll(from,to)
if(from.length>0)
var menutext="";
var i;
var len=from.length;
for(i=0;i<len;i++)
from.selectedIndex=0;
menutext=from[0].text ;
var length= to.length;
to[length]=new Option(menutext,from.value,false,false) ;
from.remove(from.selectedIndex);
function fnSubmitPage(from,to)
var strfromSelBox = "";
var strtoSelBox = "";
if(from.length>0)
var len=from.length;
for(var i=0;i<len;i++)
strfromSelBox=strfromSelBox+":"+from.text ;
if(to.length>0)
var len=to.length;
for(var i=0;i<len;i++)
strtoSelBox=strfromSelBox+":"+to[i].text ;
document.product.hdFromValue.value=strfromSelBox;
document.product.hdFromValue.value=strtoSelBox;
document.product.method="post" ;
document.product.action="" ;//Name of the JSP or servlet wherever u want to direct to....
document.product.submit();
</script>
<form name="product">
<input type="hidden" name="hdFromValue">
<input type="hidden" name="hdToValue">
<table width="100%" border="0" cellspacing="0" >
<tr class="contactDetail">
<td width="10%" class="table_grid1" rowspan="4">
<div class="contactDetail">
<select name="lstProviderLeft" size="7" style="width:111">
<option> PDP</option>
<option> Net</option>
<option> Par</option>
<option> Non-Par</option>
</select>
</div>
</td>
<td width="20%" bgcolor="#FFFFFF" class="contactDetail">
<input type="button" value=" > " name="btnLtrProvider" class="button" onclick="moveValue(lstProviderLeft,lstProviderRight)">
</td>
<td width="10%" bgcolor="#FFFFFF" rowspan="4" class="contactDetail">
<font face="Arial, Verdana, Helvetica, sans-serif" size="2" >
<select name="lstProviderRight" size="7" style="width:111">
</select>
</font>
</td>
<tr>
<td width="8%" class="contactDetail">
<input type="button" value=" >> " name="btnLtrAllProvider" class="button" onclick="moveAll(lstProviderLeft,lstProviderRight)" >
</td>
</tr>
<tr>
<td width="8%" class="contactDetail">
<input type="button" name="btnRtlProvider" value=" < " class="button" onclick="moveValue(lstProviderRight,lstProviderLeft)" >
</td>
</tr>
<tr>
<td width="8%" class="contactDetail" height="22">
<input type="button" name="btnRtlAllProvider" value=" << " class="button" onclick="moveAll(lstProviderRight,lstProviderLeft)" >
</td>
</tr>
</table>
<input type="button" value=" OK " onclick="reloadPageOK()">
<input type="button" value=" Submit " onclick="fnSubmitPage(lstProviderRight,lstProviderLeft)">
</form>
</body>
</html>
--------------------Finish---------------
Hope this helps...
Thanks -
How to get the values retained on clicking the back button in jsp page
Hi All,
I had two jsp's search and results. In the search page when i enter some values in the text fields, the rsults will be displayed for that search criteria. I had a back button in the results page. When i click on this back button i will get back to my search page. I am using the following code for this back button.
<INPUT TYPE="button" VALUE='Back' onClick="javascript:history.go(-1)" class="button">
Now the problem is when i get back to search page using this back button, i am not able to get the values in the search page which i entered, i am getting all blank values. What should i change to get these values back in the search page. Should i maintain any sessions for this?You have no control at all over the back button process. To the server, it's indistinguishable from the user simply tying the URL of your search page. So, you need to store this data server side*.
When your search page is submitted and processed, store the values you received for each of the fields into the user's session. Then, when the search page is generated, check the session for these values, and for any values that are not null, put their values into the html as the default values for the textboxes and controls you are using. This lets you handle the whole matter on the server's side.
*barring convoluted, unportable, black-magic javascript trickery which you should definitely avoid
Maybe you are looking for
-
Disk Repair Utility can't fix problem - help needed.
I have an external drive that I have been using with Time Machine. Last night I closed up the MBP and waited for the LED to start pulsing, then I unplugged the drive and packed stuff up. When I got home, I plugged the drive back in and opened the cov
-
HT5460 What is the difference between an OSX upgrade and an OSX Combo upgrade?
That's my question, right there in the subject line. Thanks! Andy
-
Using Build to animate? Presenting statistical (=large) tables
Hi there, I am using Keynote to present the results of statistical analyses. Most of the times, this results in large tables which aren't quite as audience-friendly as I would like them to be. So, I use an object (circle of square) to highlight the p
-
Is the 3.5 headset jack for handsfree & headphones
Samsung Galaxy Note II - Sorry, but here is a really clueless question. Is the 3.5 headset jack used for both hands-free connections and earphones for MP3? Thanks, Ed
-
Multiple synchronous invokations to same partnerLink
I have a problem with BPEL Designer 10.1.2.0.0 (Build 050923.1500) with Patches 1,2,3. I have created a BPEL process which calls a synchronous partnerLink, does some work and then calls it again. There seems to be an issue in that the reply data