Forward to JSP in default-webapp
I have a servlet in a deployed .war file on Sun Java System Web Server 6.1. I have a JSP that is not deployed in any .war file. How do I forward from the servlet to the JSP. I can't figure out how to obtain a context to the jsp pages in the default webapp which are outside of a .war file.
I see that the jsp .class files are in /opt/sun/web/https-c3qweb1/ClassCache/https-c3qweb1/default-webapp where https-c3qweb1 is the name of our virtual server. There is not an explicit WEBAPP entry for the default webapp in server.xml.
Is it possible to obtain the context of these jsps which are outside of .war files?
I got this to work by doing the following:
ServletConfig currentConfig = getServletConfig();
ServletContext otherContext = currentConfig.getServletContext().getContext("/");
RequestDispatcher dispatch = otherContext.getRequestDispatcher("/mbttest.jsp");
request.setAttribute("anattribute", "set by DispatchOtherContext redirector servlet");
dispatch.forward(request, response);
Similar Messages
-
Deploying a .war file - outside of Tomcat default webapps?
I would like to deploy a war file outside of the [tomcat]/webapps directory.
How can I get tomact to recognize AND unpack a war file in a location other then the default webapps directory?
I have tried the following;
altering server.xml -
added context pointing directly to .war in other directory.
adding context.xml entry to my war -
added context.xml to META-INF of my war file, indicating that the docBase should be in outside directory.
Neither of these created the desired result.
Any suggestions?The following is from tomcat docs
- http://tomcat.apache.org/tomcat-5.5-doc/config/host.html
appBase : The Application Base directory for this virtual host. This is the pathname of a directory that may contain web applications to be deployed on this virtual host. You may specify an absolute pathname for this directory, or a pathname that is relative to the $CATALINA_BASE directory. Going by that. try making the change as below in your server.xml
<Host name="localhost" appBase="your_directory"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false" deployXML="true">I am going by what the doc says.
I havent tried it out myself, so do let us know if that worked.
cheers,
ram. -
Hi Friends,
I am using Oracle Application Server 10g (10.1.2.0.2) on windows
I have the Vulnerability: Apache Tomcat servlet/JSP container default files.
and the fix is Review the files and delete those that are not needed.
i would like to know the location of the files to review and delete.Please suggest?
Regards,
DBApache/Tomcat is not related to OAS, where did you get this info? OAS is based in a Orion Web Server and Apache HTTP Server, not Tomcat.
For this kind of problems there are the CPU you may want to check in Metalink for them.
Can you clarify also what default files?
Greetings. -
How to get virtual hosts to have their own default webapps?
Is there a way to have several virtual hosts to have their own default
webapps?
I have five virtual hosts on my server, and I used to be able to deploy the
webapps to the server, target a server and a virtual host, and then the
default app to use. But I can't see that anymore in wls8.1. I looked
around the web for some help, and all I could find was some reference to the
<context-root> node. The problem with that solution is, when I put that in
each of the webapps for the virtual hosts, only one gets the "/"
context-root, and the rest can't use that.
I would like to be able to have users just type out the virtual hosts URL to
get access to the webapp. Surely a server as powerful as WebLogic can do
that. I used to be able to do this in 7.0sp1. Any ideas? Thanks.Unfortunately you cannot split (nor merge) items purchased with an AppleID. I am not clear on what you will have to do to allow them continued access to their music on your account. Apple no longer has DRM protection in its music but then I also hear people have all kinds of authorization issues when trying to synch so it sounds like they still keep restrictions on what you can do with the music when trying to move it about. I'll let somebody more experienced with syncing answer this part. You may have to authorize their computers and devices to your AppleID to allow them all functionality with the music.
Ideally you would have set them up with their own AppleIDs years ago but...
Creating an iTunes Store, App Store, iBookstore, and Mac App Store account without a credit card - http://support.apple.com/kb/HT2534 - only works for new accounts! -
How to forward a JSP page to another dynamically generated JSP
Hi gurus,
I have a problem with forwarding a JSP page, to another dynamic jsp page.
I have to forward a jsp page to (say X1 ) to another JSP page (say X2).
Iam choosing the name of the page X2, dynamically from a list of JSP pages in a directory depending upon some parameters.
Here is my code for ur better understanding...
<java>
// this gives me the name of the page X2 to which my page X1 should be forwarded.
<TR> <TD><%=request.getParameter("codeins")%></TD></TR>
<%
if(request.getParameter("codeins").length() != 0)
%>
// if i use this forward tag i get the error
<a href="
<jsp:forward page=Ins/<%=request.getParameter("codeins")%">.jsp">
<jsp:param name="a" value="<%=request.getParameter("a")%>" />
<jsp:param name="b" value="<%=request.getParameter("b")%>" />
<jsp:param name="c" value="<%=request.getParameter("c")%>" />
<jsp:param name="p" value="<%=request.getParameter("p")%>" />
<jsp:param name="q" value="<%=request.getParameter("q")%>" />
</jsp:forward>">GNSS Instantiation</a>
<%
else {
out.println("No entry in the database! ");
} %>
</java>
I am getting the exceptions like
<java>
org.apache.jasper.JasperException: /Newspg.jsp(162,67) equal symbol expected
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:94)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:428)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:126)
at org.apache.jasper.compiler.Parser.parseAttribute(Parser.java:169)
at org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:136)
at org.apache.jasper.compiler.Parser.parseForward(Parser.java:517)
at org.apache.jasper.compiler.Parser.parseAction(Parser.java:661)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:803)
at org.apache.jasper.compiler.Parser.parse(Parser.java:122)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:199)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:153)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:227)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:369)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:473)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:190)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:430)
at org.apache.jsp.SPVariablesg_jsp._jspService(SPVariablesg_jsp.java:425)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:193)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:589)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:666)
at java.lang.Thread.run(Thread.java:534)
</java>
please help me out to let me know, where iam doing wrong.
Thanx
mark.Hi,
in reference to the above subject i did like to know what is wrong in the following code of mine:
<%
String name = "admin"; // this is line which is being indicated in error message
int password = 4589;
%>
<!-- <script language="javascript" src="init.js"></script> -->
<head>
<script>
function checking()
if name != document.test.user.value || password != document.test.password.value)
alert("ur not authorised to view the requested url");
forward("Firstpage.jsp");
%>
</script>
its says :
org.apache.jasper.JasperException: /webpg/Dec2Firstpage.jsp(4,21) equal symbol expected
any solutions?
thanx in advance -
Mapping webapp URLs to a single servlet which forwards to JSP
I am using JSP for page presentation, but I want to have all requests
intercepted by a servlet, which will perform various functions before
forwarding to the requested JSP page. In general, I want the URL to
reflect the target JSP page, to facilitate bookmarking. I'm using a
web application to deploy the servlet+JSPs.
Ideally, I wanted to have all request URLs look like a request for the
JSP page without the .jsp extension (so
http://hostname/webapp/here/there maps to /here/there.jsp within
webapp). However, I can find no provision in web.xml for mapping all
URLs without extensions to a specific servlet. I can use '/' to map
all requests to the servlet, but then even image or HTML requests
get intercepted (and trashed).
On the other hand, if I map '*.jsp' to the servlet, then when I try to
forward to the actual JSP page, the servlet gets invoked again
recursively.
I could create an arbitrary extension and map it to the servlet, and
then have the servlet replace my custom extension with '.jsp' before
forwarding, but this seems a bit funky.
Has anyone come up with a better solution to this, within the context
of a webapp? Seems like it should be a not-uncommon scenario.
Thanks,
-- Peter
Yes, you can! It depends on how you access the servlet. If you access it via GET method you must add a request parameter to the url to distinguish from which jsp the request comes. If you use POST method (with form submission) put a hidden field in the form and with that field you can recognize from which jsp the request comes.
Message was edited by:
amittev -
TagLib in Default WebApp??
Hi,
I can use Taglib with WEB-INF/web.xml, taglib.tld in my specified web
application in WebLogic 5.1. but, how can i make it work for the default
web application under myserver/public_html ??
Insted of htttp://host:7001/myapp/tagtest.jsp, i want to use
http://host:7001/tagtest.jsp.
Where to put the WEB-INF dir to make weblogic recognize my taglib?
Thanks in advance.
Best Regards
Li Zhongling (Alex)
Carpe Diem, Seize the Day !!
Hi, Michael
Thank you for your answer. I tried again, still there is some difference
between the root webapp and customerize ones.
1. I put WEB-INF under public_HTML, but i can not use web.xml to define
anything there.
2. I have to specify the uri of my taglib.tld directly, because i can not use
web.xml to config it. For example, before, I use "uri=/mytag/tag1", then in
web.xml I specify this uri map to mytag1.tld. Now here, in every jsp under
public_html, I must directly say "uri=mytag1.tld", then put mytag1.tld under
public_html/WEB-INF/
3. The classes under public_html/WEB-INF/classes can not be found
automatically, as other web apps do. Now I still put all the classes under
myserver/servletclasses
After that, everything works fine.
Li Zhongling
Michael Girdley wrote:
> You may deploy the Web Application as an expanded directory hierarchy under
> public_html.
>
> Thanks,
> Michael
>
> --
> ----
> Michael Girdley
> Product Manager, WebLogic Server & Express
> BEA Systems Inc
>
> Li Zhongling (Alex) <[email protected]> wrote in message
> news:[email protected]...
> > Hi,
> >
> > I can use Taglib with WEB-INF/web.xml, taglib.tld in my specified web
> > application in WebLogic 5.1. but, how can i make it work for the default
> > web application under myserver/public_html ??
> >
> > Insted of htttp://host:7001/myapp/tagtest.jsp, i want to use
> > http://host:7001/tagtest.jsp.
> > Where to put the WEB-INF dir to make weblogic recognize my taglib?
> >
> > Thanks in advance.
> >
> > --
> >
> > Best Regards
> >
> > Li Zhongling (Alex)
> >
> > --
> > Carpe Diem, Seize the Day !!
> >
> >
Best Regards
Li Zhongling (Alex)
Carpe Diem, Seize the Day !!
-
Hi Everyone,
I apologise if this is the wrong place for this post but the majority of everyone here has a vast knowledge of tomcat and I have recieved alot of help when writing it from this forum.
So I have created a simple web application, registered my domain and have mapped the ip of my web server with my domain registrar, so all requests for my web site are redirected to my static IP address.
By default when tomcat receives a request to port 80 or 8080 whichever you are using it looks for the <welcome-file> you specify in your web.xml. In this case by default it looks for the index.jsp file in the webapps\ROOT directory.
What I wish to do is configure it to look in
webapps\myWebApp\index.jsp
as opposed to root whenever a request comes in.
Can anyone tell me how this is configured? i have read through some docs at
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/manager-howto.html
but didn't find the answer.
Also if this is the wrong way to deploy my app please let me know.
Thanks in advance.
Tashttp://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/context.html
Under the section on "path"
" If you specify a context path of an empty string (""), you are defining the default web application for this Host, which will process all requests not assigned to other Contexts. The value of this field must not be set except when statically defining a Context in server.xml, as it will be infered from the filenames used for either the .xml context file or the docBase." -
Precompilation of JSPs for default web application
Hello,
Once in a while I need to redeploy my "Default" web application. I would like to have its all JSPs precompiled, so that it was immediatly available after redeployment.
However, if I try to redeploy my web application (.war file) under, let's say, "DefaultWebApp" root context, using the administration console, with the "Precompile JSPs" option enabled, it does compile all JSPs, but ONLY those deployed under the "DefaultWebApp" root context.
However, If I access a url like "http://somehost/SomeResource.jsp" (a file that belongs to that default web application"), I can see (due to a pause) that my JSPs have not been compiled under the root context.
Is there any way to precompile JSPs for my default web applications?
Sincerely,
Sergei Batiuk.Hello,
Once in a while I need to redeploy my "Default" web application. I would like to have its all JSPs precompiled, so that it was immediatly available after redeployment.
However, if I try to redeploy my web application (.war file) under, let's say, "DefaultWebApp" root context, using the administration console, with the "Precompile JSPs" option enabled, it does compile all JSPs, but ONLY those deployed under the "DefaultWebApp" root context.
However, If I access a url like "http://somehost/SomeResource.jsp" (a file that belongs to that default web application"), I can see (due to a pause) that my JSPs have not been compiled under the root context.
Is there any way to precompile JSPs for my default web applications?
Sincerely,
Sergei Batiuk. -
Timed redirection/forward in jsp
i am trying to forward the request/response to another page after a particular peroid of time say 10 seconds. I need to output the content and wait for 10 seconds till forward happens. I think you got , what i need to do ...
i know a forward cant happen after buffer is flushed ..
plz suggest a way
SHERIN :)
THIS IS PART OF JSP CODE
if(reportStat.equals("first"))
%>
<FORM action="/IntranetSystem/report" method="post">
<CENTER>
<b><FONT color="red">ENTER YOUR DAILY REPORT</FONT></b><br><br><br>
<TEXTAREA rows="10" name="report" cols="50" ></TEXTAREA>
<br><br>
<INPUT type="submit" value=" submit "/>
<INPUT type="hidden" name="userid" value="<%=userId%>" />
</FORM>
<% }else if (reportStat.equals("success")){ %>
<CENTER>
<h3> DAILY REPORT UPDATED </h3><br><br>
<b><FONT color="red">Redirecting to Home page in 10 seconds...</FONT></b>
</CENTER>
<%
out.flush();
out.append('x');
Thread.sleep(10000);
out.println("redirecting..");
%>
<jsp:forward page="inbox.jsp"> // THIS CAUSES ILLEGALSTATEEXCEPTION
<jsp:param value="<%=userId%>" name="userid"/>
</jsp:forward>
<% }else{ %>
<CENTER>
<FONT color="red">
<h3> DAILY REPORT UPDATE FAILED </FONT><br>check todays attendance status . you may not have signed in</h3><br><br>
<FONT color="yellow"><b>Redirecting to Home page in 10 seconds... </b></FONT>
</CENTER>
<%
out.flush();
out.append('x');
Thread.sleep(10000);
out.println("redirecting..");
%>
<jsp:forward page="inbox.jsp">
<jsp:param value="<%=userId%>" name="userid"/>
</jsp:forward>
<% } %>But what is the requirement. I dont think really u r going to do some thing in 10seconds.
u just want to do that,coz u want to show some thing fancy ,to the user. ..lol :)
That will slightly affect the performence,no doubt on that. -
Forward to JSP page without using Navigation Model
How can I forward to a JSP page without using the Navigation Model?
It's done in the cardemo example in
ImageMapEventHandler.processAction() Is there a reason
for it there?Ah ... that makes sense.
That code in CarDemo was written before there was such a thing as a NavigationHandler, and we didn't have time to update it to the new approach before the EA4 release. That'll be changed before the next one. In the mean time, I'd recommend that you use the navigation rules mechanism where it works for you, because it encourages good separation of business logic and presentation logic that will lead to more maintainable applications.
Craig -
Following is my jsp page. I am trying to forward to another jsp depending on the conditions.
<%@ taglib uri="struts-logic" prefix="logic" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
String u = (String)session.getAttribute("userID");
String seibel = (String)session.getAttribute("seibel");
System.out.println(u);
System.out.println(seibel);
if(seibel.equals("true"))
{%>
<jsp:forward page = "AutoLogin.jsp"/>;
<%}
else
%>
<logic:redirect forward="logon"/> ;
<%
%>When the if condition fails, the else part does not get executed. The error I get is as follows.
[exec] <Dec 28, 2007 11:48:13 AM IST> <Error> <HTTP> <101017> <[ServletContext(id=7535615,name=csr-gema,context-path=)] Root cause of ServletException
[exec] java.lang.NullPointerException
[exec] at jsp_servlet.__forwardtogema._jspService(__forwardtogema.java:107)
[exec] at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
[exec] at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1094)
[exec] at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:437)
[exec] at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:481)
[exec] at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:319)
[exec] at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5626)
[exec] at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:685)
[exec] at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3213)
[exec] at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2555)
[exec] at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:251)
[exec] at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:219)
[exec] >
Any inputs? Please reply.As mentioned, seibel must be null. Change your code so it's like this
if(seibel == null || seibel.equals("true"))
{%>
<jsp:forward page = "AutoLogin.jsp"/>;
<%}
else
%>
<logic:redirect forward="logon"/> ;
<%
}However depending on what you are trying to do this may just hide your problem by
short circuiting when seibel is null. If seibel should not be null then your problem is elsewhere. -
Weird behaviour with jsp:forward and jsp:param
I'm running Orion 1.5.3
Wanted to ask if anyone has insight into the following.
I'm trying to do a forward with a parameter. The parameter is something like a message string.
The following does not work.
<%
String result = "unsucessful"; // retrieved from external source... hardcoded for example's sake
%>
<jsp:forward page="<%=nextPage%>">
<jsp:param name="message" value="The result was <%=result%>"/>
</jsp:forward>
I've managed to deduce that the error is in the param value. Apparently, we cannot mix variables with static values inside the value parameter.
I've managed to get it working by doing this...
<%
String result = "unsucessful"; // retrieved from external source... hardcoded for example's sake
String message = "The result was " + result;
%>
<jsp:forward page="<%=nextPage%>">
<jsp:param name="message" value="<%=message%>"/>
</jsp:forward>
My question is, is this a bug or is it supposed to be this way ? Can we mix the value parameters ?Hi Bernard,
Take a note of the following syntax -
<jsp:forward page={"relativeURL" | "<%= expression %>"} >
<jsp:param name="parameterName"
value="{parameterValue | <%= expression %>}" />+
</jsp:forward>
It is evident that either the value attribute can have an expression or simple text.
I have tried your example and I am also encountering the same kind of problem, but I have found a way out.
You can try the following in your code -
<%
String result = "unsucessful"; // retrieved from external source... hardcoded for example's sake
%>
<jsp:forward page="<%=nextPage%>">
<jsp:param name="message" value=' <%= "The result was" + result%>'/>
</jsp:forward>
Instead of using
value= "The result was <%=result%>" you can use
value= '<%= "The result was" + result%>'.
Hope this helps -
PageContext.forward("NewPage.jsp") appends previous page's data
Hi!
When I try to use the above mentioned forward, I get to NewPage.jsp, but
all of the data from OldPage.jsp is appended to the bottom of the
NewPage. I have tried using requestDispatcher.forward() as well with the
same results. How should I do this?
Weblogic 5.1 with SP 6 on Solaris.
thanks
Colleen
OOPS and I forgot to mention that this is in a custom tag, not just on the
jsp page.
Colleen Wtorek wrote:
> Hi!
>
> When I try to use the above mentioned forward, I get to NewPage.jsp, but
> all of the data from OldPage.jsp is appended to the bottom of the
> NewPage. I have tried using requestDispatcher.forward() as well with the
> same results. How should I do this?
>
> Weblogic 5.1 with SP 6 on Solaris.
>
> thanks
> Colleen
-
How to forward a jsp page in flex application ( when a button is clicked)
i am a fresher to this FLEX 2.0 , i designed the UI part in
flex, but when i click the submit button it has to forward to the
JSP page to check against the valid user,password , so how to
forward the page to jsp(i mean from flex to jsp) , if u can suggest
me with an example, it will be easy for me, is Flex Data Service 2
is necessary for this
thanks for ur speedy reply, hopping to get the solution for
this issue,
sandeepYour JSP is, as far as Flex is concerned, just a data service
which it will request and read its response. I'd suggest using
<mx:HTTPService>. For example:
<mx:HTTPService id="authorize" url="validate.jsp"
fault="handleFault(event)" result="handleResult(event)">
<mx:request>
<userid>{username.text}</userid>
<password>{password.text}</password>
</mx:request>
</mx:HTTPService>
Flex creates the request:
http://{server}.{port}{context.root}/validate.jsp?userid=fred&password=flintstone
assuming that you have <mx:TextInput id="username" />
and <mx:TextInput id="password" /> components.
Your Submit button then does: authorize.send()
(note: you can also pass the request parameters in the send()
method - check the Flex docs on HTTPService).
Flex will listen for the response from your JSP. Typically a
JSP would respond with an HTML page, but you don't want to do that
for Flex. Your JSP should produce either a simple string ("yes" or
"no" or "error" etc) or an XML document.
The handleResult method can examine the response and do
what's necessary.
Maybe you are looking for
-
Photo library upgrade causes crash
On starting iPhoto, I get the message "The photo library needs to be upgraded to work with this version of iPhoto" If I click upgrade the app crashes. If I click Quit the app closes. Had problems with iPhoto as disk space was full, however now I can
-
How do i view thumbnails or .mp4 files in my windows folders? for quicktime
i noticed since switching my cameras i used to be able to view thumbnail pictures of my movies. my new computer uses .mp4 files for HD movies so now my files only show .mp4 icon instead of a thumbnail for the video. anyways to fix this?
-
Xorg.conf.d not created? [SOLVED]
Ok, I'm new to Arch from Ubuntu/Mint/Crunchbang. I'm sure that I'm missing something easy here but I can't seem to find any clue as to what. I'm trying to get a working system going, and everything seems fine, but when I run startx or xinit to star
-
How can I use the custom new image size presets also when I resize an image
Hi there, I have created some new image presets at various sizes, and I have saved these presets. They appear when I create a new image. How can I get these preset sizes to also appear when I re-size an image ? The presets for new images seems to be
-
Freight conditions in sales doc
Hi Friends, I got a requirement of adding freight charges depending on the weight of goods and distance. Like, say, add a freight condition of Rs10/- per kg per kilometer. This should be dependent on delivering plant and ship to party distance.how th