Hiii,
I want to send an object as
applet param from my
jsp page which embeds the applet.and how do i receive the object inside the applet class.
This is my code :
my
servlet snippet
byte[] unsignedbytearray=new FiletoByteArray().receiveObject(filename);
req.setAttribute("fileobject",unsignedbytearray);
RequestDispatcher view=req.getRequestDispatcher("showapplet.jsp");
view.forward(req, res);
showapplet..jsp (which has embedded an applet )
<%@ page language="java" %>
<%
byte[] bytearray=(byte[])request.getAttribute("fileobject");//byte array received from some servlet view
System.out.println("array object received Size is "+bytearray.length); //this gives correct output : "array object received Size is 1787264"
%>
<html>
<head>
<title>FileNameSaved</title>
</head>
<body>
<jsp:plugin type="applet" code="demoapplication.ControlFrame.class"
width="700" height="550" codebase="context" archive="file.jar,itextpdf-5.2.1.jar,bctsp-jdk16-1.46.jar,bcprov-jdk16-1.46.jar">
<jsp:params>
<jsp:param name="file" value="<%=bytearray.toString()%>" />
</jsp:params>
<jsp:fallback>
<p>Unable to load applet</p>
</jsp:fallback>
</jsp:plugin>
</body>
</html>
my Controlframe.class snippet receiving the param
try {
String unsignedPdf=getParameter("file");
System.out.println("received at applet size: "+unsignedPdf.length()); //This Gives strange output :received at applet size:10
}
Can jsp send an object as param??