Paging Problem in JSP using request.
Dear Friends,
I have an issue in JSP paging using request. In my action servelet my code is set as follows.
request.setAttribute("clients", clients);
In JSP I have
<%ClientDataBean[] clients = (ClientDataBean[]) request.getAttribute("clients");
If I navigate to another page it becomes null. I could make through session. If there any way to handle request param while navigating between pages.
Thanks,
public class PagingBean{
private int pageSize;
private int pagePointer;
private int pages;
private int startPage;
private int lastPage;
private List dataList;
private List resultantList;
//respective getters and setters
// write getResultantList() method in such a way that it gives the resultantList which is to be displayed as per persisted values of all other properties in Bean and use it for displaying on your view.
}write your backing bean / Action Class to manage the respective persisted values according to the actions done.
Or if you are not intrested in re-inventing the wheel please go ahead and use custom built solutions.
please google for finding such.
could startup with the one below
http://java-source.net/open-source/jsp-tag-libraries
REGARDS,
RaHuL
Similar Messages
-
Problem with JSP using bean packaged in jar file
Hi,
I am trying to use a java bean in a jsp file. The java bean is packaged
into a jar file. I am getting class not found compilation error. If the
bean remains to be a seperated class file, everything work well.
Does anyone know how I can use bean in a jar file within jsp , i.e. to
allow the bean to be found during compilation ?
Thanks,
Terence.
[email protected]
Jacek,
Thanks for replying.
My JSP's are just files in my document root . However, I found a solution to
my
problem. That is to have the jar file defined in my weblogic.class.path. I may
have missed some files in my original jar file which causes my problem.
Mayby I should package everything into a web application for deployment. That
will be my next step.
Thanks anyway.
Terence.
Jacek Laskowski wrote:
> Terence Lai wrote:
> >
> > Hi,
> >
> > I am trying to use a java bean in a jsp file. The java bean is packaged
> > into a jar file. I am getting class not found compilation error. If the
> > bean remains to be a seperated class file, everything work well.
>
> How do you use the JSP file ? Is it a part of web application ? If so,
> the bean jar package should be located in WEB-INF/lib directory. It's
> also recommended to put the bean class into a package, so it's not in
> 'unnamed' package, and <jsp:useBean> can find it.
>
> >
> > Does anyone know how I can use bean in a jar file within jsp , i.e. to
> > allow the bean to be found during compilation ?
>
> see above.
>
> > Terence.
>
> Jacek Laskowski
> HP Consulting
-
Just 3 jsp's. The first page is the basic form that posts to the results.jsp page. The problem is in the results.jsp page. I get the first 20 like I want, but after I click next. I get "exhausted resultset". I don't know what that means exactly. I checked to see how many results I get back, and its 444. I would appreciate any help.
I also need to sort the results by column name in the jsp later, but this is my immediate need.
results.jsp
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ page import="java.sql.*" %>
<%@ page import="db.DB" %>
<%
int currentRow = 1;
if(request.getParameter("currentRow") != null)
currentRow = Integer.parseInt(request.getParameter("currentRow"));
int skipRows = 20;
System.out.println("Current currentRow: " + currentRow);
String action = "";
if(request.getParameter("action") != null)
action = request.getParameter("action");
if ( action.equals("Next Record") )
currentRow += skipRows;
if ( action.equals("Previous Record") )
currentRow -= skipRows;
%>
<HTML>
<HEAD>
<TITLE>Bidder Results </TITLE>
</HEAD>
<BODY>
<H1>Bidder Results </H1>
<FORM ACTION="resultsjsp" METHOD="POST">
<%
String category =request.getParameter("category");
DB db = new DB();
Connection conn = null;
Statement st = null;
ResultSet rs = null;
conn = db.getConnection();
String query1 = "SELECT BDR_NUM, BDR_NME, BDR_CITY, BDR_ST, BDR_BUS_CAT1 FROM T01_MINOR " +
"WHERE trim(BDR_BUS_CAT1) = '" + category + "'" + "ORDER BY BDR_NME";
st = conn.createStatement(rs.TYPE_SCROLL_INSENSITIVE,
rs.CONCUR_READ_ONLY);
rs = st.executeQuery(query1);
rs.last();
int totalrows = rs.getRow();
System.out.println("Total Rows = " + totalrows );
if ( currentRow >= totalrows )
currentRow = totalrows-skipRows;
if ( currentRow < 0 )
currentRow = 0;
if ( currentRow != 0 )
rs.absolute(currentRow);
%>
<TABLE BORDER="1" WIDTH="90%">
<TR>
<TH>Bidder Name</TH>
<TH>City</th>
<TH>State</th>
<TH>Category</TH>
</TR>
<%
int i=0;
int count=0;
boolean next = false;
do{
i++;
%>
<TR>
<TD><a href="details.jsp?bidder_id=<%= rs.getString("BDR_NUM") %>"><%= rs.getString("BDR_NME") %></A></TD>
<TD><%= rs.getString("BDR_CITY") %></TD>
<TD><%= rs.getString("BDR_ST") %></TD>
<TD><%= rs.getString("BDR_BUS_CAT1") %></TD>
</TR>
<%
while((next=rs.next()) && i<skipRows);
count++;
System.out.println("Count: " + count);
%>
</TABLE>
<BR>
<INPUT TYPE="HIDDEN" NAME="currentRow" VALUE="<%=currentRow%>">
<INPUT TYPE="HIDDEN" NAME="action" VALUE="next">
<%
if(next)
%>
<INPUT TYPE="SUBMIT" NAME="action" VALUE="Next Record">
<%
if(currentRow > 0)
%>
<INPUT TYPE="SUBMIT" NAME="action" VALUE="Previous Record">
<%
%>
</FORM>
</BODY>
</HTML><< http://www.fawcette.com/javapro/2002_06/online/servlets_06_11_02/
Yarmark. I totally agree with you, but my boss who is not a programmer wanted this up yesterday. Also, I do not know taglibs, struts, etc... Right now I only know this way of programming. Now, I plan on taking some struts classes, and may JSF, but I am stuck with writing code that I sort of already know how to write. This is temporary anyway. This is just a little demo for my boss's bosses. He just wants to show them the functionality of it. I can revisit it afterward to make it better. If this demo looks good for my boss, then it looks good for me. -
The deployment problem in JSP using JavaBean
Hi there,
I followed the descriptions in Writing Enterprise Applications with
Java 2 SDK, Enterprise Edition tutorial to build a set of programs to run JSP with JavaBean, and I also followed the steps in creating new WAR file, but some how it wouldn't work after I deployed them. I run the JSP in IE and got a message like this:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 20 in the jsp file: /1bonus.jsp
Generated servlet error:
c:\j2sdkee1.3.1\repository\orbit\web\JSPRoot\$1bonus$jsp.java:63: Class org.apache.jsp.JBonusBean not found.
JBonusBean jbonus = null;
^
I used the deploytool to create the WAR file, and after I added the 1bonus.jsp, I also added JBonusBean into the WAR file. I found 1bonus.jsp was added into the WAR file, but there's no JBonusBean appeared under the WAR file.
Could you please tell me is there anything wrong?
Thanks for your time.
Regards,
EricI think you have not imported 'BonusBean' in your jsp. Code this line in your jsp at the top.
<%@page import="BonusBean" %>
Sudha -
Paging problem in jsp with resultset
Could you please take a look at this post.
http://forum.java.sun.com/thread.jspa?threadID=632626&tstart=10public class PagingBean{
private int pageSize;
private int pagePointer;
private int pages;
private int startPage;
private int lastPage;
private List dataList;
private List resultantList;
//respective getters and setters
// write getResultantList() method in such a way that it gives the resultantList which is to be displayed as per persisted values of all other properties in Bean and use it for displaying on your view.
}write your backing bean / Action Class to manage the respective persisted values according to the actions done.
Or if you are not intrested in re-inventing the wheel please go ahead and use custom built solutions.
please google for finding such.
could startup with the one below
http://java-source.net/open-source/jsp-tag-libraries
REGARDS,
RaHuL -
Problems with JSP - using tag library with Weblogic 8.1
I am getting the following error when I try to run a web application called "regain":
/searchinput.jsp(2): Error in using tag library uri='regain-search.tld' prefix='search': cannot find tag class: 'net.sf.regain.ui.server.taglib.MsgTag'
probably occurred due to an error in /searchinput.jsp line 2:
<%@taglib uri="regain-search.tld" prefix="search" %>
The classes that the .tld file points to are in the web applications WEB-INF/classes directory and I have put this path into my classpath environment variable (running Windows 2000 Server).
This application runs fine on Tomcat.
I can't not figure out whether is error is masking another error or what. I've tried using JDK and Jrockit for my web app - no luck.
Please help! Thanks!anyone? :/
-
Problems compiling jsps using WLS6.1sp3 as Win2k service
Two related issues:
Issue #1:
I'm encountering an error where the javac compiler cannot be found (when
trying to compile jsps) when running as a Windows Service. JAVA_HOME is set
in the profile and I'm passing in E:\bea\jdk131\bin in the extrapath
parameter of beasvc.exe. The error I get is a file permission exception -
unable to access (read) C:\WINNT\System32\javac. Question is - why is it
looking there and not in JAVA_HOME? To try and isolate this, I've removed
everything from the PATH and CLASSPATH environment variables except for
E:\bea\jdk131\bin but to no avail.
Issue #2:
I've also tried hard-coding the location E:\bea\jdk131\bin\javac.exe into
the config.xml and weblogic.xml. The error is then a file permission
exception - unable to access (read) .\E:\bea\jdk131\bin\javac. Note the
initial dot-slash... however, the weblogic.policy file is set to allow
read,execute access for all files and directories below E:\bea (I've even
tried to grant a permission to .\E:\....... but that didn't work either)
Hope someone can help - it's been driving me nuts for a week now! What do I
need to do to get Weblogic to find javac when running as a Windows Service?Hi Sudha
Plese see the error in the starting post. Do u agree with me now? The server is looking for org.apache.jsp.techSupport_jsp class.
Generated servlet error:
[javac] Compiling 1 source file
D:\MANTRA\jboss-3.0.4_tomcat-4.1.12\tomcat-4.1.x\work\M
inEngine\localhost\JSPTechSupport\techSupport_jsp.java:
2: cannot resolve symbol
symbol : class TechSupportBean
location: class org.apache.jsp.techSupport_jsp
TechSupportBean techSupportBean = null;
^
An error occurred at line: 2 in the jsp file:
/techSupport.jsp
Generated servlet error:
D:\MANTRA\jboss-3.0.4_tomcat-4.1.12\tomcat-4.1.x\work\M
inEngine\localhost\JSPTechSupport\techSupport_jsp.java:
4: cannot resolve symbol
symbol : class TechSupportBean
location: class org.apache.jsp.techSupport_jsp
techSupportBean = (TechSupportBean)
rtBean) pageContext.getAttribute("techSupportBean",
PageContext.APPLICATION_SCOPE);
^Take care.
Hafizur Rahman
SCJP -
Unable to use Request Dispatcher; Duke $ Post;
I am using a Controller Servlet to transfer control to a JSP using Request Dispatcher within doPost()
RequestDispatcher rd;
rd=req.getRequestDispatcher(URL);
rd.forward(req,resp);
I am seting a request object
req.setAttribute("XXX",obj.func());
prior to the Redirect;
The page gets redirected to a JSP. I am unable to access req object in there.
if i use
String XXX = req.getAttribute("XXX");
i get an error in the jsp as
"req cannot be resolved"
Do i need to import some directives? Please ReplyThe page gets redirected to a JSP. I am unable to
access req object in there.
if i use
String XXX = req.getAttribute("XXX");
i get an error in the jsp as
"req cannot be resolved"
Do i need to import some directives? Please ReplyThat's simple. Your req (which is the HttpServletRequest object) in the servlet becomes request in the JSP. That's always there. The compiler would not recognize req
Use request.getAttribute("XXX"); in JSP
Regards
***Annie*** -
Unable get complete filepath from jsp page using request.getParameter()
Hey all,
i am actually trying to get the selected file path value using request.getParameter into the servlet where i will read the (csv or txt) file but i dont get the full path but only the file name(test.txt) not the complete path(C:\\Temp\\test.txt) i selected in JSP page using browse file.
Output :
FILE NAME : TEST
FILE PATH : test.txt
Error : java.io.FileNotFoundException: test.txt (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at java.io.FileReader.<init>(FileReader.java:55)
at com.test.TestServlet.processRequest(TestServlet.java:39)
at com.test.TestServlet.doPost(TestServlet.java:75)
JSP CODE:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>DEMO SERVLET</title>
</script>
</head>
<body>
<h2>Hello World!</h2>
<form name="myform" action="TestServlet" method="POST"
FILE NAME : <input type="text" name="filename" value="" size="25" /><br><br>
FILE SELECT : <input type="file" name="myfile" value="" width="25" /><br><br>
<input type="submit" value="Submit" name="submit" />
</form>
</body>
</html>
Servlet Code :
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, FileNotFoundException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
String filename = request.getParameter("filename");
out.println(filename);
String filepath = request.getParameter("myfile");
out.println(filepath);
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet TestServlet</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet TestServlet at " + request.getContextPath() + "</h1>");
if (filepath != null) {
File f = new File(filepath);
BufferedReader br = new BufferedReader(new FileReader(f));
String strLine;
String[] tokens;
while ((strLine = br.readLine()) != null) {
tokens = strLine.split(",");
for (int i = 0; i < tokens.length; i++) {
out.println("<h1>Servlet TestServlet at " + tokens[i] + "</h1>");
out.println("----------------");
out.println("</body>");
out.println("</html>");
} finally {
out.close();
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
Needed Output :
FILE NAME : TEST
FILE PATH : C:\\Temp\\test.txt
Any suggestions Plz??As the [HTML specification|http://www.w3.org/TR/html401/interact/forms.html] states, you should be setting the enctype to multipart/form-data to be able to upload files to the server. In the server side, you need to process the multipart/form-data binary stream by parsing the HttpServletRequest#getInputStream(). It is a lot of work to get it to work flawlessly. There are 3rd party API's around which can do that for you, such as [Apache Commons FileUpload|http://commons.apache.org/fileupload] (carefully read the User Guide how to use it).
You can also consider to use a Filter which makes use of the FileUpload API to preprocess the request so that you can continue writing the servlet code as usual. Here is an example: [http://balusc.blogspot.com/2007/11/multipartfilter.html]. -
Problem in Getting host name by using request.getHostName() on solaris 9
Hi there,
I'm trying to get the machine name of the system from which the request was initiated by using request.getHostName() on Solaris 9 but it is giving me the IP Address of the machine which har sent the request to the server and the same thing is running on Windows and AIX platform. Can anyone tell me any solution to this problem.
Thanks in advance.
Nitin JainHi Nitin,
Following is the specification for getRemoteHost()
"Returns the fully qualified name of the client that sent the request, or the IP address of the client if the name cannot be determined. For HTTP servlets, same as the value of the CGI variable REMOTE_HOST." I think the same would be true for getHostName().....
So, this can be one possiblity why ur given IP. -
Problem loading resources file in JSP using f:loadBundle
Hi,
We are facing problem while loading our properties file in JSP using f:loadBundle.we tried the following way
<f:loadBundle basename="resources.ApplicationResource" var="msg"/>
This properties file is src java folder and also in WEB-INF-->classes->resources folder
but even then its not able to load.I made an entry in the faces-config for message-bundle. But of no use.
Any pointers would be of great help.does your file calls
ApplicationResource.properties ?
If so is it in
the package resources ? -
Paging in JSP using SQL SERVER 2000
Hi!!
How to do paging in JSP using SQL SERVER 2000.
In my SQL we can fire query like
ResultSet resultado = declaracao.executeQuery("Select * from tbl_livro limit 20,5 ");
It means that it fetches 20 onwards 5 records..
how to do same thing in SQL SERVER 2000 please help it's pretty urgenthere is the link for paging, what i already post reg this topic
http://forum.java.sun.com/thread.jspa?threadID=5194183try to avoid multipost next time -
Hi!!
How to do paging in JSP using SQL SERVER 2000.
In my SQL we can fire query like
ResultSet resultado = declaracao.executeQuery("Select * from tbl_livro limit 20,5 ");
It means that it fetches 20 onwards 5 records..
how to do same thing in SQL SERVER 2000 please help it's pretty urgenthttp://forum.java.sun.com/thread.jspa?threadID=5194183
-
Problem while sending/Receiving request using the HttpURLConnection obj
Hi,
We are facing the problem while passing the request in Weblogic.
Looks like there is some problem with Weblogic while sending/Receiving the request using the HttpURLConnection object.
Currently we are migrating 2 applications to WebLogic. Application1 to application2 request should pass.
Below is some example we tried:
"When we send a request to our code using the SSOAdaptor code (which handles the request/session in our application) which is on the SunOne server the request parameters are received by our code successfully. And also in Create User Functionality of application1 we are sending a request to webpass(which is on Sunone Server) using the HttpURLConnection object and the SOAP request is received successfully by the Webpass."
Looks like when we send request (using HttpURLConnection) from a server other than Weblogic to a servlet in a Weblogic the request parameters are received with out issues.
Where as when the request is sent from WebLogic to WebLogic the request parameters are missing some how.
Is there any issue in Weblogic? Please helpus on this.
Thanks,
Nagesh
Edited by: user9307541 on Mar 15, 2010 5:08 AMHi,
Please find below scenario for testing.
We have tested the SSOAdaptor code (it is the fucntion name which will send the data from source) locally by hittiing the WPS adaptor URL in a Java client program(TestRequest.java) and the request parameters were reaching the WPS Adapter successfully.
Then we have written two test servlets to test the communication between SSOAdaptor(TestServlet.java) and WPS adaptor(WPSServlet.java).
Functionality of TestSevlet: It is sending a request to WPSServelt similar to the way we are doing it in SSOAdaptor.
Functionality of WPSServlet: It will receive the request parameters and write the parameter Map to console.
We have deployed and these two servlets(in a single webapplication) on Tomcat server and the request parameters are reaching the WPSServlet successfully.
Output on Tomcat server:
before sending request
**********************Inside WPS Servlet -- the request Map is:{TypeAcc=[Ljava.lang.String;@14e3f41, ServiceName=[Ljava.lang.String;@1acd47, GMEPortalUserID=[Ljava.lang.String;@19b04e2, UserID=[Ljava.lang.String;@5dcec6, Country=[Ljava.lang.String;@b25b9d}
after sending request
After this we have deployed these two servlets (with in a single webapplication) on the Weblogic server in Dev machine(path: /apps/usmport/domains/usmport/servers/usmport_admin/upload/ssoAdaptor/WEB-INF/classes/com/gm/gmeportal/security/adaptor) and
now the request parameters are not reaching the WPSServlet.
Output on Weblogic Server:
before sending request
**********************Inside WPS Servlet -- the request Map is:{}
after sending request
Looks like there is some problem with Weblogic while sending/Receiving the request using the HttpURLConnection object.
When we send a request to WPSAdaptor using the Old SSOAdaptor code which is on the SunOne server the request parameters are received by WPS successfully. And also in Create User Functionality of Portal we are sending a request to webpass(which is on Sunone Server) using the HttpURLConnection object and the SOAP request is received successfully by the Webpass.
Looks like when we send request (using HttpURLConnection) from a server other than Weblogic to a servlet in a Weblogic the request parameters are received with out issues. Where as when the request is sent from weblogic to weblogic the request parameters are missing some how.
Please find below javs source code used to test this:
TestRequest.java
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
public class TestRequest {
* @param args
public static void main(String[] args) throws Exception{
// TODO Auto-generated method stub
excutePost("http://localhost:8080/Testing/TestServlet", "GMEPortalUserID=captest.wss@it0555&UserID=bl1133&Country=it&TypeAcc=256&ServiceName=Logon");
//System.out.println("********** Now the request is from SSO *****************");
//excuteGet("http://10.156.0.173:7013/channel21/wpsadapter", "GMEPortalUserID=captest.wss@it0554&UserID=bl1133&Country=it&TypeAcc=256&ServiceName=Logon");
public static String excutePost(String targetURL, String urlParameters)
URL url;
HttpURLConnection connection = null;
try {
//Create connection
url = new URL(targetURL);
connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded");
connection.setRequestProperty("Content-Length", "" +
Integer.toString(urlParameters.getBytes().length));
connection.setRequestProperty("Content-Language", "en-US");
connection.setUseCaches (false);
connection.setDoInput(true);
connection.setDoOutput(true);
//Send request
DataOutputStream wr = new DataOutputStream (
connection.getOutputStream ());
wr.writeBytes (urlParameters);
wr.flush ();
wr.close ();
//Get Response
InputStream is = connection.getInputStream();
BufferedReader rd = new BufferedReader(new InputStreamReader(is));
String line;
StringBuffer response = new StringBuffer();
while((line = rd.readLine()) != null) {
response.append(line);
response.append('\r');
rd.close();
System.out.println("Response is:" + response);
return response.toString();
} catch (Exception e) {
e.printStackTrace();
return null;
} finally {
if(connection != null) {
connection.disconnect();
public static String excuteGet(String targetURL, String urlParameters) throws Exception
URL url = new URL(targetURL);
HttpURLConnection httpurlconnection =
(HttpURLConnection) url.openConnection();
/*httpurlconnection.setRequestProperty(
"cookie",
constructRequestParams(httpservletrequest.getCookies()));*/
httpurlconnection.setDoOutput(true);
httpurlconnection.setDoInput(true);
httpurlconnection.setRequestProperty(
"Content-length",
String.valueOf(urlParameters.length()));
OutputStream outputstream = httpurlconnection.getOutputStream();
outputstream.write(urlParameters.getBytes());
outputstream.flush();
//Get Response
try{
InputStream is = httpurlconnection.getInputStream();
BufferedReader rd = new BufferedReader(new InputStreamReader(is));
String line;
StringBuffer response = new StringBuffer();
while((line = rd.readLine()) != null) {
response.append(line);
response.append('\r');
rd.close();
System.out.println("Response from SSO is:" + response);
return response.toString();
} catch (Exception e) {
e.printStackTrace();
return null;
} finally {
if(httpurlconnection != null) {
httpurlconnection.disconnect();
TestServlet.java
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
* Servlet implementation class TestServlet
public class TestServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
* Default constructor.
public TestServlet() {
// TODO Auto-generated constructor stub
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doPost(request,response);
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
//System.out.println("********************** the request Map is:" + request.getParameterMap());
try {
System.out.println("before sending request");
excuteGet("http://localhost:7003/ssoAdaptor/WPSServlet", "GMEPortalUserID=captest.wss@it0554&UserID=bl1133&Country=it&TypeAcc=256&ServiceName=Logon");
System.out.println("after sending request");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
public String excuteGet(String targetURL, String urlParameters) throws Exception
URL url = new URL(targetURL);
HttpURLConnection httpurlconnection =
(HttpURLConnection) url.openConnection();
/*httpurlconnection.setRequestProperty(
"cookie",
constructRequestParams(httpservletrequest.getCookies()));*/
httpurlconnection.setDoOutput(true);
httpurlconnection.setDoInput(true);
httpurlconnection.setRequestProperty(
"Content-length",
String.valueOf(urlParameters.length()));
OutputStream outputstream = httpurlconnection.getOutputStream();
outputstream.write(urlParameters.getBytes());
outputstream.flush();
//Get Response
try{
InputStream is = httpurlconnection.getInputStream();
BufferedReader rd = new BufferedReader(new InputStreamReader(is));
String line;
StringBuffer response = new StringBuffer();
while((line = rd.readLine()) != null) {
response.append(line);
response.append('\r');
rd.close();
//System.out.println("Response from SSO is:" + response);
return response.toString();
} catch (Exception e) {
e.printStackTrace();
return null;
} finally {
if(httpurlconnection != null) {
httpurlconnection.disconnect();
WPSServlet.java
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
* Servlet implementation class WPSServlet
public class WPSServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
* @see HttpServlet#HttpServlet()
public WPSServlet() {
super();
// TODO Auto-generated constructor stub
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
System.out.println("**********************Inside WPS Servlet -- the request Map is:" + request.getParameterMap());
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request,response);
Thanks,
Nagesh -
Urgent : Data Passing Problem in JSP dynpage using bean in SP11
Hi all
I am trying to pass data from my jspdynpage to jsp using bean , which is not at all passing any values
i am pasting code below which works in 6.0 sp09
I dont know what is happening in sp11
please suggest me in this situation
public static class LeaderStatusOverviewDynPage extends JSPDynPage{
private LeaderStatusBean myBean = null;
public void doInitialization(){
this.ensureBeanisSetup();
public void doProcessAfterInput() throws PageException {
public void doProcessBeforeOutput() throws PageException {
this.setJspName("leaderstatus.jsp");
public void ensureBeanisSetup(){
IPortalComponentRequest request = (IPortalComponentRequest)this.getRequest();
IPortalComponentContext myContext = request.getComponentContext();
//IPortalComponentProfile profile = myContext.getProfile();
Object o = myContext.getValue("myBean");
if(o==null || !(o instanceof LeaderStatusBean)){
myBean = new LeaderStatusBean();
myBean.setMessage("This String From Bean");
myContext.putValue("myBean",myBean);
} else {
myBean = (LeaderStatusBean) o;
My jsp page
<jsp:useBean id="myBean" scope="application" class="bean.LeaderStatusBean" />
<hbj:content id="myContext" >
<hbj:page title="PageTitle">
<hbj:form id="myFormId" >
<% Date today = new Date(); %>
<h1> This is Test page for NOVA Chemicals </h1>
<br><br>
<font color = "blue" size = "4"><center>
<%=today%>
</center>
<br><br> This is the message of Connection :
<%=myBean.getMessage()%>
</font>Hallo Prakash,
I am developing with EP SPS12 and am facing the exact same situation. Values passed to the bean from the dynPage do not get through to the jsp. When removing the respective lines in the portalapps.xml I get a portal runtime exception.
I am posting my portalapps and the jsp where importing the beans. What am I missing here? Any help would be greatly appreaciated! Thank you in advance.
BR
Helga
<?xml version="1.0" encoding="utf-8"?>
<application>
<application-config>
<property name="PrivateSharingReference" value="com.sap.portal.htmlb"/>
</application-config>
<components>
<component name="AdminComponent">
<component-config>
<property name="ClassName" value="com.company.AdminComponent"/>
<property name="SecurityZone" value="com.company.AdminComponent/low_safety"/>
<property name="ComponentType" value="jspnative"/>
<property name="JSP" value="pagelet/AdminComponentView.jsp"/>
</component-config>
</component>
</components>
<services/>
</application>
<jsp:useBean id="dropDownListBean" scope="application" class="com.company.bean.DropDownListBean" />
Maybe you are looking for
-
BAPI_SALESORDER_CREATEFROMDAT2 and Returns, RMA
Hello all. I'm glad to see this forum doing so well. Have any of you used the BAPI_SALESORDER_CREATEFROMDAT2 to create an RMA (returned goods) doc type RE? This is my current task and I'm hitting a wall in my initial tests. I've done plently of wo
-
Put new HD in and now can't get it to boot, please help!
With disk it tells me to select a destination volume but it's blank. Without disk it gives me a ? in a folder. Please help getting really frustrated.
-
___Why does my command/shift space and shift key stop working?
___Why does my command/shift space and shift key stop working? For no apparent reasoon, some key combos like shift to keep aligned or command/shift space to zoom stop working - why is that?
-
K8N DIAMOND...how to connect??
Hi there I am tring to connect the MB in object to my case (ANTEC P160), but I find that the connectors from case to MB are different or, maybe better, I don't understand very well how to plug them in the MB. From the case I have: PW_SW: orange and w
-
SRM SC 'N' step workflow - Approver list wrong approver determined
Hi Team, I am facing a repetetive issue for a SRM shopping cart N-step approval workflow. Issue description: 1. The approver list populated in 'Subworkflow for n-Level Approval SC' step is incorrect. 2. The BADI for N-step determines correct approver