I have a very simple JSP page first.jsp that gives reference to so many other JSP pages through hyperlink.
I am trying to pass a value through the hyperlink in first.jsp and retrieve it in second.jsp using request.getparameter().
I used:
Second JSP
and in the second.jsp page I used:
alert( "value = " + <%= request.getParameter("value") %>);
but when I try to run the code and click on Second JSP I get a 404 page not found error for:second.jsp?value=1
It looks like your URL to second JSP might not be good. "second.jsp" is not visible to your web app server the way you specified.
To fix this:
If your jsps are resolved through a web app try:
Second JSP
if you have jsp or similar directory that is visible outside of web app context do something like:
Second JSP
Try getQueryString() method to access the value that you passed through the URL.
Then use string methods to extract the value form the URL.
For example, you pass the parameter as you mentioned
Use getQueryString() method in second.jsp, it will return the string value = 1 as the result.
Html:
<a href="birth1.jsp?key=14APR010315381">
<center>
<font size="2" color="black">MIKE LOBO</font></center>
</a>
Jsp:
request.getParameter("key");
I m using in my project and its working fine
Related
I have a text message that my ionic app retrieves from an api that has an anchor link which needs to redirect to another page when tapped.
The html from the api is:
Tap Here
The ionic function is:
goToOtherPage(): void {
this.navCtrl.push(OtherPage);
}
I have tried:
<a onclick="goToOtherPage()">Tap Here</a>
and
Tap Here
but the first two give the message:
goToOtherPage is not defined
and the last one does nothing.
Does anyone know how I can trigger a function from dynamically retrieved html?
This will not work due to the DomSantizer that sanitizes unsafe html. I recommend retrieving the different parts of the message (eg. using JSON) and generating the page link and message via your page/component.
I am stuck at one of the issue where I have a anchor tag in a component , on click of It ,I have a post method which is posting some data into service and in response I am getting report data as a html string , Now client wants to see the report as a PDF in a new window . How to achieve this ,there are lots of articles but none of it resolved ,need some simple solution . Somewhere I read to convert html string in service to byte of array using encode and then Create Url Object (front end -Blob) but that is also not working. I dont have the exact code but a kind of replica I just shared ,any help would be great.
<a (click)= "openreport(request)" />
openreport(request) {
this.dataservice.postdata('service url' ,request).subscribe(res= >{
res.creditreportdata---> html string
})
}
In am passing a model to a MVC view, which has got one field that stores an absolute URL (for exmaple http://goolge.com)- I am trying to add this to a anchor tag but the system keeps adding the host and controller to the URL.
The code in the view looks like this:
#Localizer["InfoLink"]
The respone however adds the host and controller name. Therefore, the link shows like this:
http://localhost:51114/de/Home/http://google.com
What I would like is just:
http://google.com
I have tried all kind of changes to the way I pass the string into the href="" but whatever I do, the result is the same.
In my application, when I hit Run button which is scripted in gsp page as:
<input type="button" value="Run" onClick="submitJob()"></input>
submitJob() function is defined in a ExtJs JavaScript file which does some operations and calls the controller code which renders a different gsp output page as:
render(template: "/plugin/jobPlot_out", model:[jobName:jobName], contextPath:pluginContextPath)
In my application in web browser it displays the output in the same web page. How to display the same output in a dialog box and not in the same page?
I am new to JavaScript so I posted this question. What I did:
I had to search for the div id of the Run button and had to search for the URL where the div id gets loaded. Upon finding this, I had to write a jQUERY code to open a dialog box and the resulting output was rendered there.
I'm not pretty sure I got you right but have you tried to use a redirect instruction?
http://grails.github.io/grails-doc/3.0.x/ref/Controllers/redirect.html
I am trying to set up OAuth2.0 for an iPhone app I'm working on.
I have "http://www.mywebsite.com/success" set up as my RedirectURI to which the service I am working with appends a response code and state. My response becomes "http://www.mywebsite.com/success?code=ftlZcvFZ3RACFqzgxHypJw637jObmAoHowSuyxeM&state=".
The example I am following has me trying to access this code by the following:
[webView stringByEvaluatingJavaScriptFromString:#"document.title"];
Right now my page title is static and is always just Success, while the example expects it to include the code like: "Success ftlZcvFZ3RACFqzgxHypJw637jObmAoHowSuyxeM".
How do I modify my html to have the title reflect this?
Thanks!
You can use the sever-side language PHP. It's easy to learn.