Request.getParameter()
Can I set the request to null once I have got the value i required. I have a parameter which has to be set to null in the request object once it is been used as i dont want that request to go to the next page Can anyone help Regards Kamal - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Request.getParameter()
On 02/06/2004 11:11 AM Kamal Gupta wrote: Can I set the request to null once I have got the value i required. I have a parameter which has to be set to null in the request object once it is been used as i dont want that request to go to the next page No, you're not allowed to edit the request parameters. You can set and remove request attributes though. Adam -- struts 1.1 + tomcat 5.0.16 + java 1.4.2 Linux 2.4.20 Debian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
help: request.getParameter("action")
I am using a single jsp (registration.jsp) that can be used in one of three different ways: 1. create a new registration, user clicks on hyperlink 2. edit existing registration details, user clicks on hyperlink 3. user confirms a new registation or confirms update existing details (i.e registration.jsp is used to display to the user the fields they are about to commit to the database) in this case, the user will click on a BUTTON, not a hyperlink: In my EditRegistrationAction class, I want to check the the value of the 'action' attribute: String action = request.getParameter("action") My problem is that I am not sure if the value="confirm" attribute/value pair on the button will be detected by the request.getParameter("action") method. Will I therefore need a separate variable to check for the button i.e. String value = request.getParameter("value") many thanks yan Kickstart e Solutions. - Intelligent Web Services [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: help: request.getParameter("action")
Firstly I should point out that naming a field (and a submit button qualifies in this category) on your form "action" is a very bad idea (as it shadows the action property of the form object in the client side object model - so if you ever need to play with a forms action path in javascript on the client side you will find you cant get at it! (you should in general avoid naming your form properties the same as anything thats a (js) form object method or property. "submit" is another fun one - you should never name your submit button "submit"! hehe)... ) (It doesnt help that half the struts examples make this egregious mistake!) Ok. Now getting on to your question. I the html:form tag does not have a 'value' attribute. What you need is to use an html:submit tag to render your submit button. ie: . The submit tag (which just renders the html ) takes a 'value' attribute. This is what will be submitted in the 'action' request parameter. It is however _also_ what gets displayed as the label on the button! (If you are using i18n you will want to go take a look at the javadocs for LookupDispatchAction at this point). The easiest way round this label_is_value issue is to make 'action' a hidden field and the button they click sets it in javascript and submits the form - however that only works if javascript is enabled. And I'll mention it one last time: DONT CALL THE PARAMETER "action" Thats bad. Call it "doAction" or "method" or "bob" but naming it the same as properties of the js form object (ie: action, submit, elements, etc...) is not a great idea -Original Message----- From: yan [mailto:[EMAIL PROTECTED] Sent: Tuesday, 2 September 2003 23:28 To: [EMAIL PROTECTED] Subject: help: request.getParameter("action") I am using a single jsp (registration.jsp) that can be used in one of three different ways: 1. create a new registration, user clicks on hyperlink 2. edit existing registration details, user clicks on hyperlink 3. user confirms a new registation or confirms update existing details (i.e registration.jsp is used to display to the user the fields they are about to commit to the database) in this case, the user will click on a BUTTON, not a hyperlink: In my EditRegistrationAction class, I want to check the the value of the 'action' attribute: String action = request.getParameter("action") My problem is that I am not sure if the value="confirm" attribute/value pair on the button will be detected by the request.getParameter("action") method. Will I therefore need a separate variable to check for the button i.e. String value = request.getParameter("value") many thanks yan Kickstart e Solutions. - Intelligent Web Services [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
FW: help: request.getParameter("action")
How about if you use 3 different jsp file... You can use 3 with 3 different value For example : , , , and in Action class you can use this code : Assumption your ActionForm name is ActForm.. And your action class is act... --- ActForm frm=(ActForm) form; If(frm.getAction().equals("confirm")) return mapping.findForward("action"); If(frm.getAction().equals("registration"))return mapping.findForward("registration"); If(frm.getAction().equals("update")) return mapping.findForward("update"); and you have to set struts-config.xml with this following code : http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd";> -Original Message- From: Andrew Hill [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 03, 2003 10:07 AM To: Struts Users Mailing List; yan Subject: RE: help: request.getParameter("action") Firstly I should point out that naming a field (and a submit button qualifies in this category) on your form "action" is a very bad idea (as it shadows the action property of the form object in the client side object model - so if you ever need to play with a forms action path in javascript on the client side you will find you cant get at it! (you should in general avoid naming your form properties the same as anything thats a (js) form object method or property. "submit" is another fun one - you should never name your submit button "submit"! hehe)... ) (It doesnt help that half the struts examples make this egregious mistake!) Ok. Now getting on to your question. I the html:form tag does not have a 'value' attribute. What you need is to use an html:submit tag to render your submit button. ie: . The submit tag (which just renders the html ) takes a 'value' attribute. This is what will be submitted in the 'action' request parameter. It is however _also_ what gets displayed as the label on the button! (If you are using i18n you will want to go take a look at the javadocs for LookupDispatchAction at this point). The easiest way round this label_is_value issue is to make 'action' a hidden field and the button they click sets it in javascript and submits the form - however that only works if javascript is enabled. And I'll mention it one last time: DONT CALL THE PARAMETER "action" Thats bad. Call it "doAction" or "method" or "bob" but naming it the same as properties of the js form object (ie: action, submit, elements, etc...) is not a great idea -Original Message- From: yan [mailto:[EMAIL PROTECTED] Sent: Tuesday, 2 September 2003 23:28 To: [EMAIL PROTECTED] Subject: help: request.getParameter("action") I am using a single jsp (registration.jsp) that can be used in one of three different ways: 1. create a new registration, user clicks on hyperlink 2. edit existing registration details, user clicks on hyperlink 3. user confirms a new registation or confirms update existing details (i.e registration.jsp is used to display to the user the fields they are about to commit to the database) in this case, the user will click on a BUTTON, not a hyperlink: In my EditRegistrationAction class, I want to check the the value of the 'action' attribute: String action = request.getParameter("action") My problem is that I am not sure if the value="confirm" attribute/value pair on the button will be detected by the request.getParameter("action") method. Will I therefore need a separate variable to check for the button i.e. String value = request.getParameter("value") many thanks yan Kickstart e Solutions. - Intelligent Web Services [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
'<%=request.getParameter("app_code")%> - no value
Hi, I have exstablished a connection and all but app_code values appear in my Postgresql Database. The app_code is A UNQIUE value that is required thru the process . I have a jsp called planningdb that selects the following and displays the values from the Database. Thus i have a html tag that submits the value app_code to my jsp Submit Comments form. Thus the user enters the details as follows. (first_name, last_name, address, post_code, email, observation) Note app_code is a request method. <%=request.getParameter("app_code")/> the app_code number is displayed in the both planningdb jsp and submit jsp. except the processform (that im about to modify to a viewForm and use struts way of thinking and thus return any errors back to the submit form. and comments about the planning application and above the Submit Comments form there is a <%=request.getParameter("app_code")- all the html input tags are able to send values to select app_code, app_date, application_agent, grid_ref , location, community, proposal,comment from planning_application order by 8 Thus processform.jsp works(<%=request.getParameter("app_code")/> I always get a null value i have used the request method at the top of the processform to see what it picks up ( null) from the jsp Submit Comments Form. insert into comments (first_name, last_name, address, post_code, app_code, email, observation) values ('<%=request.getParameter("first_name")%>', '<%=request.getParameter("last_name")%>', '<%=request.getParameter("address")%>', '<%=request.getParameter("post_code")%>', ', '<%=request.getParameter("email")%>', '<%=request.getParameter("observation")%>') <%-- execute the query--%> I have trieed numerous things no joy why do i recieve a null value. Cheers Chuck -- The views expressed by the sender of this message don't necessarily represent those of Brecon Beacons National Park Authority. This message is intended for the addressee(s) only and is sent in confidence; if you receive it in error, please can you let us know (at [EMAIL PROTECTED]) and then destroy all copies. Nid yw'r farn a fynegir gan anfonwr y neges hon o anghenraid yn adlewyrchu barn Awdurdod Parc Cenedlaethol Bannau Brycheiniog. Neges yw hon a fwriadwyd ar gyfer y derbynnydd/derbynyddion yn unig ac fe'i hanfonir yn gyfrinachol; os ydych yn ei dderbyn mewn camgymeriad, a fyddech gystal â rhoi gwybod i ni (yn [EMAIL PROTECTED]) ac yna dilëwch bob copi.
Re: '<%=request.getParameter("app_code")%> - no value
Sorted Myself Cheers if looking at it. Chuck Amadi wrote: > > Hi, I have exstablished a connection and all but app_code values appear > in my Postgresql Database. > The app_code is A UNQIUE value that is required thru the process . I > have a jsp called planningdb that selects the following and displays the > values from the Database. Thus i have a html tag that > submits the value app_code to my jsp Submit Comments form. Thus the > user enters the details as follows. > > (first_name, last_name, address, post_code, email, observation) Note > app_code is a request method. <%=request.getParameter("app_code")/> the > app_code number is displayed in the both planningdb jsp and submit jsp. > except the processform (that im about to modify to a viewForm and use > struts way of thinking and thus return any errors back to the submit > form. > > and comments about the planning application and above the Submit > Comments form there is a <%=request.getParameter("app_code")- all the > html input tags are able to send values to > > > select app_code, app_date, application_agent, grid_ref , location, > community, proposal,comment from planning_application order by 8 > > > Thus processform.jsp works(<%=request.getParameter("app_code")/> I > always get a null value i have used the request method at the top of the > processform to see what it picks up ( null) from the jsp Submit > Comments Form. > > > insert into comments (first_name, last_name, address, post_code, > app_code, email, observation) > values > ('<%=request.getParameter("first_name")%>', > '<%=request.getParameter("last_name")%>', > '<%=request.getParameter("address")%>', > '<%=request.getParameter("post_code")%>', > ', > '<%=request.getParameter("email")%>', > '<%=request.getParameter("observation")%>') > > <%-- execute the query--%> > > > > I have trieed numerous things no joy why do i recieve a null value. > > Cheers Chuck > -- > The views expressed by the sender of this message don't > necessarily represent those of Brecon Beacons National Park > Authority. This message is intended for the addressee(s) only > and is sent in confidence; if you receive it in error, please can you > let us know (at [EMAIL PROTECTED]) and then destroy all copies. > Nid yw'r farn a fynegir gan anfonwr y neges hon o anghenraid yn > adlewyrchu barn Awdurdod Parc Cenedlaethol Bannau Brycheiniog. > Neges yw hon a fwriadwyd ar gyfer y derbynnydd/derbynyddion > yn unig ac fe'i hanfonir yn gyfrinachol; os ydych yn ei dderbyn > mewn camgymeriad, a fyddech gystal rhoi gwybod i > ni (yn [EMAIL PROTECTED]) ac yna dilwch bob copi. -- The views expressed by the sender of this message don't necessarily represent those of Brecon Beacons National Park Authority. This message is intended for the addressee(s) only and is sent in confidence; if you receive it in error, please can you let us know (at [EMAIL PROTECTED]) and then destroy all copies. Nid yw'r farn a fynegir gan anfonwr y neges hon o anghenraid yn adlewyrchu barn Awdurdod Parc Cenedlaethol Bannau Brycheiniog. Neges yw hon a fwriadwyd ar gyfer y derbynnydd/derbynyddion yn unig ac fe'i hanfonir yn gyfrinachol; os ydych yn ei dderbyn mewn camgymeriad, a fyddech gystal â rhoi gwybod i ni (yn [EMAIL PROTECTED]) ac yna dilëwch bob copi.
How do i pass a constant <%=request.getParameter(" ")%> to Db
Hi , I have created a submitForm.jsp that has a value parameter named app_code that is a unique value from my PostgreSql Database. from a select from my planningdb.jsp. The app_code - is required throughout the process.(This is the Planning Application Reference) select app_code, app_date, application_agent, grid_ref , location, community, proposal,comment from planning_application order by 8 retrieves the app_code ( this works). In the submitForm.jsp we have <%=request.getParameter("app_code")%> This inserts the unique app_code ie p12121 within the submitForm.jsp, again this works. Thus on submitting all the other html input user values ie These value are passed to the proceessForm.jsp to my Database table (observe)and works fine except that app_code that is <%=request.getParameter("app_code")%> this appears in my Database as a null value. The processForm.jsp insert into observe (first_name, last_name, address, post_code, app_code, email,observation) values ('<%=request.getParameter("first_name")%>', '<%=request.getParameter("last_name")%>', '<%=request.getParameter("address")%>', '<%=request.getParameter("post_code")%>', '<%=request.getParameter("app_code")%>', '<%=request.getParameter("email")%>', '<%=request.getParameter("observation")%>') <%-- execute the query--%> Thus 1) how do i get the <%=request.getParameter("app_code")%> to work. Thus 2) I have a copy of my submitForm.jsp and i am trying to invoke tag to my current form. Thus am i on the right line for input values , but how do i invoke the app_code. User input values - app_code to be constant - Sorry if a bit long albiet i need to make progress as this needs to be modified to struts-stubs as i am working to migrate to that example as it has all the elements. Cheers Chuck -- The views expressed by the sender of this message don't necessarily represent those of Brecon Beacons National Park Authority. This message is intended for the addressee(s) only and is sent in confidence; if you receive it in error, please can you let us know (at [EMAIL PROTECTED]) and then destroy all copies. Nid yw'r farn a fynegir gan anfonwr y neges hon o anghenraid yn adlewyrchu barn Awdurdod Parc Cenedlaethol Bannau Brycheiniog. Neges yw hon a fwriadwyd ar gyfer y derbynnydd/derbynyddion yn unig ac fe'i hanfonir yn gyfrinachol; os ydych yn ei dderbyn mewn camgymeriad, a fyddech gystal â rhoi gwybod i ni (yn [EMAIL PROTECTED]) ac yna dilëwch bob copi.
Re: How do i pass a constant <%=request.getParameter(" ")%> to Db
Hi all i have sorted out the missing value app_code.Cheers if you've being looking at it. Planning Application Code Number:<%=request.getParameter("app_code")%>"> It mat not look good but it works , thus i can go on to using tag instead of html tags. Chuck Amadi wrote: > > Hi , I have created a submitForm.jsp that has a value parameter named > app_code that is a unique value from my PostgreSql Database. from a query/> select from my planningdb.jsp. > > The app_code - is required throughout the process.(This is the Planning > Application Reference) > > > select app_code, app_date, application_agent, grid_ref , location, > community, proposal,comment from planning_application order by 8 > > > retrieves the app_code ( this works). > > > > > > > In the submitForm.jsp we have <%=request.getParameter("app_code")%> > This inserts the unique app_code ie p12121 within the submitForm.jsp, > again this works. > > Thus on submitting all the other html input user values ie type="text" name="first_name" align ="center"> These value are passed to > the proceessForm.jsp to my Database table (observe)and works fine except > that app_code that is <%=request.getParameter("app_code")%> this appears > in my Database as a null value. > > The processForm.jsp > > insert into observe (first_name, last_name, address, post_code, > app_code, email,observation) > values > ('<%=request.getParameter("first_name")%>', > > '<%=request.getParameter("last_name")%>', > '<%=request.getParameter("address")%>', > > '<%=request.getParameter("post_code")%>', > '<%=request.getParameter("app_code")%>', > '<%=request.getParameter("email")%>', > > '<%=request.getParameter("observation")%>') > > <%-- execute the query--%> > > > > Thus 1) how do i get the <%=request.getParameter("app_code")%> to work. > Thus 2) I have a copy of my submitForm.jsp and i am trying to invoke > tag to my current form. Thus am i on the right line for > input values , but how do i invoke the app_code. > > User input values - > > > app_code to be constant - > > > Sorry if a bit long albiet i need to make progress as this needs to be > modified to struts-stubs as i am working to migrate to that example as > it has all the elements. > > Cheers Chuck > -- > The views expressed by the sender of this message don't > necessarily represent those of Brecon Beacons National Park > Authority. This message is intended for the addressee(s) only > and is sent in confidence; if you receive it in error, please can you > let us know (at [EMAIL PROTECTED]) and then destroy all copies. > Nid yw'r farn a fynegir gan anfonwr y neges hon o anghenraid yn > adlewyrchu barn Awdurdod Parc Cenedlaethol Bannau Brycheiniog. > Neges yw hon a fwriadwyd ar gyfer y derbynnydd/derbynyddion > yn unig ac fe'i hanfonir yn gyfrinachol; os ydych yn ei dderbyn > mewn camgymeriad, a fyddech gystal â rhoi gwybod i > ni (yn [EMAIL PROTECTED]) ac yna dilëwch bob copi. -- The views expressed by the sender of this message don't necessarily represent those of Brecon Beacons National Park Authority. This message is intended for the addressee(s) only and is sent in confidence; if you receive it in error, please can you let us know (at [EMAIL PROTECTED]) and then destroy all copies. Nid yw'r farn a fynegir gan anfonwr y neges hon o anghenraid yn adlewyrchu barn Awdurdod Parc Cenedlaethol Bannau Brycheiniog. Neges yw hon a fwriadwyd ar gyfer y derbynnydd/derbynyddion yn unig ac fe'i hanfonir yn gyfrinachol; os ydych yn ei dderbyn mewn camgymeriad, a fyddech gystal â rhoi gwybod i ni (yn [EMAIL PROTECTED]) ac yna dilëwch bob copi.