[JBoss Seam] - Postback/form resubmission detection
by alpheratz-jb
This is probably a FAQ but here goes anyway.
Consider a very simple app (PURE JSF, no pageflows, etc): 1 home page that kicks off to a form that, on successful submission returns to the home page (which redisplays the--now updated--data).
Consider: the user now hits the browser back button and resubmits the data.
The question is...how to handle this in Seam?
I guess that the ultimate answer would be to move to Seam's pageflow mechanism...I have read sect. 4.1.2, etc. and I agreee that for a bigger app, this is the way to go, but for the very simple situation I have here it isn't really worth it.
EXCEPT that I can't get a clear feeling for any alternative.
For example:
http://www.jroller.com/page/cagataycivici/weblog/ispostback_in_jsf
Presents what looks to be a promising solution but to quote: "I just realized that requestParamMap trick won't work when a navigation happens without a redirect. It does not always works."
I read in 4.1.2 that "However, our experience is that in the context of Seam, where there is a well-defined conversational model, backed by stateful session beans, it is actually quite straightforward. Usually it is as simple as combining the use of the @Conversational annotation with null checks at the beginning of action listener methods. We consider support for freeform navigation to be almost always desirable."
Is there an example of this to look at?
I would love some guidance here! I am making no real headway.
On a more high-level note: this seems such a simple thing (and was in struts: saveToken(), etc. [but it nonetheless felt 'unsatisfactory']) Shale has an equivalent s:token tag but that again seems much too low-level for Seam. From my googling for a solution, it would seem that Seam could really help the average Joe Programmer if it implemented a simple solution. My AU$0.02 worth (I'm up in sunny Bribane, Oz).
Thanks in advance! All help is really gratefully appreciated.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3976953#3976953
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3976953
19 years, 7 months
[JBoss Seam] - Re: Tomahawk fileUpload tag
by rlhr
So the tomahawk inputFileUpload tag uses commons-fileupload library.
The uploaded file is uploded and stored either in memory or on the disk as a tmp file.
This is up to the user to write the temporary file into a permanent file.
The FileItem.write(File file) methods will do that but we have to call the write method on the fileItem.
So this is the part that was missing in the wiki (http://wiki.jboss.org/wiki/Wiki.jsp?page=Alternative_FileUpload) for the use of the inputFileUpload tag.
In the upload method of the uploadAction bean, I added to following:
File file = new File("/upload/" + + uploadFile.getName());
|
| ServletRequest multipartRequest = (ServletRequest)facesContext.getExternalContext().getRequest();
|
| if (multipartRequest != null) {
| MultipartRequestWrapper mpReq = (MultipartRequestWrapper)multipartRequest;
| FileItem fileItem = mpReq.getFileItem("uploadForm:uploadFile");
| try {
| fileItem.write(file);
| } catch (Exception e) {
| log.error(e);
| }
| }
|
Which rename the tmp file info the appropriate file.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3976950#3976950
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3976950
19 years, 7 months
[EJB 3.0] - simple ejb3 not binding
by 600114046
Hi, I've created a simple ejb to try out ejb3 on Jboss AS jboss-4.0.4.GA(running on jdk 1.5) but after deploying the three simple classes (code below) into a jar into the {jboss AS home}\server\{server name}\deploy directory it doesn't seem to pick it up. The console doesn't recognise anything as it would if it was an ear file and their is no JNDI bind in the JMX Console -> service=JNDIview -> Global JNDI namespace. Any ideas on what i'm doing wrong??
Thanks
Local interface:
---------------------------------------
import javax.ejb.Local;
@Local
public interface MMAPILocal
{
String echoString(String echo);
}
-----------------------------------------
Remote interface:
-----------------------------------------
import javax.ejb.Remote;
@Remote
public interface MMAPIRemote
{
String echoString(String echo);
}
-----------------------------------------
Implementation bean
-----------------------------------------
import javax.ejb.Stateless;
import javax.persistence.PersistenceContext;
import javax.persistence.EntityManager;
@Stateless
public class MMAPIBean implements MMAPILocal, MMAPIRemote
{
public String echoString(String echo)
{
return "I am echoing : " + echo;
}
}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3976947#3976947
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3976947
19 years, 7 months