I was trying to update multiple columns in the mysql database. Mysql database did not report any issue with my syntax , it even executed it successfully - but it actually did not update even a single field in the database. The problem was using 'and' in updating multiple columns. It even passes mysql validation for a well-formed query.
Here is an example:
Update query (which executed successfully but does not do anything)
update documents
set doc_blob_content=null
and doc_type='try'
and doc_name='try'
and doc_content_type='try'
and doc_size='123'
and last_updated_by='sujie'
and last_updated_date='2009-08-28 21:52:01'
where task_id=7458
To get the above to work, replace all 'with ','
update documents
set doc_blob_content=null,
doc_type='doc',
doc_name='new',
doc_content_type='pdf',
doc_size=1,
last_updated_by='nkdf',
last_updated_date='2008-08-28 21:52:01'
where task_id=7458
Friday, 28 August 2009
Using form method post while the enctype is multipart/form-data
Today I found an interesting issue while working with HTML forms, XSLT and Servlets. I have a file upload button and my form enctype is "multipart/form-data".
Though I tried to submit the form, I was never able to retrieve the form variables in my servlet. This was running me real mad as i cross verified that my form is submitted.
I tried changing the form method to "get" and it all started working. There seems to be an issue with html in general - if the form enctype is multipart , then you have to pass all parameters in URL ( in other words - using get)
Though I tried to submit the form, I was never able to retrieve the form variables in my servlet. This was running me real mad as i cross verified that my form is submitted.
I tried changing the form method to "get" and it all started working. There seems to be an issue with html in general - if the form enctype is multipart , then you have to pass all parameters in URL ( in other words - using get)
Wednesday, 26 August 2009
JBPM and JSF file upload
I am currently using JBPM 3.2.1 and JSF for a project for British Airways. JSF is the default expression language supported by JBPM and it was decided to go for it ( by my ancestors in the company). They did not realise how wrong they were. JSF is a very less intuitive language and surrounded by the JBPM process engine it almost is extremely restrictive.
Today i wanted to include a file upload button in one of the task forms for JBPM. Sounds very simple -innit? but it is really not. JSF does not support file upload functionality and you have to use a custom file upload component ( if you want some of the inbuild functionality). I went for the most popular choice "the myFaces" input file upload component.
Follow this article on how to setup your environment and configurations.
http://balusc.blogspot.com/2008/02/uploading-files-with-jsf.html
I did all that , but my uploadedFile was always passed as null. I had to put this h:form inside my jbpm:dataform and it chokes the whole system. I could not get much help on the internet as JSF is kind of deprecated(!!!) by the JBPM architects and they have followed SEAM in all new implementation. So there are no javadocs, no tutorials..nothing!!!. I was kind of stuck up as to how to proceed on this. I will post my experience very soon!!. bye for now..
Today i wanted to include a file upload button in one of the task forms for JBPM. Sounds very simple -innit? but it is really not. JSF does not support file upload functionality and you have to use a custom file upload component ( if you want some of the inbuild functionality). I went for the most popular choice "the myFaces" input file upload component.
Follow this article on how to setup your environment and configurations.
http://balusc.blogspot.com/2008/02/uploading-files-with-jsf.html
I did all that , but my uploadedFile was always passed as null. I had to put this h:form inside my jbpm:dataform and it chokes the whole system. I could not get much help on the internet as JSF is kind of deprecated(!!!) by the JBPM architects and they have followed SEAM in all new implementation. So there are no javadocs, no tutorials..nothing!!!. I was kind of stuck up as to how to proceed on this. I will post my experience very soon!!. bye for now..
Tuesday, 25 August 2009
Parameter passing in JSF
I have just started working on JSF but I have to admit that it is really less intuitive. Today I was trying to pass some parameters from my JSF to a bean. I had to do quite a research to get it done. I remember how easy it is to pass and get parameters if you use servlets. But I had to stick with JSF as we JBPM/Gravel and the default expression language supported by JBPM is JSF and all the existing code is written in JSF. it is not a straight forward programming language and is restrictive but I liked the challenge to get things done :).
Here are some code snippets on how to pass parameters. Definitely will come in handy for anybody who experiments in this area.
If you want to set some variables or do some actions when user clicks on a commandlink here is how you do it: I am passing the transition name and i am setting the transitionName variable in my taskBean
Based on the transition, I want to be able to set the url for navigation..so if the transition name is for example, reject I need to go to the next screen where you can enter the reject reason..or else I go myportal.jsf in my case. You do all this when the action event taskBean.action is called when the commandlink is clicked.
I found this excellent article with different ways to pass parameters. It almost covers every single way of accessing and passing variables.
http://balusc.blogspot.com/2006/06/communication-in-jsf.html
Here is another basic example:
http://kalanir.blogspot.com/2006/11/parameter-passing-in-jsf_5752.html
Here are some code snippets on how to pass parameters. Definitely will come in handy for anybody who experiments in this area.
If you want to set some variables or do some actions when user clicks on a commandlink here is how you do it: I am passing the transition name and i am setting the transitionName variable in my taskBean
<h:commandLink id="transition#{rid}" style="display:none; visibility: hidden;" action="#{taskBean.action}">
<f:setPropertyActionListener target="#{taskBean.transitionName}" value="#{transition.name}" />
</h:commandLink>
Based on the transition, I want to be able to set the url for navigation..so if the transition name is for example, reject I need to go to the next screen where you can enter the reject reason..or else I go myportal.jsf in my case. You do all this when the action event taskBean.action is called when the commandlink is clicked.
<n:nav outcome="success" url= "#{taskBean.url}" storeMessages="true"/>
I found this excellent article with different ways to pass parameters. It almost covers every single way of accessing and passing variables.
http://balusc.blogspot.com/2006/06/communication-in-jsf.html
Here is another basic example:
http://kalanir.blogspot.com/2006/11/parameter-passing-in-jsf_5752.html
Labels:
actionListerner,
commandLink,
JSF,
JSF action,
JSF parameters
Subscribe to:
Comments (Atom)
Welcome to Planet-Sujie!!
Here you can view technical articles, challenges and solutions and some of my BLOGS.