Passing values between jsp and php
hi there, is it possible to pass values between jsp and
php? i really need to find out the way if there is
any. thanks in advance
-azali-
Yes, there are a few ways to do this.
1) Think about using Cookies.
2) Maybe use a Redirect passing the values in the Query string.
3) Retain the data in a repository in the back end.
4) Using Hidden fields within your pages.
I am sure you can use these Idea's for a base to develop other methods on how to pass values back and forth from JSP -> PHP and vice versa.
-Richard Burton
Similar Messages
-
Passing values between JSP and Bean
I am trying to validate a date entered by the user on a form. I need to do an "alert" when the user enters a date outside of the valid range depending on a value entered in a drop down.
Am doing this in checkform function. Here is what I want to do:
1. Send the the value from the drop down and the date to bean to do the calculations. Call the EJB function from checkform.
2. Get a string values back into the jsp from the bean
3. Blow an error to the user to enter a valid date.
Any help in this case would be greatly appreciated.
Thanks.I only see some design requirements.
What's the exact coding question? Where are you stucking while coding those requirements accordingly? -
Use context to pass value between JPF and Java Control
hi,
Can we use context to pass value between JPF and Java Control? It works if i m using InitialContext in the same machine but i dun think it will works if i put Web server and application server in different machine. Anyone have an idea how to do it?
I also want to get the method name in the onAcquire callback method. Anyone knows how to do this?
thks
?:|Hi.
Yoy can the next options for make this:
1. Pass your values in http request.
example: http://localhost/index.jsp?var1=value1&var2=value2&var3....
2. You can use a no visible frame (of height or width 0) and keep your variables and values there using Javascript, but of this form, single you will be able to check the values in the part client, not in the server. Of this form, the values of vars are not visible from the user in the navigation bar.
Greeting. -
I would like to pass values between pages.
I don't want showing up on the url. Ex: some.jsp?param=value
I don't feel it's safe.
It's not coming from form either....
How can I hide the value and pass it to next page?
I want to pass the value when the user click on a hyperlink
Thanks In Advance.
Message was edited by:
TheepanClient side information is never safe no matter what you do. If the values don't end up in the url, they are always present SOMEWHERE in the html content.
If you don't want the values to end up in the url, rework the page so it DOES do a post form submit. You could turn the hyperlink into a javascript call that submits the form for you. -
Passing values between jsp pages
Hi all,
I am a newbie to jsp. I am trying to pass value from one jsp to another.
Let me post the code here and make my point clear. I have 3 jsp pages and am trying to get the value into my 3rd page that was in the first page.
This is my Test.jsp page:
<%@page contentType="text/html"%>
<html>
<head><title>Test JSP Page</title></head>
<body>
<%-- <jsp:useBean id="beanInstanceName" scope="session" class="package.class" /> --%>
<%-- <jsp:getProperty name="beanInstanceName" property="propertyName" /> --%>
Testing.. JSP Page
<FORM action='Response.jsp' method="POST">
<input type='Text' name='get_name'>
<input type="submit" value="Click Me">
</FORM>
</body>
</html>
This is my response.jsp page:
<%@page contentType="text/html"%>
<%@page import = "sun.jdbc.rowset.CachedRowSet" %>
<html>
<head><title>Response Page</title></head>
<body>
<%-- <jsp:useBean id="beanInstanceName" scope="session" class="package.class" /> --%>
<%-- <jsp:getProperty name="beanInstanceName" property="propertyName" /> --%>
Thank you... <%=request.getParameter("get_name") %>
// I want to pass this get_name to my next page, but since request.getParameter returns an object and not a string, how will I capture the value and pass it to my next page.
</body>
</html>
The 3rd jsp page is:
<%@page contentType="text/html"%>
<html>
<head><title>JSP Page</title></head>
<body>
// I am trying to get the value of the name here in this page.
<%-- <jsp:useBean id="beanInstanceName" scope="session" class="package.class" /> --%>
<%-- <jsp:getProperty name="beanInstanceName" property="propertyName" /> --%>
</body>
</html>
Your help is appreciated.
ThanksHi,
Thanks for the reply, it works. I was wondering whether this is an efficient way of doing this. What I want to do further is to setup a connection to a database and use the value I got from my previous page to query the DB and get the results and display.
I have see some code in the java website and a lot of people do by writting a bean /class(believe bean is just a class) and then importing it and do the things that way. I have good knowledge of OO and Java as a language and would definitely love to do it this way.
What i think i am missing is the basic idea to doing this way. So if you could let me know how to do this using java classes I would really appreciate it. If its too much to explain can u point to some good source(URL's) that explain's this. I have searched on this and all i find is code with no good explaination.
Thanks a lot -
Servlet passing values to JSP and ClasscastException
I am using weblogic 5.1 to run my Servlets.
I want to know when I forward from a servlet to a JSP how do I pass
values especially Java Objects (Sometimes Objects of User written Java
classes).
Uptil now I have been putting all values in the session from where the
JSP picks them up, but somehow I have a feeling that this is not the
right way.
In a code I am putting a Java Object (It contains two attributes of
Java.util.Vector type) in the session so that the JSP to which I am
forwarding it to can use it I have put my class in the ServletClasses.
Intertestingly it runs well till the contents of the Vector are changed.
As the contents of the vector are changed, it throws ClassCastException
The StackTrace is as follows:
java.lang.ClassCastException
at
jsp_servlet._select_95_account_95_profile._jspService(_select_95_account_95_pro
file.java, Compiled Code)
at weblogic.servlet.jsp.JspBase.service(JspBase.java, Compiled
Code)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java,
C
ompiled Code)
at
weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.j
ava:143)
at
com.logistics.optistopasp.servlet.AccountSelectServlet.doPost(AccountSelectServ
let.java, Compiled Code)
at
com.logistics.optistopasp.servlet.AccountSelectServlet.doGet(AccountSelectServl
et.java:35)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java,
C
ompiled Code)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.j
ava, Compiled Code)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.j
ava, Compiled Code)
at
weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContextMan
ager.java, Compiled Code)
at
weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java,
Compile
d Code)
at
weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java,
Compiled Code
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java,
Compiled Code)
Can anybody please Help!!!!.
Thanks
Pankaj
Only can confirm your finding - the jsp is using a different class loader to the servlet that originally instantiated the object. There's the rub. I haven't figured out yet how to fix that. I can get the classloader but don't know how to get the runtime to use that class loader to perform cast.
-
How to pass values between applet and jsp
I have a jsp calling an applet which needs to return value to the calling jsp based on the action. Once the applet returns value to the calling jsp, I need to put that value into the session so that I can use it for the other pages. Could anyone have suggestion how to do it. I am new to applet development. Appreciate your help.
Why does it have to send the value back via the same JSP? Why not create a servlet to take input from the applet?
-
Passing parameters between JSP and Servlet
The scenario is as follows:
There is a JSP page that sends a string as a hidden parameter to a servlet:
<input type="hidden" name=<%= Book.NAME %> value=<%= book.getName() %> >
In the servlet there is a print statement that checks the parameter value:
System.out.println("Book name: "+request.getParameter(Book.NAME));
The problem is as follows: if the name of the book consists of more than one word
such as "Servlets and JSP", the print statement will print only Servlet.
If the JSP page passes a string directly as shown here:
<input type="hidden" name="Test" value="Test String" >
The servlet will print the complete string: Test String
The same problem appears if the string is passed between two JSP pages.
Any help is greatly appreciated.
Regards,
Basil MahdiYou might want to try
<input type="hidden" name="<%= Book.NAME %>" value="<%=URLEncode.encode(book.getName(), "UTF-8")%>" >This will take care of any wierd un-url friendly charcters that might appear in the book titles such as the ' or " which may be the problem. -
Admin1.jsp
In this jsp page i have a drop down list with<select name=Update
From this page i move to the page Adnim2.jsp
Admin2.jsp
In this page i request for the value of selected entry in the drop down list as follows
String a=request.getParameter("Update");
From this page i move onto a servlet UpdateContribution.java
UpdateContribution.java
Here i need the value of the selected entry in drop down list ie Update
but String a=request.getParameter("Update"); does not work here and i get a Null Pointer Exception
Please help meIn Admin2.jsp, add a hidden form field and assign the selected value of drop-down to it. Now, you can obtain
the selected value of drop-down in Servlet(UpdateContribution.java) using given hidden form field.
Or,
Store the selected value of drop-down list in session. Now, you can obtain the value in servlet(UpdateContribution.java) through session -
To pass value between jsp page
How can I pass hidden's value from a jsp page to other?
My code is:
a.jsp
<h:form id="insUser">
<h:inputHidden id="flag" value="1"></h:inputHidden>
</h:form>
b.jsp
<%String flag="";
flag=request.getParameter("flag");
out.print("flag="+flag);
%>
b.jsp shows: flag=null
Could you help me?Because this hidden field id is insUser:flag, but not just flag.
If you have subview or other naming container(s) around form, the id name might be even longer.
Sergey : https://ajax4jsf.dev.java.net/ -
Passing values between ajax and servlet
Hi,
This is taking me nowhere and i'd wish someone could point out my mistakes.
Here are the files i've created,
MyForm.jsp: contains a dropdownlist and a text input, and AJAX function to call MyServlet
MyServlet servlet: access db to retrieve data to fill up MyForm text input
Required action+ User selects an option from dropdownlist to fill up textfield
Expected result+ textfield displays "my result"
Actual result+ textfield displays "my result<space><space>" (with extra two blank spaces!!!)
No matter how long the expected result is, it'd append 2 blank spaces at the rear of xmlHttp.responseText.
I'm having the following codes in AJAX,
var url="/MyApp/servlet/MyServlet";
url=url +"?param="+ document.form1.menu.value;
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("POST",url,true);
xmlHttp.send(null);
}and return the result from servlet as follows
public void doGet(HttpServletRequest req, HttpServletResponse res) throws Exception {
//select record from db based on param, and
//save as myresult
out.println(myresult);
public void doPost(HttpServletRequest req, HttpServletResponse res) throws Exception{
doGet(req,res);
}Any idea?
/zalright, guys. i spotted my mistake. jesus, how could i overlooked it!
just replace out.println with out.print()
i didn't realize the carriage return. -
Navigate between 2 reports and pass values between 2 different columns
Hello
I have a question about navigating from 1 report to another while passing the value from column 1 to column 2 in the second report...
In OBIEE 11G, I create action link on report 1, column 1 and this action link is navigate to BI Content and the destination is report 2. Now report 2 has column 2, which is an alias of column 1 from report 1, from user's point of view they are the same, but from OBIEE point of view they are different.
My action link is able to navigate to report 2, however, the value in column 1 which I clicked to execute the navigation, does not get passed to column 2 in report 2..
Is there a way around this issue?
Let me know if I need to provide more clarification
ThanksThank you Anirban
I think this is the best solution you just provided.The current post and the post at below looks same
Navigate from report to dashboard and pass values between different column
is it not answered?
Thanks :)
Edited by: Srini VEERAVALLI on May 7, 2013 3:07 PM -
Communication between jsp and abstractportalcomponent
Hello All
Communication between jsp and abstractPortalComponent.
jsp contains one input text field and one submit button.
when the user clicks on submit button it will call the component and that input value will
display in same jsp page.
how this communication will happen?
Rgrds
SriHi Srikanth,
In the JAVA File,
OnSubmit Event,
String inputvalue ;
InputField myInputField = (InputField) getComponentByName("Input_Field_ID");
if (myInputField != null) {
inputvalue = myInputField.getValueAsDataType().toString();
request.putValue("textvalue", inputvalue);
request is IPORTALCOMPONENTREQUEST Object.
In JSP File, to retreive the value,
<%
String textstring = (String) ComponentRequest.getValue("textvalue");
%>
In PORTALAPP.XML File,
<component name="component name">
<component-config>
<property name="ClassName" value="classname"/>
<property name="SafetyLevel" value="no_safety"/>
</component-config>
<component-profile>
<property name="tagLib" value="/SERVICE/htmlb/taglib/htmlb.tld"/>
</component-profile>
</component>
Using the code above, You can pass and read values between abstract portal component and Jsp Page.
Instead of this, I suggest you to use JSPDYNPAGE Component for Data Exchange.
Check the [Link|http://help.sap.com/saphelp_nw2004s/helpdata/de/ce/e0a341354ca309e10000000a155106/frameset.htm].
Hope this helps you.
Regards,
Eben Joyson -
Array data between Flash and PHP
As the title suggests, I'm trying to find a good way of
getting an ActionScript/Flash dynamic array into PHP, so I can
serialize it and store it in a DB, then simply give back that same
array when it's called. Are there any popular techniques? The array
will always be a different size, containing different values -
which is why I'd like to keep the array in tact, to minimise the
amount of parameter transfers. If there's no good solution, I
suppose I could pass in parameters and read them in, create an
array and serialize that... but I'd much rather find a way of
having my flasher serialize his own array and pass me the
byte-code. Is this possible?
PHP doesn't need to read the contents of the array, simply
store it in a DB, so if there's some kind of flash method for
serializing an array into bytecode that it can unserialize and read
back later, that would be awesome.
Thanks. =]
[edit]
I found this:
http://sourceforge.net/projects/serializerclass/
a serializer class. Is this the best method?Sorry, I should have explained, we already use XML for data
transfers (though I personally find JSON much nicer with less
overhead). So, in this project, we use XML for data transfer
between flash and PHP/Database. The reason I wanted this
functionality, is because the flash array, in this one case, will
be completely dynamic and the PHP doesn't need to know the contents
of the array at all. In fact, in this instance, PHP is just the
mechanism used for storing the data. Becuase of the nature of the
data, I wanted to serialize the flash array, store it in the
database as Bytecode, then when the flash needs that information
again, I can pass back the same bytecode, which can then be
unserialized back into the original array.
I think I've found the solution, the one I linked in the
original post. I should know if it's as effective as I want it to
be in the next couple of days when my flasher gives it a try. =]
Thanks for the responses. If anyone has any other ideas,
please throw them in here. -
Hi, Can anyone tell me how can I pass values between two fields. I have a combobox feild in edit.uix and I want to pass this value to a text field in browse.uix. Can anyone tell me how can I do it.
Thanksadd a second form in your jsp.
and put this hidden field in it.
and post this new form.
Maybe you are looking for
-
How to load jar files from remote location
Hi all, I am trying to load jar files from remote server, from a servlet which is running on OC4j. For doing this,First I am getting ClassLoader by using ClassLoader.getSystemClassLoader() and then type casting it to URLClassLoader. But by doing it I
-
Interface Mapping javax.xml.transform.TransformerException: com.sap.engine.lib.xml.parser.ParserException: XML Declaration not allowed here.(:main:, row:1, col:7) at com.sap.engine.lib.jaxp.TransformerImpl.transform(TransformerImpl.java:251) at com.s
-
"Ghost" page numbers on every second page - how to remove?
Hi, I'm setting a short book with Pages and after importing from Word, I'm seeing duplicate, partially hidden additional page numbers on every second page. I'd like to remove them entirely, keeping Pages' page numbering. Removing and inserting page n
-
Color 1.5.3 offline clips
Hi This might be a really dumb question, but after I have rendered my graded clips in color and then create an XML (which I then opened in After Effects) Why is it when I go back to my color project file... 1) doesn't even exist anymore? I had to fin
-
Why does firefox makes multiple profiles
My name is Mike from the helpdesk of YER. We have one user with the same problem over and over again. Our employees have a roaming profile with multiple browsers, but he uses Firefox wich is causing a problem. There is a datalimit on our user profile