GetParameter function in 1.4.1

Hi,
I want to get parameters from an applet.
The parameter's value contains carriage return. When I use the getParameter() function, all the carriage return are deleted. The problem is that I need them !
Below a kind of parameters I used :
<PARAM NAME="USER_TXT" VALUE="<B>title 1</B><br>
4685006|GV2L|LC1D25/32|LR2DZ3|6
4686506|GS1F|LC1D09/12/18|LR2Z13|6
">
The Java code I used:
strTxt= parent.getParameter("USER_TXT");
The string displayed in the Java Console:
<B>title 1</B><br>4685006|GV2L|LC1D25/32|LR2DZ3|64686506|GS1F|LC1D09/12/18|LR2Z13|6
It worked fine when I used the 1.3.1_01 JVM but it does not work in 1.4.1_01....
Does anyone have a solution to get the value with the carriage return?
Thank you for your help,
Scrb.

How about encoding your CRs somehow? Try using the unicode escape sequence for CR, \u000D or maybe even the Java/C-style \n.
.P.

Similar Messages

  • GetParameter() function breaks my loops...

    I'm trying to build an array of indices over which to iterate using a WHILE loop. The indices are passed to my java applet from a known parameter name using the function getParameter(that_name).
    Once the array is built over which to iterate; I want to get each parameter associated with the param names specified by that array from my HTML and draw the parameter values using drawString() one-by-one.
    The array is properly built, the arguments being passed to getParameter are right. The problem is that it stops after only the first iteration of the loop.
    Here is my code:
    THE JAVA:
    import java.applet.*;
    import java.awt.*;
    import java.lang.Math.*;
    import java.lang.String;
    import java.lang.reflect.Array;
    public class DenGen extends Applet {
    @Override
    public void paint(Graphics g) {
    int radius = 250;
    int layers = Integer.parseInt(getParameter("layers"));
    int nodes = Integer.parseInt(getParameter("nodes"));
    double radii = radius/(layers+2);
    boolean String;
    String delimeter = ",";
    String call = Integer.toString(layers-1);
    String make_layer = "00";
    String fin = call.concat(make_layer);
    String str = getParameter(fin);
    String[] final_layer = str.split(delimeter);
    int start = 0;
    int stop = 0;
    int index = 0;
    int i = 0;
    String param;
    while(Integer.parseInt(final_layer) < Array.getLength(final_layer)){
    param = getParameter(Integer.toString(i));
    g.drawString((String) getParameter(Integer.toString(i)), 250, 10);
    i++;
    THE HTML:
    <html>
    <head>
         <style type = text/css>
         .applet{
              border: 1px solid black;
         </style>
    </head>
    <body>
    <center>
    <APPLET CODE="DenGen.class" codebase = "build/classes" WIDTH="550" HEIGHT="550" class = applet>
         <PARAM NAME = "layers" VALUE = "2">
         <PARAM NAME = "nodes" VALUE = "102">
         <PARAM NAME = "000" VALUE = "4, 5">
         <PARAM NAME = "100" VALUE = "0, 1, 2, 3">
         <PARAM NAME = "0" VALUE = "3.52941176471, 158.823529412">
         <PARAM NAME = "1" VALUE = "162.352941176, 204.705882353">
         <PARAM NAME = "2" VALUE = "208.235294118, 345.882352941">
         <PARAM NAME = "3" VALUE = "349.411764706, 360">
    </APPLET>
    </center>
    </body>
    </html>

    Try this variant. Note that it can be run like this..
    prompt>javac DenGen.java
    prompt>appletviewer DenGen.java // the '.java' xtn is not a mistake! AppletViewer is smart enough to parse the applet element out of the comment at the top of the file. This is handy for testing purposes, as AppletViewer saves problems with class caching in browsers, and makes the console more easily accessible. It is also handy in that we do not need to create a separate HTML file for it to work. ;)
    <APPLET CODE="DenGen" WIDTH="550" HEIGHT="550">
      <PARAM NAME = "layers" VALUE = "2">
      <PARAM NAME = "nodes" VALUE = "102">
      <PARAM NAME = "000" VALUE = "4, 5">
      <PARAM NAME = "100" VALUE = "0, 1, 2, 3">
      <PARAM NAME = "0" VALUE = "3.52941176471, 158.823529412">
      <PARAM NAME = "1" VALUE = "162.352941176, 204.705882353">
      <PARAM NAME = "2" VALUE = "208.235294118, 345.882352941">
      <PARAM NAME = "3" VALUE = "349.411764706, 360">
    </APPLET>
    import java.applet.Applet;
    import java.awt.Graphics;
    public class DenGen extends Applet {
      String[] params;
      @Override
      public void init() {
        int radius = 250;
        int layers = Integer.parseInt(getParameter("layers"));
        int nodes = Integer.parseInt(getParameter("nodes"));
        double radii = radius/(layers+2);
        String delimeter = ",";
        String call = Integer.toString(layers-1);
        String make_layer = "00";
        String fin = call.concat(make_layer);
        String str = getParameter(fin);
        String[] final_layer = str.split(delimeter);
        int start = 0;
        int stop = 0;
        int index = 0;
        params = new String[final_layer.length];
        for (int ii=0; ii<final_layer.length; ii++) {
          String countString = "" + ii;
          params[ii] = getParameter(countString);
      @Override
      public void paint(Graphics g) {
        for (int ii=0; ii<params.length; ii++) {
          g.drawString(params[ii], 20, 15 + (ii*20));
    }

  • Problem with transfering unicode form data in MULTIPART/FORM-DATA

    HI experts,
    I have this web based multilingual application. Page 1(form6.jsp) is basic registeration form with 5 fields and one image upload to the server. Page 2(verify.jsp) is another jsp page for verification of UTF data entered in page 1.
    page 2 (verify.jsp) also uses a bean called (verify.java) for picking up values. page 3(insertEntry.jsp) is the page for inserting that data into the Database and uses a bean called (logicbean.java).
    Now, the problem im facing here is that if i use multipart/form-data, the unicode text filled in page1 is shown as garbage when its is transfered to page2 and displayed on page2. It is all gibberish. But if i do not use multipart/form-data, the unicode text transfered from page1 to page2 is displayed perfectly on page2.Im using devenagari(UTF) language for filling in details.
    // form6.jsp
    <%@ page language="java" pageEncoding="UTF-8"%>
    <%@ page import="java.util.*,java.text.*" %>
    <%@ page import="com.oreilly.servlet.*" %>
    <%
    request.setCharacterEncoding("UTF-8");
    %>
    <HTML>
    <HEAD>
    <TITLE>
    <%=session.getValue("main.title")%>
    </TITLE>
    </HEAD>
    <h1><center><%=session.getValue("main.head")%><Center>
    <BODY background="brown.bmp">
    <form name=form6 action="verify.jsp" method="post" enctype="multipart/form-data">
    <center>
    <font>
    <table border=1>
    <tr>
    <td colspan=2><center><img src="asok.bmp"></center>
    </tr>
    <tr>
    <td >
    <b>1.)<%=session.getValue("main.ec")%></b>
    </td>
    <td></td>
    </tr>
    <tr>
    <td align="right"><b><%=session.getValue("main.ecname")%></b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="votername"></td>
    <td></td>
    </tr>
    <tr>
    <td align="right"> <b><%=session.getValue("main.ecsurname")%></b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="votersurname"></td>
    <td></td>
    </tr>
    <tr>
    <td align="left"><b>2.)<%=session.getValue("main.rel")%></b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
    <select name="relation" onchange="if(this.selectedIndex!=0){this.form.texthiddenrelation.value=this.options[this.selectedIndex].value}" size="1">
                                       <option>Choose</option>
    <option value="father">Father</option>
    <option value="mother">Mother</option>
    <option value="husband">Husband</option>
    </select>
    <input type="hidden" name="texthiddenrelation" />
    </td>
    </tr>
    <tr>
    <td align="right"><b><%=session.getValue("main.relname")%></b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="parentname">
    <td></td>
    </tr>
    <tr>
    <td align="right"><b><%=session.getValue("main.relsurname")%>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</b><input type="text" name="parentsurname">
    <td></td>
    </tr>
    <tr>
    <td align="right"><b>3.)<%=session.getValue("main.sex")%></b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
    <select name="sex" onchange="if(this.selectedIndex!=0){this.form.texthiddensex.value=this.options[this.selectedIndex].value}" size="1">
                                            <option>Choose</option>
                                            <option value="male">Male</option>
    <option value="female">Female</option>
    <option value="other">Other</option>
    </select>
    <input type="hidden" name="texthiddensex" /> </td>
    <td align="right"><b><%=session.getValue("form6.image")%><input type ="file" name=pic1 onchange={this.form.pic.value=this.form.pic1.value}><input type= hidden name=pic> </b></td>
    </tr>
    <tr>
    <td colspan=2><b>4.)<%=session.getValue("main.age")%></b><input type="text" name="age">
    </td>
    </tr>
    <tr>
    <td><b>5.)<%=session.getValue("main.dob")%></b>
    <td><b><%=session.getValue("main.dobday")%></b> <select name="cmbday">
    <option value="1"> 1 </option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    <option value="5">5</option>
    <option value="6">6</option>
    <option value="7">7</option>
    <option value="8">8</option>
    <option value="9">10</option>
    <option value="10">11</option>
    <option value="11">12</option>
    <option value="12">13</option>
    <option value="13">14</option>
    <option value="14">15</option>
    <option value="15">16</option>
    <option value="16">17</option>
    <option value="17">18</option>
    <option value="18">19</option>
    <option value="19">20</option>
    <option value="20">21</option>
    <option value="21">22</option>
    <option value="22">23</option>
    <option value="23">24</option>
    <option value="24">25</option>
    <option value="25">26</option>
    <option value="26">27</option>
    <option value="28">28</option>
    <option value="29">29</option>
    <option value="30">30</option>
    <option value="31">31</option>
    </select>
    <b><%=session.getValue("main.dobmonth")%></b><select name="cmbmonth">
    <option value="jan">JAN</option>
    <option value="feb">FEB</option>
    <option value="mar">MAR</option>
    <option value="apr">APR</option>
    <option value="may">MAY</option>
    <option value="jun">JUN</option>
    <option value="jul">JUL</option>
    <option value="aug">AUG</option>
    <option value="sep">SEPT</option>
    <option value="oct">OCT</option>
    <option value="nov">NOV</option>
    <option value="dec">DEC</option>
    </select>
    <b><%=session.getValue("main.dobyear")%></b> <select name="cmbyear" onchange="if(this.form.cmbday.selectedIndex!=0 && this.form.cmbmonth.selectedIndex!=0 && this.form.cmbyear.selectedIndex!=0){this.form.mergedage.value=this.form.cmbday.options[this.form.cmbday.selectedIndex].value +' '+this.form.cmbmonth.options[this.form.cmbmonth.selectedIndex].text +' '+ this.form.cmbyear.options[this.form.cmbmonth.selectedIndex].value}" size="1">
    <option value="1970">1970</option>
    <option value="1971">1971</option>
    <option value="1972">1972</option>
    <option value="1973">1973</option>
    <option value="1974">1974</option>
    <option value="1975">1975</option>
    <option value="1976">1976</option>
    <option value="1977">1977</option>
    <option value="1978">1978</option>
    <option value="1979">1979</option>
    <option value="1980">1980</option>
    <option value="1981">1981</option>
    <option value="1982">1982</option>
    <option value="1983">1983</option>
    <option value="1984">1984</option>
    <option value="1985">1985</option>
    <option value="1986">1986</option>
    <option value="1987">1987</option>
    <option value="1988">1988</option>
    <option value="1989">1989</option>
    <option value="1990">1990</option>
    <option>
    </select>
    <input type="hidden" name="mergedage">
    </tr>
    <tr>
    <td colspan=2><b>6.)<%=session.getValue("main.add")%></b>
    </tr>
    <tr>
    <td align="right"><b><%=session.getValue("main.addline1")%></b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="address1" value=""></td>
    <td><b><%=session.getValue("main.addstate")%></b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="state"></td>
    </tr>
    <tr>
    <td align="right"><b><%=session.getValue("main.addline2")%></b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="address2" onChange="this.form.finaladdress.value=this.form.address1.value + ';' + this.value;"> <input type="hidden" name="finaladdress"> </td>
    <td><b><%=session.getValue("main.addcity")%>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</b><input type="text" name="city"></td>
    </tr>
    <tr>
    <td align="right"> <b><%=session.getValue("main.addpin")%></b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="pincode">
    <td></td>
    </tr>
    <tr>
    <td ><b>7.)<%=session.getValue("main.const")%></b> <input type="text" name="constituency">
    <td ><b>8.)<%=session.getValue("main.id")%></b> &nbsp&nbsp<input type="text" name="refno">
    </tr>
    <tr>
    <td colspan="2"><center><input type="reset" name="reset" value="<%=session.getValue("button.reset")%>">&nbsp&nbsp<input type=submit name=Submit value="<%=session.getValue("button.submit")%>"></center></td>
    </tr>
    <tr>
    <td>
    </td>
    </tr>
    </form>
    </font>
    </BODY>
    </HTML>
    // verify.jsp
    <%@ page language="java" pageEncoding="UTF-8"%>
    <jsp:useBean id="verify" class="pack.verify" scope="request"/>
    <%@ page import="com.oreilly.servlet.*" %>
    <%@ page import="java.util.*,java.text.*" %>
    <%!
    MultipartRequest mp;
    // ParameterParser pp;
    %>
    <!-- Perform the actions on the bean. -->
    <%
    //pp.setCharacterEncoding("utf-8");
    %>
    <%
    try
    mp = new MultipartRequest(request, "d:/Files");
    out.println("DONE");
    /* Set the request object.*/
    /* The request object is implicitly available in the JSP page.*/
    verify.setRequest(mp);
    /* Insert the employee data into the database.*/
    verify.verifyEntry();
    //verify.setscope();
    /* Run the query to retrieve the employee data from the database.*/
    //logicbean.runQuery();
    catch (Exception e)
    System.out.println(e.getMessage());
    %>
    <HTML>
    <HEAD>
    <LINK href="theme/Master.css" rel="stylesheet" type="text/css">
    <TITLE>
    </TITLE>
    </HEAD>
    <BODY background="brown.bmp">
    <form name=form6 action="insertEntry.jsp" method="POST">
    <center>
    <table border=3>
    <tr>
    <td colspan=2><center><img src="asok.bmp"></center>
    </tr>
    <tr>
    <td >
    <b>1.)<%=session.getValue("main.ec")%></b>
    </td>
    <td rowspan=3>
    <image src="<%=verify.getpic()%>" width="85" hieght="85">
    </td>
    </tr>
    <tr>
    <td > &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<b><%=session.getValue("main.ecname")%></b> <%=verify.getvotername()%>&nbsp&nbsp<input type="hidden" value= "<%=verify.getvotername()%>" name="votername"></td>
    </tr>
    <tr >
    <td> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<b><%=session.getValue("main.ecsurname")%></b><%=verify.getvotersurname()%>
    <input type="hidden" value= "<%=verify.getvotersurname()%>" name="votersurname"></td>
    </tr>
    <tr>
    <td ><b>2.)<%=session.getValue("main.rel")%></b><input type="hidden" value= "<%=verify.getvoterrelation()%>" name="texthiddenrelation"></td>
    <td><%=verify.getvoterrelation()%></td>
    </tr>
    <tr>
    <td >&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<b><%=session.getValue("main.relname")%></b>&nbsp&nbsp&nbsp <input type="hidden" value= "<%=verify.getparentname()%>" name="parentname"></td>
    <td><%=verify.getparentname()%></td>
    </tr>
    <tr>
    <td >&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<b><%=session.getValue("main.relsurname")%></b><input type="hidden" value= "<%=verify.getparentsurname()%>" name="parentsurname"></td>
    <td><%=verify.getparentsurname()%></td>
    </tr>
    <tr>
    <td><b>3.)<%=session.getValue("main.sex")%></b><input type="hidden" value= "<%=verify.getsex()%>" name="texthiddensex"></td>
    <td><%=verify.getsex()%></td>
    </tr>
    <tr>
    <td ><b>4.)<%=session.getValue("main.age")%></B><input type="hidden" value= "<%=verify.getage()%>" name="age"></td>
    <td><%=verify.getage()%></td>
    </tr>
    <tr>
    <td><b>5.)<%=session.getValue("main.dob")%></b> <input type="hidden" value= "<%=verify.getdob()%>" name="mergedage"></td>
    <td> <%=verify.getdob()%></td>
    </tr>
    <tr>
    <td colspan=2><b>
    6.)<b><%=session.getValue("main.add")%></b></td>
    </tr>
    <tr>
    <td> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<b><%=session.getValue("verify.add")%></b><input type="hidden" value= "<%=verify.getadderess()%>" name="finaladdress"> </td>
    <td><%=verify.getadderess()%></td>
    </tr>
    <tr>
    <td >&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<b><%=session.getValue("main.addpin")%></b><input type="hidden" value= "<%=verify.getpin()%>" name="pincode"></td>
    <td><%=verify.getpin()%></td>
    </tr>
    <tr>
    <td>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<b><%=session.getValue("main.addstate")%></b><input type="hidden" value= "<%=verify.getstate()%>" name="state"></td>
    <td><%=verify.getstate()%></td>
    </tr>
    <tr>
    <td><b>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<%=session.getValue("main.addcity")%></b><input type="hidden" value= "<%=verify.getcity()%>" name="city"></td>
    <td><%=verify.getcity()%></td>
    </tr>
    <tr>
    <td><b>7.)<%=session.getValue("main.const")%></b> <input type="hidden" value= "<%=verify.getconst()%>" name="constituency"></td>
    <td><%=verify.getconst()%></td>
    </tr>
    <tr>
    <td><b>8.)<%=session.getValue("main.id")%></b> <input type="hidden" value= "<%=verify.getrefno()%>" name="refno"></td>
    <td><%=verify.getrefno()%></td>
    </tr>
    <tr>
    <td colspan="2"><center><INPUT TYPE="button" VALUE="<%=session.getValue("ie.back")%>" onClick="history.go(-1)">
    <input type=submit name=Submit value="<%=session.getValue("button.submit")%>"></center><input type="hidden" value= "<%=verify.getpic()%>" name="pic"></td>
    </tr>
    </form>
    </BODY>
    </HTML>
    //verify.java
    package pack;
    import java.lang.*;
    import java.sql.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import com.oreilly.servlet.*;
    import com.oreilly.servlet.ParameterParser.*;
    * @author Administrator
    * To change this generated comment edit the template variable "typecomment":
    * Window>Preferences>Java>Templates.
    * To enable and disable the creation of type comments go to
    * Window>Preferences>Java>Code Generation.
    public class verify {
    String votername = "";
    String votersurname = "";
    String texthiddenrelation="";
    String parentname = "";
    String parentsurname = "";
    String gender = "";
    String texthiddensex="";
    String age = "";
    String dob = "";
    String mergedage="";
    String address = "";
    String finaladdress="";
    String pincode = "";
    String state = "";
    String city = "";
    String constituency = "";
    String refno = "";
    MultipartRequest request = null;
    Connection dbConn = null;
    ParameterParser pp;
    private String voternameParam;
    * Set the request object. This is used for getting parameters.
    public void setRequest(MultipartRequest request)
    this.request = request;
    public void verifyEntry()
    throws Exception
    /* Connect to the database.*/
    //pp.setCharacterEncoding("utf-8");
    //String nameParam = request.getParameter("name");
    MultipartRequest mp;
    System.out.println("connected to db2 through insertemployee");
    /* Get all the parameters from the calling HTML form.*/
    String voternameParam = request.getParameter("votername");
    System.out.println("the votername is " + request.getParameter("votername"));
    System.out.println(voternameParam);
    String votersurnameParam = request.getParameter("votersurname");
    System.out.println("the votersurname is " + request.getParameter("votersurname"));
    String hiddenrelationParam = request.getParameter("texthiddenrelation");
    System.out.println("the relation is " + request.getParameter("texthiddenrelation"));
    String parentnameParam = request.getParameter("parentname");
    System.out.println("the parentname is " + request.getParameter("parentname"));
    String parentsurnameParam = request.getParameter("parentsurname");
    System.out.println("the parentsurname is " + request.getParameter("parentsurname"));
    String ageParam = request.getParameter("age");
    System.out.println("the age is " + request.getParameter("age"));
    String mergedageParam = request.getParameter("mergedage");
    System.out.println("the mergedage is " + request.getParameter("mergedage"));
    String hiddensexParam = request.getParameter("texthiddensex");
    System.out.println("the hiddensex is " + request.getParameter("texthiddensex"));
    //String dobParam = request.getParameter("dob");
    //System.out.println("the dob is " + request.getParameter("dob"));
    String finaladdressParam = request.getParameter("finaladdress");
    System.out.println("the finaladdress is " + request.getParameter("finaladdress"));
    String pincodeParam = request.getParameter("pincode");
    System.out.println("the pincode is " + request.getParameter("pincode"));
    String stateParam = request.getParameter("state");
    System.out.println("the state is " + request.getParameter("state"));
    String cityParam = request.getParameter("city");
    System.out.println("the city is " + request.getParameter("city"));
    String constituencyParam = request.getParameter("constituency");
    System.out.println("the constituency is " + request.getParameter("constituency"));
    String refnoParam = request.getParameter("refno");
    System.out.println("the refno is " + request.getParameter("refno"));
    System.out.println("encoding = " + System.getProperty("file.encoding"));
    public String getvotername()
    return request.getParameter("votername");
    public String getvotersurname()
    return request.getParameter("votersurname");
    public String getvoterrelation()
    return request.getParameter("texthiddenrelation");
    public String getparentname()
    return request.getParameter("parentname");
    public String getparentsurname()
    return request.getParameter("parentsurname");
    public String getage()
    return request.getParameter("age");
    public String getsex()
    return request.getParameter("texthiddensex");
    public String getadderess()
    return request.getParameter("finaladdress");
    public String getpin()
    return request.getParameter("pincode");
    public String getstate()
    return request.getParameter("state");
    public String getcity()
    return request.getParameter("city");
    public String getconst()
    return request.getParameter("constituency");
    public String getrefno()
    return request.getParameter("refno");
    public String getdob()
    return request.getParameter("mergedage");
    public String getpic()
    //String a=request.getParameter("pic");
    //a=a.substring(a.lastIndexOf("/")+1);
    //System.out.print("Java path is "+a);     
    //Enumeration enum=request.getFileNames();
    //while(enum.hasMoreElements())
    //     String abc=(String)enum.nextElement();
    //     System.out.print("Java the path is "+abc);     
    return request.getParameter("pic");
    String votername1;
    //public void setScope()
    //request.setAttribute("votername1" ,voternameParam );
    //insertEntry.jsp
    <jsp:useBean id="logicbean" class="pack.logicbean" scope="request"/>
    <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
    <%@ page import="java.util.*,java.text.*" %>
    <%@ page import="com.oreilly.servlet.*" %>
    <%
    request.setCharacterEncoding("UTF-8");
    %>
    <!-- Perform the actions on the bean. -->
    <%
    request.setCharacterEncoding("UTF-8");
    %>
    <%
    try
    /* Set the request object.*/
    /* The request object is implicitly available in the JSP page.*/
    logicbean.setRequest(request);
    //MultiPartRequest mp=MultiPartRequest(request,"E:\Files");
    /* Insert the employee data into the database.*/
    logicbean.insertEntry();
    /* Run the query to retrieve the employee data from the database.*/
    //logicbean.runQueryInsert();
    catch (Exception e)
    System.out.println(e.getMessage());
    %>
    <HTML>
    <HEAD>
    <TITLE>
    Insert Record
    </TITLE>
    </HEAD>
    <BODY background="brown.bmp">
    <center><H2><%=session.getValue("ie.label")%>
    </H2>
    <font face = "Devanagari MT for IBM" size = +2>
    <b><%=session.getValue("ie.sd")%>|<%=session.getValue("ie.home")%></b>
    </font>
    </center>
    </BODY>
    </HTML>
    I have narrowed down the problem to the point where i understand that the "request.getParameter()" function for multipart is not able to understand or read UTF data properly. The out.println prints garbage from this function on the console. im using WAS
    plz help
    thanx in advance
    caffaine

    hi,
    To solve your problem Servlet Filters
    FILTER PROGRAM
    ===============
    package filters;
    import java.io.IOException;
    import javax.servlet.Filter;
    import javax.servlet.FilterChain;
    import javax.servlet.FilterConfig;
    import javax.servlet.ServletException;
    import javax.servlet.ServletRequest;
    import javax.servlet.ServletResponse;
    import javax.servlet.UnavailableException;
    public class SetCharacterEncodingFilter implements Filter {
    // ----------------------------------------------------- Instance Variables
    * The default character encoding to set for requests that pass through
    * this filter.
    protected String encoding = null;
    * The filter configuration object we are associated with. If this value
    * is null, this filter instance is not currently configured.
    protected FilterConfig filterConfig = null;
    * Should a character encoding specified by the client be ignored?
    protected boolean ignore = true;
    // --------------------------------------------------------- Public Methods
    * Take this filter out of service.
    public void destroy() {
    this.encoding = null;
    this.filterConfig = null;
    * Select and set (if specified) the character encoding to be used to
    * interpret request parameters for this request.
    * @param request The servlet request we are processing
    * @param result The servlet response we are creating
    * @param chain The filter chain we are processing
    * @exception IOException if an input/output error occurs
    * @exception ServletException if a servlet error occurs
    public void doFilter(ServletRequest request, ServletResponse response,
    FilterChain chain)
         throws IOException, ServletException {
    // Conditionally select and set the character encoding to be used
    if (ignore || (request.getCharacterEncoding() == null)) {
    String encoding = selectEncoding(request);
    if (encoding != null)
    request.setCharacterEncoding(encoding);
         // Pass control on to the next filter
    chain.doFilter(request, response);
    * Place this filter into service.
    * @param filterConfig The filter configuration object
    public void init(FilterConfig filterConfig) throws ServletException {
         this.filterConfig = filterConfig;
    this.encoding = filterConfig.getInitParameter("encoding");
    String value = filterConfig.getInitParameter("ignore");
    if (value == null)
    this.ignore = true;
    else if (value.equalsIgnoreCase("true"))
    this.ignore = true;
    else if (value.equalsIgnoreCase("yes"))
    this.ignore = true;
    else
    this.ignore = false;
    // ------------------------------------------------------ Protected Methods
    * Select an appropriate character encoding to be used, based on the
    * characteristics of the current request and/or filter initialization
    * parameters. If no character encoding should be set, return
    * <code>null</code>.
    * <p>
    * The default implementation unconditionally returns the value configured
    * by the <strong>encoding</strong> initialization parameter for this
    * filter.
    * @param request The servlet request we are processing
    protected String selectEncoding(ServletRequest request) {
    return (this.encoding);
    web-xml entry
    +++++++++++
    <filter>     
         <filter-name>Set Character Encoding</filter-name>
    <filter-class>filters.SetCharacterEncodingFilter</filter-class>
              <init-param>
    <param-name>encoding</param-name>
    <param-value>UTF-8</param-value>
    </init-param>
    </filter>
    <filter-mapping>
    <filter-name>Set Character Encoding</filter-name>
    <url-pattern>*.jsp</url-pattern>
    </filter-mapping>

  • How to get the upload file from a html form ?

    I have a <input type=file ...> control in my form, and the user use that
              control to submit a file
              to my web server. The porblem is the getParameter() function of
              HttpServletRequest only return the
              filename. Does anyone know how to get the file body ?
              Frances
              

    http://www.servlets.com/jsp/examples/ch04/index.html#ex04_17
              Frances Fan <[email protected]> wrote:
              > I have a <input type=file ...> control in my form, and the user use that
              > control to submit a file
              > to my web server. The porblem is the getParameter() function of
              > HttpServletRequest only return the
              > filename. Does anyone know how to get the file body ?
              > Frances
              Dimitri
              

  • Unicode support for ServletRequest

    Hi everyone,
    I am hoping that weblogic 6 will support Non-ASCII character encodings for http request parameter values. Has anyone heard any news about it lately ?
    The problem with previous versions (4.5.1 and 5.1.0) was tat ServletRequest.getParameter() method always returns String encoded in ISO-8859-1. (I believe this is a known problem at weblogic)
    To work around the problem, we either had to perform string-conversion, or read the request content manually using BufferedReader (this is not an option when parameter is passed in query string).
    These work-around are not acceptable because they depends on the encoding that clients use (which we never know absolutely), and depends on the jsp / servlet containers.
    Yoshi

    Even I am having the exact same problem. Please help.
    Nikhil
    "Frank" <[email protected]> wrote:
    >
    Hi,
    In WLS510-sp8, the new property is called weblogic.httpd.inputCharset and I put the following line in the file weblogic.properties :
    weblogic.httpd.inputCharset./*=Big5
    Then, you don't need to add the charset-conversion logic to your request.getParameter() function call.
    Well, my application setup is that. My application is running on Solaris7 (default charset is ASCII) and I code everything in request.getParameter() only, without any charset-conversion. Then, the phase 2 is to support Chinese and hence problem comes. I need to add the conversion logic to my code, but sp8 feature can save me a lot of time.
    But, when I get the data from Oracle, since there is no such "outputCharset" and hence I get the ascii code of the chinese code instead. Then, all of the content in the page are "ascii-code" things, not real Chinese characters.
    Any advice to set the property? At least, set the default charset of the Weblogic server/jvm as "Big5" and save me a lot of work on adding the charset conversion logic to my jsp/java code.
    Please advise.
    Cheers,
    Frank
    Ruslan Bilorusets <[email protected]> wrote:
    Yoshi,
    This will be fixed in the next service pack of 5.1 and will be included in 6.0 the Final Release. The solution is not included in 6.0 Beta.
    Thanks,
    -ruslan
    Yoshi Masuda wrote:
    Hi everyone,
    I am hoping that weblogic 6 will support Non-ASCII character encodings for http request parameter values. Has anyone heard any news about it lately ?
    The problem with previous versions (4.5.1 and 5.1.0) was tat ServletRequest.getParameter() method always returns String encoded in ISO-8859-1. (I believe this is a known problem at weblogic)
    To work around the problem, we either had to perform string-conversion, or read the request content manually using BufferedReader (this is not an option when parameter is passed in query string).
    These work-around are not acceptable because they depends on the encoding that clients use (which we never know absolutely), and depends on the jsp / servlet containers.
    Yoshi

  • Getting ServletRequest in a JSP page?

    Sorry about the newbie question, but how do you access the ServletRequest object in a JSP page? Specifically, the getParameter() functions? In servlets it's easy, the objects are passed in the doget() and dopost() functions, but I have no clue how to access it in JSP. Thanks.

    Hi!
    In JSP u've got implicit objects.
    like how u use out.print in jsp. coz out is an implicit object. and for ServletRequest and ServletResponse u've request and response resp.ly.
    http://java.sun.com/webservices/docs/ea1/tutorial/doc/JSPIntro7.html
    click here to see other objects.

  • Dynamic includes in JSP

    Does anyone know how I can include a file whose name is passed in via a querystring?
    i.e.
    <%
    String requestedPage = request.getParameter("function");
    if (requestedPage != null) {%>
    <jsp:include page="<%=requestedPage%>" flush="true"/>
    <% } %>
    Obviously this does not work...can someone suggest an alternative to accomplish the include??
    Thanks!

    String requestedPage = request.getParameter("function");
    if (requestedPage != null)
    RequestDispatcher rd = application.getRequestDispatcher(requestedPage); 
    rd.include(request, response);

  • Handling input in a non LATIN1 encoding from the browser

              I am looking to use Weblogic 6.0 in a multi locale environment
              where the user input from the browser could be in different encodings
              (the encoding would be known for a given session). However request.getParameter()
              functions are not able to parse the input from the browser correctly.
              I will appreciate if someone can point me to appropriate documentation
              or samples to do this.
              Thanks,
              --Anil
              email: [email protected]
              

              Well, it turns out, WL on W2K uses Cp1252 as the default
              encoding which ends up messing up the input for non-LATIN1
              encoding. I think the solution would be to parse the
              form and query string data yourself! Did anyone else
              hit this problem too?
              --Anil
              "Anil Kumar" <[email protected]> wrote:
              >
              >
              >I am looking to use Weblogic 6.0 in a multi
              >locale environment
              >where the user input from the browser could
              >be in different encodings
              >(the encoding would be known for a given session).
              >However request.getParameter()
              >functions are not able to parse the input from
              >the browser correctly.
              >I will appreciate if someone can point me to
              >appropriate documentation
              >or samples to do this.
              >
              >Thanks,
              >
              >--Anil
              >email: [email protected]
              

  • I had the email infected -how do I get rid of it?

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <head>
    <script type="text/javascript">
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-21595156-1']);
    _gaq.push(['_trackPageview']);
    (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();/script>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <!-- Mimic Internet Explorer 7 -->
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
    <link rel="stylesheet" href="../js/dojotoolkit/dojo/resources/dojo.css?2-6.01_164849" type="text/css"/>
    <link rel="stylesheet" href="../js/dojotoolkit/dijit/themes/dijit.css?2-6.01_164849" type="text/css"/>
    <link rel="stylesheet" href="../js/dojotoolkit/dojox/grid/_grid/Grid.css?2-6.01_164849" type="text/css"/>
    <link rel="stylesheet" href="../js/dojotoolkit/dojox/grid/resources/Grid.css?2-6.01_164849" type="text/css"/>
    <link rel="stylesheet" href="../js/dojotoolkit/dojox/iconGrid/resources/DataIconGrid.css?2-6.01_164849" type="text/css"/>
    <link rel="stylesheet" href="css/main.css?2-6.01_164849" type="text/css"/>
    <link rel="stylesheet" href="css/Default.css?2-6.01_164849" type="text/css"/>
    <link rel="stylesheet" href="css/dijit/Editor.css?2-6.01_164849" type="text/css"/>
    <script type="text/javascript">
    trace = function(txt){};
    var djConfig = {
    cacheBust: "2-6.01_164849",
    templateForAutomation: false,
    isDebug: location.href.indexOf('isDebug=true')!=-1, //to enable firebug lite, add 'isDebug=true' to the URL
    popup:true,
    //forceFirebugLite:true,
    parseOnLoad: false,
    defaultDuration: 1 // override dijit.defaultDuration for animation
    (function() {
    var getParameter = function(paramName) {
    paramName += "="
    var queryString = window.location.search;
    var strBegin = queryString.indexOf(paramName);
    if (strBegin==-1){
    strBegin = queryString.length;
    } else {
    strBegin += paramName.length;
    var strEnd = queryString.indexOf("&",strBegin);
    if (strEnd==-1){
    strEnd = queryString.length;
    return queryString.substring(strBegin,strEnd);
    var locale = getParameter("lang");
    if (locale.length > 0){
    djConfig.locale = locale.toLowerCase();
    if ( locale.toLowerCase() != "en" )
    djConfig.extraLocale = ["en"];
    if (locale == "ar" || locale == "iw") {
    djConfig.direction = document.getElementsByTagName("html")[0].dir = "rtl";
    </script>
    <script type="text/javascript" src="../js/dojotoolkit/dojo/dojo.js?2-6.01_164849"></script>
    <script type="text/javascript">
    dojo.require("dojo.date.locale");
    dojo.require("dojo.parser");
    dojo.require("dijit.ProgressBar");
    dojo.registerModulePath("iwc", "../../iwc");
    dojo.requireLocalization("iwc.i18n","resources");
    iwc.l10n = dojo.i18n.getLocalization("iwc.i18n", "resources");
    // To report progress for a loading operation:
    // * first publish the update
    // * then wrap the loading operation in a timeout
    // This provides the browser an opportunity to update the bar before it starts the loading operation.
    dojo.addOnLoad(function() {
    dojo.publish('curtainProgressUpdate', [5, ['dojo_base']]);
    setTimeout(function(){
    dojo.require("dijit.layout.BorderContainer");
    dojo.require("dijit.layout.ContentPane");
    dojo.require("dijit.layout.StackContainer");
    dojo.require("dijit.layout.TabContainer");
    dojo.parser.parse(dojo.body());
    dojo.publish('curtainProgressUpdate', [10, ['iwc_base']]);
    setTimeout(function(){
    dojo.require("iwc.kernel"); //defaultConfig extracts the secureToken value
    dojo.publish('curtainProgressUpdate', [15, ['user_prefs']]);
    setTimeout(function(){
    dojo.require("iwc.bootstrap");
    dojo.publish('curtainProgressUpdate', [20, ['theme']]);
    setTimeout(function(){
    iwcApp = new iwc.kernel();
    document.title = iwc.l10n.login_product_name;
    setTimeout(function(){
    // we must load haver the kernel has loaded.
    iwc.themes.loadSelectedItem();
    // create and attach banner (require bootstrap + kernel ran)
    try {
    var banner = new iwc.widget.Banner();
    //console.log("Created ", banner.domNode);
    //console.log(dijit.byId("iwcBanner"));
    dijit.byId("iwcBanner").domNode.appendChild(banner.domNode);
    // create and attach quick navigation
    dijit.byId("iwcLayoutNavigation").addChild(new iwc.widget.QuickActions({region: "top"}));
    var oldHandler = window["onbeforeunload"] || function(){};
    iwc.oldEventHandler["onbeforeunload"] = oldHandler;
    // Setting a static/fixes height for Android Tablet
    if((dojo.isAndroid && dojo.isTablet)){
    var initialSize = dojo.marginBox(dojo.body());
    dojo.style(dojo.body(), "height", initialSize.h + "px" );
    var handlerOrientationChange = dojo.connect(window, "orientationchange", function(){
    dojo.style(dojo.body(), "height", window.innerHeight + "px");
    window.onbeforeunload = function(evt) {
    var message = iwc.l10n.navigateAwayWarning;
    var count = iwc.openFormManager.getCount();
    if(iwc.session_invalid_redirect){
    return;
    if (count) {
    message = dojo.string.substitute(iwc.l10n.navigateAwayWithOpenFormsWarning, {count: count});
    if (typeof evt == 'undefined') { // IE
    evt = window.event;
    if (evt) {
    evt.returnValue = message;
    return message;
    } catch (e) {}
    },0);
    },0);
    },0);
    },0);
    },0);
    dojo.addOnWindowUnload(function() {
    iwcApp.destroy();
    </script>
    <!-- Help Popup -->
    <script type="text/javascript">
    function popup(mylink, windowname) {
    if (! window.focus)return true;
    var href;
    if (typeof(mylink) == 'string')
    href=mylink;
    else
    href=mylink.href;
    window.open(href, windowname, 'menubar=no,width=620,height=560,toolbar=no,resizable=yes');
    return false;
    </script>
    </head>
    <body id="iwcID" class="IWC">
    <div id="overlay">
    <div class="centered">
    <div class="logo"></div>
    <div id="progressBar"></div>
    <div id="progress"></div>
    </div>
    </div>
    <div dojoType="dijit.layout.BorderContainer" id="iwcLayout" gutters="false" onmousedown="void(0)">
    <div dojoType="dijit.layout.ContentPane" region="top" id="iwcBanner"></div>
    <!--the bottom container-->
    <div id="horizontalsplit" dojoType="dijit.layout.BorderContainer" region="center" liveSplitters="false" persist="true">
    <!-- the leading container -->
    <div id="iwcLayoutNavigation" dojoType="dijit.layout.BorderContainer" region="leading" splitter="true">
    <div dojoType="dijit.layout.BorderContainer" region="center" persist="true">
    <div id="iwcContainerLabelWrap" dojoType="dijit.layout.ContentPane" class="iwcContainerLabelWrap" region="top">
    <div class="mail"> <!-- Containing div used to set the icon class, do not remove -->
    <span class="serviceIcon dijitInline"></span>
    <span id="iwcContainerLabel" class="serviceLabel dijitInline"></span>
    </div>
    </div>
    <div id="iwcMenu" dojoType="dijit.layout.ContentPane" region="bottom" style="overflow: hidden"></div>
    <div id="iwcNavigationContainer" dojoType="dijit.layout.StackContainer" region="center" class="IWC-NavigationContainer"></div>
    </div>
    </div>
    <!-- the center container -->
    <div id="iwcRightSplit" dojoType="dijit.layout.BorderContainer" region="center" liveSplitters="false" persist="true">
    <div id="iwcViewContainer" dojoType="dijit.layout.StackContainer" region="center"></div>
    <div id="iwcViewerTaskBar" dojoType="dijit.layout.StackContainer"
    region="bottom" class="iwcViewerTaskBar dijitHidden">
    </div>
    </div>
    </div>
    </div>
    <script type="text/javascript">
    (function(){
    dojo.byId("progress").innerHTML = iwc.l10n.main_loading;
    var pb = new dijit.ProgressBar({}, "progressBar");
    // arguments are the percentage left, and the list of services yet to load
    var pbs = dojo.subscribe('curtainProgressUpdate', function(p, l) {
    if (p != 100) {
    //CONSole.log('updating progress: ', p, l, 'loading_'+l[l.length-1], iwc.l10n['loading_'+l[l.length-1]]);
    dojo.byId("progress").innerHTML = iwc.l10n['loading_'+l[l.length-1]];
    pb.update({progress: p});
    else {
    //console.log('destroying overlay');
    pb.destroy();
    dojo.unsubscribe(pbs);
    var curtain = dojo.byId("overlay");
    curtain.parentNode.removeChild(curtain);
    iwc.api.setupIdleTimeoutCheck();
    if (dojo.isSafari) {
    //console.log('fixing layout for safari...');
    dijit.byId('iwcLayout').resize();;
    </script>
    </body>
    </html>

    I had to create another email address as this code generated spam messages. http://en.wikipedia.org/wiki/Backscatter_(email)
    There was no bug in my computer or folders. Compacting the folders did not solve the issues while creating another email account did.

  • Cant use cookies in servlet

    I can't use cookie in my Servlet upon Tomcat.
    When I reach the statement "cookies.length" in code a NullPointerException is generated.
    Logfile according to:
    2003-05-22 02:51:55 StandardContext[pk]: Reloading this Context is completed
    2003-05-22 02:51:55 HTMLManager: list: Listing contexts for virtual host 'localhost'
    2003-05-22 02:52:03 StandardWrapperValve[pk]: Servlet.service() for servlet pk threw exception
    java.lang.NullPointerException
    at calender.pk.doGet(pk.java:34)
    I guess my problem might be that cookies is not enabled but I can't solve it.
    My web.xml is :
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app>
    <servlet>
    <servlet-name>pk</servlet-name>
    <servlet-class>calender.pk</servlet-class>
    <init-param>
    <param-name>Cookies</param-name>
    <param-value>True</param-value>
    </init-param>
    </servlet>
    <servlet-mapping>
    <servlet-name>pk</servlet-name>
    <url-pattern>/pk</url-pattern>
    </servlet-mapping>
    </web-app>

    Here is my code. The problem occurs when deplying onto tomcat4.1.10. When running servlet from DevelopmentEnvironment(JBuilder5) everything works fine.
    package calender;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    public class pk extends HttpServlet {
    private static final String CONTENT_TYPE = "text/html";
    private static final String STARTPAGE = "startpage";
    private static final String LOGIN = "login";
    private static final String CHECK = "check";
    private static final String USERNAME = "username";
    private static final String WELCOME = "welcome";
    private String welcome = "false";
    int responseCode;
    public void init() throws ServletException {
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    //Debugger.debug("get start");
    response.setContentType(CONTENT_TYPE);
    PrintWriter out = response.getWriter();
    String function = request.getParameter("function");
    Cookie cookies[] = request.getCookies();
    String username = "";
    Actionhandler handler = new Actionhandler();
    for(int i=0;i<cookies.length;i++){
    Debugger.debug("cookieloop i get");
    if(cookies.getName().equals("welcome")){
    welcome = cookies[i].getValue();
    }else if(cookies[i].getName().equals("username")){
    username =cookies[i].getValue();
    if(welcome.equals("true") && username != null && username != ""){
    if(function != null){
    if(function.equals("add_worker_to_happening") ||
    function.equals("remove_all_workers_from_happening")||
    function.equals("change_to_status_ready")){
    handler.setHc_id(Integer.parseInt(request.getParameter("hc_id")));
    }else if(function.equals("remove_worker_from_happening")){
    handler.setWh_id(Integer.parseInt(request.getParameter("wh_id")));
    }else if(function.equals("remove_happening")){
    handler.setH_id(Integer.parseInt(request.getParameter("h_id")));
    responseCode = handler.getPage(request, response, username, function);
    }else{
    responseCode = handler.getPage(request, response, username, STARTPAGE);
    }else{
    responseCode = handler.getPage(request, response, username, LOGIN);
    if(handler.getHTML() == null){
    handler.getResponse().getWriter().write("no output");
    else handler.getResponse().getWriter().write(handler.getHTML());

  • Portlet Preferences to no logged users

    Hi people,
    I created a JSR168 Portlet with view and edit mode. I put into my webcenter custom application. I go to edit mode to set some preferences from portlet, to do this I need be logged in.
    The problemn is that just logged users can view the preferences that I set. If I logged off I can't saw any preferences.
    I tried use edit_defaults mode, but don't work fine.
    Can someone help me please?

    Hey sorry for the delay but here it goes :)
    Think you should get enough information by this example to complete what you want, else just ask :)
    So first of all you will need to add a parameter definition to the oracle-portlet.xml
    THis is what you should add after the portlet-name in the oracle-portlet.xml:
    <navigation-parameters>
                <name>param1</name>
                <type xmlns:xsd="http://www.w3.org/2001/XMLSchema">xsd:string</type>
                <label xml:lang="en-US">First Parameter</label>
                <hint xml:lang="en-US"/>
            </navigation-parameters>Normaly you shouldn't do anything extra in order to show those parameters and store them. Everything from here is managed by your consuming application. Notice here that the consuming can only be of the webcenter kind so a custom webcenter application or webcenter spaces due to the oracle specific implementation of the parameters. This gets standardized by the JSR286 but webcenter doesn't support this yet...
    Also notice that when you change something to the oracle-portlet.xml or portlet.xml you should refresh the registration in your consuming application AND remove the old portlet from your page and replace it by a new one. Otherwhise you will not see the new parameter.
    So when you added this to the oracle-portlet.xml and refresh the registration you should see the parameter in the portlet parameter tab when you click the pencil on the portlet in edit mode. Note that you should have customize rights in order to do this.
    Parameters that you set their are not stored for the user, they are application wide stored so if for example admin1 sets a value and admin2 changes it to another value, the last value will overwrite the first one.
    The next thing you should need to know is how to get the parameter from your code.
    This is queiet easy... THe PortletRequest has the getParameter function that will return the value:
    in your backing bean you can write this:
            String param = "";
            PortletRequest request = (PortletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
            param = request.getParameter("param1");
           if(param.equals(""))
               param = "No value for the param has been set yet";
           return param;In fact that's all you need to know for implementing parameters.
    In case something is not clear or you have problems, just ask.

  • Uploading files problem.

    I have got a confusion in uploading files from user machine.
    we use <input type='file' name='fileName'/> tag for that.
    now at server side how we get the file:
    request.getParameter('fileName'); ?
    if yes then:
    but getParameter function returns a string, and a file data (eg image file) can't represented as a string.
    if no then:
    what function of request object we should use for that purpose.
    Now my second query is I have to get the size of the image, how will I be doing that.
    Please help me in this context.
    Thanks in advance for any help.

    Hello,
    Uploading file is a special request of HTTP.
    You have to handle the request a different way.
    Check on the JSP / Servlet forum for more information.
    Regards,
    Sebastien Degardin

  • Blank chatShell window in Firefox + Chrome Intermittent Login

    I get a blank window for:
    /iwc_static/layout/chatShell.html?lang=en
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    <head>
         <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
         <!-- Mimic Internet Explorer 7 -->
         <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" >
         <title>chatShell</title>
         <style type="text/css">
              @import "../js/dojotoolkit/dojo/resources/dojo.css?14.01_234924";
              @import "../js/dojotoolkit/dijit/themes/tundra/tundra.css?14.01_234924";
              @import "../js/dojotoolkit/dijit/themes/dijit.css?14.01_234924";
         </style>
         <link rel="stylesheet" href="css/main.css?14.01_234924" type="text/css">
         <link rel="stylesheet" href="themes/default/default.css?14.01_234924" type="text/css">
         <link rel="stylesheet" href="themes/default/im/main.css?14.01_234924" type="text/css">
         <link rel="stylesheet" href="themes/default/im/blue_on_green.css?14.01_234924" type="text/css">
         <!-- IE Conditional Statements -->
                   <!--[if IE 6]>
                   <link rel="stylesheet" href="css/ie6.css?14.01_234924" type="text/css">
                   <link rel="stylesheet" href="themes/default/im/mainIE6.css?14.01_234924" type="text/css">
                   <link rel="stylesheet" href="themes/default/im/blue_on_greenIE6.css?14.01_234924" type="text/css">          
                   <![endif]-->
         <!-- IE Conditional Statements -->
                   <!--[if IE 7]>
                   <link rel="stylesheet" href="css/ie7.css?14.01_234924" type="text/css">          
                   <![endif]-->
         <script type="text/javascript">
              var iwc = {};
              var djConfig = {};
              (function() {
              var getParameter = function(paramName) {
                   paramName += "="
                   var queryString = window.location.search;
                   var strBegin = queryString.indexOf(paramName);
                   if (strBegin==-1){
                        strBegin = queryString.length;
                   } else {
                        strBegin += paramName.length;
                   var strEnd = queryString.indexOf("&",strBegin);
                   if (strEnd==-1){
                        strEnd = queryString.length;
                   return queryString.substring(strBegin,strEnd);
              var locale = getParameter("lang");
              if (locale.length > 0){
                   djConfig.locale = locale.toLowerCase();
         </script>
         <script type="text/javascript" src="../js/dojotoolkit/dojo/dojo.js?14.01_234924"></script>
         <script type="text/javascript">
              dojo.registerModulePath("iwc", "../../iwc");
              dojo.require("iwc.base");
              dojo.requireLocalization("iwc.i18n","resources");
              iwc.l10n = dojo.i18n.getLocalization("iwc.i18n", "resources");
              var parent_iwc = window.opener.iwc;
              iwc.userPrefs = window.opener.iwc.userPrefs;
              dojo.require("iwc.widget.IMDialog");
         </script>
         <script type="text/javascript" charset="utf-8">
              var imDialog = null;
              dojo.addOnLoad(function() {
                   // we should not use the default, but the users prefered
                   iwc.api.loadTheme(parent_iwc.userPrefs.general.theme);
                   // create the banner and quickActions widget
                   var container = dojo.byId("chatContainer");
                   var dialog = new iwc.widget.IMDialog({}, container);
                   //dialog.addSession("Foo", null, null, {contact: {name: "Blort"}});
                   imDialog = dialog;
                   console.log("onLoad");
                   /*if(iwc.widget.initialIMMessage) {
                        var initialMsg = iwc.widget.initialIMMessage;
                        console.log("initialIMMessage", initialMsg);
                        iwc.widget.initialIMMessage = {};
                        imDialog.selectSession(initialMsg.sessionName, initialMsg.message, initialMsg.presence, initialMsg.contact);
                   parent_iwc.widget.IMChatManager.onWindowLoaded(window.name);
              dojo.addOnUnload(function(){
                   imDialog.destroy();
                   parent_iwc.widget.IMChatManager.onWindowClose(window.name);
              function selectSession(contact, message, presence){
                   imDialog.selectSession(contact, message, presence);
              function presenceUpdate(newState) {
                   if(imDialog) {
                        imDialog.onContactStateChange(newState);
              function sendIMMessage(chatWith, message){
                   parent_iwc.widget.sendIMMessage(chatWith, message);
              function receiveMessage(contact, message, presence) {
                   console.log("session " , contact, message, presence);
                   imDialog.selectSession(contact, message, presence);
              function initializeMovedSession(contact, presence, json_log, html_log){
                   imDialog.initializeMovedSession(contact, presence, json_log, html_log);
              function populateEditor(contact, contents){
                   imDialog.populateEditor(contact, contents);
              //FIXME copied from api.js until print can be cleaned up to work from another popup
              dojo.provide("iwc.api");
              iwc.api.newPrintMessage = function(id, s) {
                // TODO: get localized print window title
                   var title = escape("Print - " + s);
                   var s =     'print.html?wid='+id+'&type=mail&title=' + title + '&' + djConfig.cacheBust;
                   console.log("newPrintMessage - ", s);
                   window.open(
                        'print.html?wid='+id+'&type=mail&title=' + title + '&' + djConfig.cacheBust,
                        'left=20,top=20,width=500,height=500,menubar=1,resizable=1,scrollbars=1'
              iwc.api.printMessage = function(id) {
                   if (id) {
                        var w = dijit.byId(id);
                        if (w) {
                             return w.printMessage(id);
                   // TODO: localization
                   return "Invalid parameter: widgetID is null!";
         </script>
    </head>
    <body class="tundra iwcIMChat" id="iwcID">
    <div id="chatContainer" style="height:100%;">
    </div>
    </body>
    </html>when trying to send or receive an IM in Firefox - I can see a blue/light blue background image - but that's it (I tried clearing everything - cache for all time, restart, etc.)
    Also - the Chrome browser only is able to login intermittently - takes a few tries to get in - seems to stumble somewhere - perhaps on one particular authorization Convergence performs - or maybe it is sending requests too fast?
    Thanks,
    s7

    shjorth wrote:
    starman7 wrote:
    when trying to send or receive an IM in Firefox - I can see a blue/light blue background image - but that's it (I tried clearing everything - cache for all time, restart, etc.)Which exact version of Firefox and which client operating system?Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.9) Gecko/20100315 Firefox/3.5.9
    OS X - 10.5.8
    >
    Do you see this behaviour on other systems running Firefox with the same user?No. But it is running FF 3.6.8 - I will upgrade on the troubled system.
    -- upgraded - problem is still there.
    -- i disabled ad block plus (running w/ default filters only) and that was the problem - it works now.
    >
    Have you tried installing the firebug plugin and seeing if there are any javascript errors that may explain the behaviour?Yes - I don't see any.
    >
    Also - the Chrome browser only is able to login intermittently - takes a few tries to get in - seems to stumble somewhere - perhaps on one particular authorization Convergence performs - or maybe it is sending requests too fast?Chrome isn't a supported browser. There is an existing RFE to have it added:
    RFE #6940556 - "support for Google Chrome browser"
    The behaviour you have mentioned is a known issue and a workaround has been implemented in Convergence 2 however Chrome still remains unsupported in this release.
    If you want Chrome to be supported I suggest you raise the above RFE with the Sun/Oracle account manager.Is Convergence 2 part of Comms Suite 7 update 1?
    Thanks,
    Bill
    >
    Regards,
    Shane.Edited by: starman7 on Aug 19, 2010 3:08 PM
    Edited by: starman7 on Aug 19, 2010 3:09 PM

  • Hidden Input help!

    I'm trying to use hidden input fields in an HTML form in order to save information when the HTML form comes back to the server. However, I don't know how to read in the values that I wrote out in the HTML form.
    When I look at the HTML source code (once it is written out), I can see the hidden input fields and values. However, I can't read them in using the Request.getParameter() function.
    How do I read in hidden input values?
    Thanks!

    Can the getParameter() function only be called using JSP? I really want the HTML form to return to the servlet and have the servlet read the hidden field. I could add the line into the HTML form, but then how to I read the variable I assigned it to once it gets back to the servlet?
    I tried using a similar line of code in the servlet, and all it returned was a null, indicating that it couldn't find my hidden field.
    Thanks!

  • GetParameter not working in my function?

    hi ! I have this function but seems that the getparameter in not working and least its not catching anything.
    public void facturando(HttpServletRequest request,HttpServletResponse response){
          try{
      HttpSession sesion = request.getSession(true);    
      HashMap respuesta = null;
      RequestDispatcher dispatcher = null; 
      String sDNI=null;
      BeanBDFactura bBDFac = null;
      bBDFac = new BeanBDFactura();
      System.out.println("ESTOY facturando");
           String nombre=request.getParameter("nombre"); //en realidad es nombre + apellido
           String fecha=request.getParameter("fecha");
           double totalservicios=Double.parseDouble(request.getParameter("servicios"));
           int descuento=Integer.parseInt(request.getParameter("descuento"));
           double IVA=Double.parseDouble(request.getParameter("IVA"));
           double total=Double.parseDouble(request.getParameter("total"));
           System.out.println("Datos de registrar la factura");
           System.out.println("Nombre: "+nombre);       
           System.out.println("Fecha: "+fecha);
           System.out.println("Servicios: " +totalservicios);
           System.out.println("IVA: " +IVA);
           System.out.println("Total: " +total);
           bBDFac.registrafactura(nombre,sDNI,fecha,totalservicios,descuento,IVA,total);
           RequestDispatcher rd=getServletContext().getRequestDispatcher("/exito.jsp");
           rd.forward(request,response);
         catch(Throwable theException)
      }When I execute this I get a blank page and it stops before the
    System.out.println("Datos de registrar la factura");
    So its a problem with getparameter. What could be causing it ?
    Thanks!

    With problems like this you have to query even your base assumptions.
    request.getParameter() is returning null.
    There could be any number of reasons for this - no parameters passed, parameter mis-spelled etc etc
    So back to basics
    1 - in your servlet print out all the parameters and their values
      Map params = request.getParameterMap();
      for(Iterator it = params.entrySet().iterator(); it.hasNext(); ){
        Map.Entry me = (Map.Entry)it.next();
        String param = (String)me.getKey();
        String[] values = (String[]) me.getValue();
        System.out.println(param + " = " + values[0]);
      }That will show you all the parameters getting to your servlet.
    If there are no parameters, check how you are invoking the servlet. Via a url or a form submission?
    If there ARE parameters, is the one you want there? Is it misspelled?
    Its not working, so something, somewhere is wrong.
    This is the first step in finding out.

Maybe you are looking for

  • How do I add GIF animations?

    I made a simple animation in photoshop, what file format do I put it in if I want to use it on my iWeb site? GIF is not an option. Also I don't know what to do once the file is made, do I just drag it in there? any help would be great.

  • Is there a way to publish a high-res .ipa from Flash CS5.5 with AIR for iOS?

    Hello, I've developed an app for iOS in Flash specifically for iPad 3's. My client uses SOTI MobiControl as it's mobile device management solution. If I publish out of Flash using AIR SDK 3.1 or newer the app is created and looks high-res on the iPad

  • Can't install iTunes 10.7 on Windows XP with SP 3

    I have tried installing iTunes 10.7 and get a error due to a problem with the windows installer package. I have run WindowsXP-KB942288-v3-x86.exe, and rebooted, but I still have the same problem. I had the same problem with the previous version of iT

  • Ipod view RAW photos?

    Hi there, everyone. Just wondering if the ipod and itunes is able to view RAW files? I shoot all RAW these days and I'd still love to take my photos with me on my ipod. Before I could do this with my jpeg photos, just by pointing my pictures folder.

  • System information when looking for storage info, also finder crashes

    Can anyone help please! My Finder crashes when doing simple tasks.  Also, when loking for storage info in system info it crashes.  All other system info works ok!  Many thanks!  New Mountain Lion Installed, problems since then!