Hi,
Is there anyway I can post from one JSP and capture the results in another JSP using CQ5?
I've a text box with a button in say component A.JSP. I used a template..etc http://localhost/...../Search.html
Now I want to capture the textbox value and search it in the SearchResults.html against a database. How can I call the SearchResults.html (say component B.JSP) on Submit button click from Search.html?
If I use the entire URL in the form action. I am getting the left nav bar multiple times in the SearchResults.html
Thanks,
Sudhin
Solved! Go to Solution.
Views
Replies
Total Likes
There's probably a huge number ways this can be achieved. Together with Scotts suggestion I'll throw some other ones in as well:
Hope that you'll find some way that suits you
/Johan
In your A.JSP -- you can get the values (from controls in A.JSP) and send these values to B.JSP.
For example - user enters values into A.JSP and you want to get these values to B.JSP. That is no issue with CQ. See this community article:
http://scottsdigitalcommunity.blogspot.ca/2012/05/using-jsonwriter-objects-to-display.html
IN this article B.JSP would be lookup.json.jsp. A.JSP would be templateJSON.jsp.
Views
Replies
Total Likes
There's probably a huge number ways this can be achieved. Together with Scotts suggestion I'll throw some other ones in as well:
Hope that you'll find some way that suits you
/Johan
Hi,
I have URL
http://localhost:4502/content/myuhcdental/membersearch.html
Now when I post it, I want it display the results on the same screen. Below is my java code, I want it to display as
http://localhost:4502/content/myuhcdental/membersearch.html?txtmemId=2
I made a small java program which in turn calls a database. Have an OSGI bundle etc..
I have a method which queries the database - getMember(x). --> This is working fine.
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@include file="/libs/foundation/global.jsp"%> <%@ page import="java.sql.Connection" %> <%@ page import="java.sql.Statement" %> <%@ page import="com.adobe.test.DataService" %> <%@ page import="java.sql.ResultSet"%> <% //id = Integer.parseInt(request.getParameter("txtSearch")); int myid =2; // myid = Integer.parseInt(memberid); %> <% DataService ds = new DataService(); %> <script type="text/javascript"> function doSubmit(){ var txtval = document.getElementById("txtMemid").value; if (txtval != null){ alert('in submit ' + txtval); form1.action = "membersearch.html?txtMemid=" + txtval; alert('action' + form1.action); document.getElementById("form1").submit(); } } </script> <form method="GET" id="form1"> <% String memberid = request.getParameter("txtMemid"); %> <input type="text" id="txtMemid"></input> <input type="Submit" value="Search" onclick=doSubmit()></input> <h3> Hello:<%=ds.getMember(memberid)%> + you entered: <%= memberid %> end</h3> </form>
Views
Replies
Total Likes
I just had to add
window.location.replace("membersearch.html?txtMemid=" + txtval);
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies