Hello world,
I have got the problem to transfer euro (?) characters correctly from a jsp to the controller servlet. The controller recieves the euro (?) caharcter as a question mark (?). Obvoiusly this forum has got the same problem :-) !!!!!
The jsp has code like following:
<form name="PruefungAnlegen" method="get" action="PruefungServlet" target="_parent">
....
<textarea name="titel" style="width: 750px;" rows="5" maxlength="1000" wrap="VIRTUAL" length="40"><%=pruefung.fehler(pruefung.getTitel())%></textarea></td>...<td width="850" align="center"><input type="hidden" name="pruefungAnlegen" value="anlegen"/>
...
<a href="javascript:document.PruefungAnlegen.submit()" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('PAnlegen','','../../images/<%out.print(login.getLokalisierung("Sprache"));%>/navbuttons/PAnlegenNavP.gif',1)"><img src="../../images/<%out.print(login.getLokalisierung("Sprache"));%>/navbuttons/PAnlegenNav.gif" alt="<%out.print(login.getLokalisierung("Sprache.Button.Pruefung.PruefungAnlegen.Alt"));%>" name="PAnlegen" width="120" height="23" border="0"></a>
Here is the Controller Code.
/** Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
* @param request servlet request * @param response servlet response
*/ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
ServletContext application = getServletContext(); HttpSession session = request.getSession();
String key = null; // Key, which will be saved in the HashMap parameter.
String adresse = "/pruefung/anlegen/prfEinController.jsp?x=y"; //Load all keys and save them in a HashMap for further Steps.
Set s = this.parameter.keySet(); Iterator i = s.iterator();
while(i.hasNext()){
key = (String)i.next();
System.out.println("Key: "+key);
System.out.println("Value: "+request.getParameter(key)); //!!!!!!!!!!!!!!!!!!!!!!!!!!! This Line Shows the ? as a ?!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
this.parameter.put(key, h.stringFiltern(request.getParameter(key), "Pruefung"));
}
key = null;
// Read the HashMap and assemble the target-adress. I know, it could be more sophisticated, but my major problem is five lines above ;-)
i = s.iterator();
while(i.hasNext()){
key = (String)i.next();
adresse = adresse+"&"+key+"="+this.parameter.get(key);
}
// Redirect to another Controller.
RequestDispatcher dispatcher = application.getRequestDispatcher(adresse);
dispatcher.forward(request, response);
}
I would be more than grateful if anyone could help me.
Thanks a lot.
tobias