Set VM parameters from an applet
Hi all,
When I run an applet I need to start the VM with this parameter:
-Djava.rmi.server.hostname=localhost
How can I set this parameter from an applet to correctly start the VM?!?!?
Thanks in advance!!
Hi all,
When I run an applet I need to start the VM with this
parameter:
-Djava.rmi.server.hostname=localhost
How can I set this parameter from an applet to
correctly start the VM?!?!?
Thanks in advance!!You can't do it from the applet, since the vm is already started when you execute the applet. But I think you can do this after your applet has started.
System.setProperty("java.rmi.server.hostname", "localhost");I'm not sure if an applet is allowed to do that (It can throw an security exception), but you could give it a try.
/Kaj
Similar Messages
-
Passing input parameters from an applet to a JSP page
Hello all,
Yes, its one of these questions which I have tried to find a solution from the already large number of postings but with no luck. I'm still a novice to Java/JSP so bear with me.
Consider this scenario.
1. An applet which has two input boxes (say First name and surname). 2. These parameters will be passed to a JSP page (so the applet will call a JSP page).
3. The JSP will have have the necessary logic (or actually a JavaBean will) to connect to a database and add a new record with these parameters (first name and surname).
I also need to consider editing/updating the record in the database. So a JSP page will connect to the database, retrieving the required record from the database and then display the parameters back in an applet in two input boxes (first name and surname) to be edited and saved again.
I have been able to develop a similar application using simple HTML forms to add and update records in a database so I'm not worried about the database connectivity simply the issue of passing parameters from the applet to the JSP page and vice versa (for edit/update).
Once i've managed to do this with input boxes, I can experiment with the other input types radios, checkboxes, select etc.
Many thanks in advance,
Assadcreate an URL object with u'r specified link of the java class and send the parameters..write trhis action in any buttonclick event in u'r applet.
-
Passing parameters from an applet to a URL
I need to pass information from an applet to an html page or JSP page, is this possible? Thanks.
Yes you can!
The following code might works (with some modifications ;)):
AppletContext context = this.getAppletContext();
URL url = new URL("http://host:port/path?parameter=value");
context.showDocument(url, "windowName");In addiction, consider java.net.URLEncoder.encode() method to encode properly your parameters.
Regards
Paolo -
I need set render parameters from event. From backing file cant find how set render paramters.
Hello,
I assume you are using JSR168 portlets and trying to set the render parameters when you receive an event? If so, you can't do that from the backing file; you will need to handle the event in your portlet instead of a backing file. For example, the following code would go in your portlet's java source:
import javax.portlet.ActionResponse;
import javax.portlet.ActionRequest;
import com.bea.netuix.events.Event;
public class JavaPortlet extends GenericPortlet
// This method will receive the event. It can have any name but must
// have this signature
public void handleEvent(ActionRequest request, ActionResponse response,
Event event)
// Event handling code goes here
// To set a render parameter, make calls like this:
response.setRenderParameter("paramName", "paramValue");
Then, in your .portlet file instead of a tag for "invokeBackingFileMethod" use the tag "invokeJavaPortletMethod" and specify the name of the method to call, just like the "invokeBackingFileMethod" did.
Kevin -
[WPF] AutoCompleteBox: set parameters from code behind
Hi,
I'm using AutoCompleteBox from Codeplex.com
I would set some parameters from code behind...
In XAML, I defined namespace:
xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"
After using AutoCompleteBox:
<toolkit:AutoCompleteBox
x:Name="myAutoComplete"
ItemsSource="{Binding Source={StaticResource DomainDataViewModel}, Path=SampleProperties, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
SelectedItem="{Binding Name}"
ValueMemberPath="Name"
ItemTemplate="{StaticResource PropertyBoxItemTemplate}"
MouseLeave="PropertyAutoCompleteBox_MouseLeave"
>
</toolkit:AutoCompleteBox>
If I would set any parameter from code behind, in my.xaml.cs, I not found myAutoComplete, why?
Thanks.>>I inserted the AutoCompleteBox as DataGridTemplateColumn.CellEditingTemplate.
Then you cannot access it directly from the code-behind as I told you.
>>I would apply a FilterCustom and a ItemFilter.
You could handle the Loaded event for the AutoCompleteBox and set any of its properties in there:
<toolkit:AutoCompleteBox
x:Name="myAutoComplete"
Loaded="myAutoComplete_Loaded"
ItemsSource="{Binding Source={StaticResource DomainDataViewModel}, Path=SampleProperties, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
SelectedItem="{Binding Name}"
ValueMemberPath="Name"
ItemTemplate="{StaticResource PropertyBoxItemTemplate}"
MouseLeave="PropertyAutoCompleteBox_MouseLeave"
>
</toolkit:AutoCompleteBox>
private void myAutoComplete_Loaded(object sender, RoutedEventArgs e)
AutoCompleteBox myAutoComplete = sender as AutoCompleteBox;
//set properties or do whatever here...
myAutoComplete.ValueMemberPath = "Name";
dynamic dataObject = myAutoComplete.DataContext;
//access any properies of the data object in the DataGrid...
How to do filtering is a completely other question that should be asked in a new thread though. It has nothing to do with your original question.
Please remember to mark helpful posts as answer to close your threads and then start a new thread if you have a new question. Please don't ask several questions in the same thread. -
How to create list of string from set of parameters?
Hey,
I have query methods who gets set of parameters for example:
getUser(String userName, int userAge)I use in int because this field is not null!!!
I want to create a general auditing method - the auditing method get list of query param names and query param values, so i need to create a generic method that get set of valus (can be from any type) and return List<String>.
Array.asList will not work because i have primitive types (like int)
Thank youI wrote a helper for this.
I dont know if there is supported helper in java.
public static List<String> getStringList(Object... arguments)
List<String> list = new ArrayList<String>();
for (Object object : arguments)
if (object == null)
list.add("NULL");
else
list.add(object.toString());
return list;
} -
Post parameters to a JSP from an applet
Hello,
Is there a way to send a post request to a JSP page from an applet ? Here is the scenario I am looking for :
In Test.jsp, I invoke an applet. The applet should then do a POST request to the JSP. Currently, I am able to send a JSP request by appending parameters to the query string as
getAppletContext().showDocument(new URL(getDocumentBase(),"Test.jsp?querystring")); in the applet. But this will be showing the parameters in the URL. I would like to have the parameters sent as "POST". I tried doing something like
String data = "All URL encoded parameter names and values";
URL postURL = new URL("Test.jsp");
conn = (HttpURLConnection)postURL.openConnection();
conn.setRequestMethod("POST");
conn.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(data);
wr.flush();
wr.close();
But how do I pass the control back to the JSP ? Any thoughts ?Thanks for all your responses. I posted the request and still couldn't get it working. Here is my code
osDetection.jsp:
<%@ page contentType="text/html; charset=UTF-8" %>
<% // Get all the request parameters
String userOSVersion = request.getParameter("osVersion") == null ? "" : request.getParameter("osVersion");
String detect = request.getParameter("detect") == null ? "" : request.getParameter("detect");
%>
<% if(detect.equals("")) { %>
<span>detect os version</span>
<% } %>
<% if("os".equals(detect)) { %>
<div align="center">
<object width="250" height="75">
<param name="type" value="application/x-java-applet" />
<param name="code" value="Detection.class" />
<comment>
<embed type="application/x-java-applet" code="Detection.class" width="1" height="2" />
<noembed>No OS detected</noembed>
</comment>
</object>
</div>
<% } %>
OS Version: <%=userOSVersion%>
Detect: <%=detect%>
Detection.java
import java.applet.*;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Detection extends Applet {
public void init() {
HttpURLConnection conn = null;
try {
String data = "osVersion=" + URLEncoder.encode(System.getProperty("os.version"),"UTF-8");
URL postURL = new URL("http://localhost:8080/detection/osDetection.jsp");
System.out.println("posting to the url :");
conn = (HttpURLConnection)postURL.openConnection();
conn.setRequestMethod("POST");
conn.setDoOutput(true);
System.out.println("connection open");
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(data);
wr.flush();
wr.close();
// Get the response code
int code = conn.getResponseCode();
System.out.println("Response code of the object is "+code);
if (code==200) {
System.out.println("OK");
// Get the response
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
while ((line = rd.readLine()) != null) {
System.out.println(line);
rd.close();
conn.disconnect();
} catch(Exception ex) {
System.out.println("Error:" + ex.getMessage());
Am I missing something here ? I see the response being written to the Java console but how do I transfer the control back to JSP to do further processing in the JSP ?
Thanks much in advance. -
How to set/get URL-parameters from ORACLE -tag?
How do I set/get parameters in a URL, using the <ORACLE>-tag?
We are trying to create a UI Template containing a dynamic
stylesheet selection dialogue on top of every page. The question
we are facing now is how to pass parameters (in our case,
stylesheet settings) between different pages.
Any ideas/comments are appreciated!How do I set/get parameters in a URL, using the <ORACLE>-tag?
We are trying to create a UI Template containing a dynamic
stylesheet selection dialogue on top of every page. The question
we are facing now is how to pass parameters (in our case,
stylesheet settings) between different pages.
Any ideas/comments are appreciated! -
Help with passing parameters from a servlet to an applet
dear all
i m working on a application which will check weather a file is present in a server (webserver) if it is present then it will take the file name and put it into a drop down list and there is a button on click of which i m taking the call to an applet and then on that i need the file name if it is there then i use it to draw a graph
i m struck on how to take parameter from Servlet -> Applet
thanks
Nakulhi,
I understood your question,The context "servlet" cannot communicate to
an applet becoz applet runs at clients browswer, rather you can communicate from an applet to servlet(HTTPURLCONNECTION class).
Well coming to the problem, this is how i have understood your problem,
basically uou get the list of files from the server using normal servelt programing and you will display in an html LIst box and then click the button to view the graph or chart ,
then you just want to pass the filename which is there in the listbox to an applet and applet will display some image.
As we know all that using <PARAM NAME=XX VALUE=YY> WE CAN GET THE VALUE IN APPLET BY USING GETPARAMTER() METHOD. and Im very sure that you are not asking that question. your question is like " both the applets and
the listboxes will be loaded at once and when he selects one of the file from the list box then without refreshing the page , how to display the graph.
Im i right?
If so i guess you have to use javascript to do that stuff, and i think its like gave an id for the tag shown <applet id="yes">
then in the javascript , you can call the Java applet methods (I have never tried before but seen some demos(i dont have that links- google it for inf))
but i can give clue like.. trying the <PARAM VALUE=""> IF POSSIBLE
CHAING THE HTML CONTENT IS POSSIBLE IN IE which is again through javascript by calling yes.innerHTML="<PARAM><PARAM><PARAM><PARAM>..."
Im sure that you can call Java methods from javascript but i never tried and even you can pass an arguments to it.. Let me check out like
becoz even im interested to know abt it
bye
with Regars
Lokesh T.C -
Calling a WebService from Java Applet
Hi all,
In my application I have 3 projects:
1. server - for all the business logic.
2. view - for web app.
3. swing - for applet.
In the view project I wrote a WS, and I want to call it from my applet. So I created a WS using the Jdev (10.1.3.2) wizard in the view project (I tested it and it worked fine), and in the swing project I created a proxy for this WS, tested it and it worked fine. Then I created a JAR containing the swing project with the WS proxy classes, opened the Applet and find out that I have some classes missing, so I started adding all the relevant Jars and ended with a ~13MB JAR containing all the swing project jars that in the class path for a simple Applet.
I know that I'm missing something but I dont know what. Do I really need all those Jars. Is there a simple way to call to a WS via Applet?
This is the list of all the Jars:
activation.jar
commons-logging-api.jar
commons-logging.jar
ejb.jar
http_client.jar
jaxb-api.jar
jaxb-impl.jar
jaxen.jar
jaxr-api.jar
jaxrpc-api.jar
jazncore.jar
jdom.jar
jms.jar
jta.jar
mail.jar
mdds.jar
oc4jclient.jar
ojdl2.jar
ojmisc.jar
ojpse.jar
oraclepki.jar
orajaxr.jar
orasaaj.jar
orawsdl.jar
orawsrm.jar
osdt_cert.jar
osdt_core.jar
osdt_saml.jar
osdt_wss.jar
osdt_xmlsec.jar
relaxngDatatype.jar
saaj-api.jar
saaj-impl.jar_old
servlet.jar
wsclient.jar
wsdl.jar
wssecurity.jar
wsserver.jar
xdb.jar
xml.jar
xmlparserv2.jar
xsdlib.jar
By the way at the end of all this annoying process I got the next exception:
[failed to localize] typemapping.nested.exception.initialization(javax.xml.rpc.JAXRPCException: javax.xml.soap.SOAPException: Unable to create SOAP Factory: Provider com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl not found)
at oracle.j2ee.ws.client.BasicService.createLiteralMappings(BasicService.java:282)
at oracle.j2ee.ws.client.BasicService.createStandardTypeMappingRegistry(BasicService.java:244)
at com.tm.view.ws.misc.runtime.WSMisc_Service_SerializerRegistry.getRegistry(WSMisc_Service_SerializerRegistry.java:26)
at com.tm.view.ws.misc.runtime.WSMisc_Service_Impl.<init>(WSMisc_Service_Impl.java:26)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at oracle.j2ee.ws.client.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:92)
at oracle.j2ee.ws.client.ServiceFactoryImpl.loadService(ServiceFactoryImpl.java:121)
at com.tm.view.ws.misc.WSMiscSoap12HttpPortClient.<init>(WSMiscSoap12HttpPortClient.java:20)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at client.base.connectivity.ClientRequestAgent.runWS(ClientRequestAgent.java:135)
at client.base.connectivity.ClientRequestAgent.run(ClientRequestAgent.java:44)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
ShacharTry this:
1. open the webService data controll in the Data Controls section and drag the method from the webService onto the method call activity in your task flow. This will overwrite the current method property (the one which pints to your bean, make a copy of this entry if you can't reproduce it by hand). This too will create an entry in the pageDef of the method call activity.
2. reenter (or paste) the original value in the method property, so that it again points to your bean. The entry in the pageDef will remain!
3. now in the bean method you can access the method via its binding like you access any other method from the binding:
// GET A METHOD FROM PAGEDEF AND EXECUTE IT
// get the binding container
BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
// get an Action or MethodAction
OperationBinding method = bindings.getOperationBinding("YourMethodActionNAME");
if (method == null)
// handle method not found error...
// if there are parameters to set...
Map paramsMap = method.getParamsMap();
paramsMap.put("param","value") ;
// execute the method
method.execute();
List errors = method.getErrors();
if (!errors.isEmpty())
// handle errors here errors is a list of exceptions!
// no error resume normal workTimo -
How does one set databse parameters in Tomcat to run a servlet?
Hi, I am trying to run a applet-servlet code, downloaded from the web. According to the installation instructions, the following is stated:
Database Parameters. You can provide different database parameters to the servlet. These parameters are set during the administration of the servlet.
dbDriver - name of the database driver class name (default = sun.jdbc.odbc.JdbcOdbcDriver)
dbURL - complete database URL (default = jdbc:odbc:StudentDatabase)
userid - user id (default = <none>)
passwd - password (default = <none>)
I am running TOMCAT on a Windows2000 machine. My question is how to does one set the parameters in TOMCAT. What is the default userid and password for TOMCAT.
Any help/advise is appreciated in advance. Thanks.Regards.May be parameters must be set in web.xml in your war
-
Unable to set kernel parameters using solaris 10
HI,
I'm trying to install DB2 8.2 on solaris 10.the problem i'm encountering in installation is unable to set MSGMAX and MSGMNB kernel parameters. I tried setting the new replacement parameter process.max-msq-qbytes through projects->Resource Control from the management console.but still uinable to set the parameters.
Can anyone help me in setting the above kernel parameters.
Its not possible to set it thru /etc/system.
thanx
guruHI,
I'm trying to install DB2 8.2 on solaris 10.the problem i'm encountering in installation is unable to set MSGMAX and MSGMNB kernel parameters. I tried setting the new replacement parameter process.max-msq-qbytes through projects->Resource Control from the management console.but still uinable to set the parameters.
Can anyone help me in setting the above kernel parameters.
Its not possible to set it thru /etc/system.
thanx
guru -
Unable to set kernel parameters using Reource Control
HI,
I'm trying to install DB2 8.2 on solaris 10.the problem i'm encountering in installation is unable to set MSGMAX and MSGMNB kernel parameters. I tried setting the new replacement parameter process.max-msq-qbytes through projects->Resource Control from the management console.but still uinable to set the parameters.
Can anyone help me in setting the above kernel parameters.
Its not possible to set it thru /etc/system.
thanx
guruI finally had some time to find the actual syntax for tuning process.max-msq-qbytes and process.max-msg-messages. prctl will change those paramaters for an existing process.
As a proof of concept I changed process.max-msg-messages to a 64k. process 2221 is my shell.
prctl -n process.max-msg-messages -r -v 64k 2221
bash-3.00# prctl 2221
process: 2221: -csh
NAME PRIVILEGE VALUE FLAG ACTION RECIPIENT
process.max-port-events
privileged 65.5K - deny -
system 2.15G max deny -
process.max-msg-messages
privileged 64.0K - deny -
system 4.29G max deny -
process.max-msg-qbytes
privileged 64.0KB - deny -
system 4.00GB max deny -And now to make this persist across reboots...
So long as I'm experimenting, I'll use projadd and add a new project which just includes me and not the rest of the users in the group staff.
bash-3.00# projadd -p 115 -U testuser \
-K "process.max-msg-messages=(priv,64K,deny)" \
-K "process.max-msg-qbytes=(priv,64K,deny)" \
user.me This creates the following /etc/project:
(note the last line is all on one line in the real file minus the \.)
placer% cat /etc/project
system:0::::
user.root:1::::
noproject:2::::
default:3::::
group.staff:10::::
user.me:115::testme::\
process.max-msg-messages=(priv,64000,deny);process.max-msg-qbytes=(priv,65536,deny)After a reboot I checked the values by loging in under my user and running prctl.
placer% prctl $$
process: 419: -csh
NAME PRIVILEGE VALUE FLAG ACTION RECIPIENT
process.max-port-events
privileged 65.5K - deny -
system 2.15G max deny -
process.max-msg-messages
privileged 64.0K - deny -
system 4.29G max deny -
process.max-msg-qbytes
privileged 64.0KB - deny -
system 4.00GB max deny -
process.max-sem-ops
privileged 512 - deny -
system 2.15G max deny -
...Solaris 10 has different tunables and default values from 8 and 9. It's default tunables should be good for most applications per a given system's hardware. There are some great blog articles, and discussions on opensolaris.org and blogs.sun.com on tuning that explain the intent of tuning and why we shouldn't have to tune.
Cheers,
~~sa -
Unable to set kernel parameters using Reource Control in solaris 10
HI,
I'm trying to install DB2 8.2 on solaris 10.the problem i'm encountering in installation is unable to set MSGMAX and MSGMNB kernel parameters. I tried setting the new replacement parameter process.max-msq-qbytes through projects->Resource Control from the management console.but still uinable to set the parameters.
Can anyone help me in setting the above kernel parameters.
Its not possible to set it thru /etc/system.
thanxHI,
I'm trying to install DB2 8.2 on solaris 10.the problem i'm encountering in installation is unable to set MSGMAX and MSGMNB kernel parameters. I tried setting the new replacement parameter process.max-msq-qbytes through projects->Resource Control from the management console.but still uinable to set the parameters.
Can anyone help me in setting the above kernel parameters.
Its not possible to set it thru /etc/system.
thanx -
Getting parameters from multipart request
I'm using org.apache.tomcat.utils.fileupload to parse uploaded files from a multipart form, but unfortunately I can't seem to get normal parameters from such a form with request.getParameter(). Is there a way to use both together?
You might already have solved your problem, but you may find this MultipartFilter useful too: http://balusc.blogspot.com/2007/11/multipartfilter.html
It automatically detects multipart/form-data requests and sets the plain vanilla form parameters back in the ParameterMap of the HttpServletRequest and sets the files as attributes of the HttpServletRequest. This way there is no need to worry about the form encoding type inside the servlet.
Maybe you are looking for
-
I have an IBM Think Pad and since installing the latest version of Firfox, the trackpoint scrolling on my mouse no longer works
-
Sort the table values in asc or desc
I have a table named date_table contains two columns (Term,multiplier) with values given below Term Multiplier 1 M 2 M 8 Y 15 D 2 Y 24 M 1800 D Values given above are term and multipiler.Means 1 M stands 1 month,15 D stands for 15 Days 2 Y stands for
-
Hi. Ich habe das Lenovo Notebook g710 mit Windows 8.1. Im folgenden Text beschreibe ich kurz mein Problem: Vor einiger Zeit hatte ich Probleme Musik wiederzugeben. Nach einigem Suchen fand ich, dass in der unteren rechten Ecke bei dem Lautsprechersym
-
Can i install v5 & v3 application in N-8 ?
-
Scanner recommendations ...
Hello All I have been shopping around now for a couple of weeks for a scanner. I have looked at the Epson 4490 but, I'm not sure if its Leopard compatible.. Macintosh Requirements iMac® or any G3 or later with built-in USB. USB: Mac OS X 10.2.x and O