one way is to package a bean which contains a method which will get or post the
request e.g.
<%@ page contentType="text/html;charset=windows-1252"%>
<jsp:useBean id="axiomclient" scope="application"
class="gov.fmcsa.wribosservice.client.AXIOMClient" />
<html>
<td width="77%"
valign="center"><p><%=axiomclient.CallTheURL(object,request)%>
</p><p> </p></td>
</html>
//sample code
AXIOMClient extends ABunchOfClasses implements ABunchOfInterfaces
{
public static void callTheURL(Object
object,javax.servlet.http.HttpServletRequest request)
{
httpost=httpost_param; //save a local copy
org.apache.http.HttpResponse response_from_post = null;
org.apache.http.client.HttpClient httpclient = new
org.apache.http.impl.client.DefaultHttpClient();
java.lang.String port="8007";
java.lang.String host="localhost";
java.lang.String protocol="http";
java.lang.String response_from_client="null response";
java.lang.String targetEndpoint=new
String("http://localhost:8007/CommInterface2/servlet/Comminterface2Servlet");
//GET
org.apache.http.client.methods.HttpGet httpget = new
org.apache.http.client.methods.HttpGet(targetEndpoint);
try
{
httpget.addHeader("gov.fmcsa.wribosservice.client.WRIBOSServiceStub$SubmitmsgRequest",object.toString());
}
catch(Exception excp)
{
if (debug) System.out.println("AXIOMClient produces Exception produced for
httpget.addHeader(gov.fmcsa.wribosservice.client.WRIBOSServiceStub$SubmitmsgRequest,object.toString())");
}
//POST
String resp=null;
try
{
org.apache.http.HttpHost target = new
org.apache.http.HttpHost("http://localhhost:8007/servlet/Comminterface2Servlet/");
// general setup
org.apache.http.conn.scheme.SchemeRegistry supportedSchemes = new
org.apache.http.conn.scheme.SchemeRegistry();
// Register the "http" protocol scheme, it is required
// by the default operator to look up socket factories.
supportedSchemes.register(new
org.apache.http.conn.scheme.Scheme("http",org.apache.http.conn.scheme.PlainSocketFactory.getSocketFactory(),
8007));
// prepare parameters
org.apache.http.params.HttpParams params = new
org.apache.http.params.BasicHttpParams();
org.apache.http.params.HttpProtocolParams.setVersion(params,
org.apache.http.HttpVersion.HTTP_1_1);
org.apache.http.params.HttpProtocolParams.setContentCharset(params,
"UTF-16");
org.apache.http.params.HttpProtocolParams.setUseExpectContinue(params, true);
org.apache.http.conn.ClientConnectionManager connMgr = new
org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager(params,supportedSchemes);
httpclient = new org.apache.http.impl.client.DefaultHttpClient(connMgr,
params);
httpget = new org.apache.http.client.methods.HttpGet(targetEndpoint);
httpget.addHeader("key",object.toString());
httpost = new
org.apache.http.client.methods.HttpPost("http://localhost:8007/CommInterface2/servlet/Comminterface2Servlet");
//roll thru the params and add in
nvps = new java.util.ArrayList <org.apache.http.NameValuePair>();
nvps.add(new
org.apache.http.message.BasicNameValuePair("submitmsgRequest",
object.toString() ));
httpost.setEntity(new
org.apache.http.client.entity.UrlEncodedFormEntity(nvps, "UTF-8"));
set_httppost(object.toString());
if (debug==true) System.out.println("AXIOMClient !!!!!!!!!!!About to
call the server!!!!!!!!!!!");
response_from_post=httpclient.execute(httpost);
if(response_from_post!=null)
{
//acquire the entity
org.apache.http.HttpEntity entity = response_from_post.getEntity();
//response_client=org.apache.http.util.EntityUtils.toByteArray(entity);
previous_label_str=null;
submitMsgCounter=0;
i=0;
label_ctr=0;
value_ctr=0;
java.util.HashMap<String,String>
returned_hashmap=ReturnBackFormattedList(org.apache.http.util.EntityUtils.toString(entity));
String delimiterToAppend=new String("<br>");
response_from_client =
FormatTheHashMapAndReturnString(returned_hashmap,delimiterToAppend);
}
return response_from_client;
}
HTH
Martin Gainty
______________________________________________
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und
Vertraulichkeitanmerkung/Note de déni et de confidentialité
Ez az üzenet bizalmas. Ha nem ön az akinek szánva volt, akkor kérjük, hogy
jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának készítése
nem megengedett. Ez az üzenet csak ismeret cserét szolgál és semmiféle jogi
alkalmazhatósága sincs. Mivel az electronikus üzenetek könnyen
megváltoztathatóak, ezért minket semmi felelöség nem terhelhet ezen üzenet
tartalma miatt.
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung.
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est
interdite. Ce message sert à l'information seulement et n'aura pas n'importe
quel effet légalement obligatoire. Étant donné que les email peuvent facilement
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité
pour le contenu fourni.
> Date: Sun, 28 Feb 2010 15:26:28 -0800
> From: [email protected]
> Subject: How to pass HTTPRequest between two JSP ?
> To: [email protected]
>
> Hello...
>
> Since a few days I am working with Struts 2. (2.1.6)
> I am facing a big problem with HttpRequest and JSPs.
>
> Well... I have to forward a HTTPRequest from page1.jsp to page2.jsp
>
> So... How can I pass HTTPRequest attribute betwen 2 pages?
>
> Here is a part my web.xml file :
>
> ...
> <filter>
> <filter-name>struts2</filter-name>
> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
> </filter>
> <filter-mapping>
> <filter-name>struts2</filter-name>
> <url-pattern>/*</url-pattern>
> </filter-mapping>
> ...
>
>
> the struts.xml file :
>
> ...
>
> <action name="bnf-detail"
> class="fr.bnf.platon.bnf.actions.ConsultationBnfDetailAction">
> <result name="success">/pages/bnf/administration/detailBnf.jsp</result>
> </action>
>
>
>
> <action name="bnf-detail_modification"
> class="fr.bnf.platon.bnf.actions.ConsultationBnfDetailAction"
> method="modificationSubmit">
> <result name="success">/pages/bnf/administration/detailBnf.jsp</result>
> </action>
> ...
>
> and a part of the action java file (which implementents RequestAware):
>
> public String execute() throws Exception
> {
> request.put("test", 58);
> return SUCCESS;
> }
>
> public String modificationSubmit() throws TechniqueException,
> FonctionnelleException
> {
> request.get("test"); // is null
> editMode = true;
> return SUCCESS;
> }
>
>
>
> So... How can I pass the request attribute from on page to an other?
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
http://clk.atdmt.com/GBL/go/201469230/direct/01/