Win a copy of Cloud Native PatternsE this week in the Cloud forum
or Natural Language Processing in the AI/ML forum!

frank sun

Ranch Hand
+ Follow
since Apr 11, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by frank sun

I have a question about JSF.
the below is the operation flow description.

Page A: click "create" button, the system calls the service to create a record and then forward to the newly created record Page B, for user to add more information of this newly created record.

Page B: has a link, when being clicked, it pops up a new window, Page C, and the Page C accept the parameters from the Page B, user fills in some data and click the "save" button in Page C, the window(Page C) closes itself. meantime, the Page B should refresh itself to show the data created in Page C.

My way to solve this problem is: in Page B, when user click the Link to pop up the Page C, it will call a javascript function to open the Page C, like this:
but, when the user click "save" in Page C to save the data in Page C and close itself, the Page B should refresh itself. How to implement it?

regards!
13 years ago
JSF
This problem was solved after I replaced the myfaces 1.0.9m with myfaces 1.1.0.
I thought it is the bug of myfaces which in version 1.0.9 while solved in version 1.1.0.

By the way, as to this problem, it costed me hours trying to figure it out, but no surprise rising, until the simple and easy replacement with the new myfaces version. that's a big lesson for me.
[ September 22, 2005: Message edited by: frank sun ]
13 years ago
JSF
I am using the Myfaces1.0.9m, and tomcat 5.0.30.
I am trying to download a file from the server, the user can download the
file by clicking the link and it will trigger an event, the Backing bean
handles the event and get the file stream data, and send to the response.

I don't want the page to navigate to other pages.
the jsp code:


the backing bean method:

I can open the downloaded file, but the server console throws me the
exception as below. and anything else looks fine except this.
Please help me on this, I have been researching on this error many hours.
Any of your information of tips or solution will be greatly appreciated.

the below is the exception message.

StandardWrapperValve[Faces Servlet]: Servlet.service() for servlet Faces Servlet threw exception
java.lang.IllegalStateException: Cannot forward after response has been committed
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:324)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312)
at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:405)
at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:280)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:300)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:110)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at catalog.view.util.SecurityFilter.doFilter(SecurityFilter.java:70)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.springframework.orm.hibernate.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:172)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:534)
[ September 22, 2005: Message edited by: frank sun ]
13 years ago
JSF

Originally posted by Billy Tsai:
can I use notepad in windows to write choices.txt and version.txt because I dont know how to put diagram in there with notepad?
please help


I prefer to use ultraedit, or editplus to edit the document.
----------------------------------------
Hi, Mark, Thanks for your great job!
Frank Jun 25,2003
16 years ago

Originally posted by Richard Jackson:
I've two problems:
1)How to do to"lock a resource that is already locked should cause the current thread to give up the CPU"?
2)And how to do ... "local database is to be used, in which case, the networking must be bypassed entirely"?


the first one, if one record is being locked, you have to wait the lock to be released, and try to obtain the opptunity to lock that record, you can use wait/notify mechanism to implement it.
the second one, in standalone mode, you can not use the serized approach to access the objects, that means, you can not depend on the RMI to do that in this mode.
Hope that help.
Frank. Jun 25,2003
[ June 25, 2003: Message edited by: frank sun ]

Originally posted by Billy Tsai:
did you include any diagrams in ur documentation?


Yes, I drew the general structure of the design in the design document.
----------------------------------------------
H, TQ,
Thanks a lot! I learned a lot from you.
Frank Jun 24,2003
16 years ago

Originally posted by Billy Tsai:
Hi
how long did you wait after you took ur written exam?
btw in Deliverables section in the instruction where it says
When you submit your assignment, each part (client and server) must be executable using a command of this exact form:
java -jar <path_and_filename> [<mode>]
do we need the [] for mode? did u have it for ur program?
eg java -jar runme.jar [server] or java -jar runme.jar server to start the server program
and java -jar runme.jar [] or java -jar runme.jar to start the client program
???

becase I am using java -jar runme.jar server
without the []
so which one MUST we use?
the [] around the mode or no []


1. I ignore the [] in the command line.
2. 10 days after taking the essay exam I got the result
Regards!
Frank Jun 23,2003
[ June 23, 2003: Message edited by: frank sun ]
[ June 23, 2003: Message edited by: frank sun ]
16 years ago

Originally posted by damu liu:
hi, sun
Congratulations!
BTW, what structure is your MVC?
Regards,
Damu
[ June 23, 2003: Message edited by: damu liu ]


Hi, Liu
The structure of the MVC:
1. 2 GUI, one for user search/book, the other one for configuration.
2. a event controller
3. a model, calls the methods in the server(remote and local)
Hopes help.
Frank Jun 23,2003
16 years ago

Originally posted by Andrew Monkhouse:
Hi Frank.
Good score! Congratulations.
Regards, Andrew


Hi, Andwew
I know you are one of my best supporters, really thanks!
Frank Jun 23,2003
16 years ago
This is a great place for our java developers, I have to give my thanks to many people here.Mark, TQ, Andrew......, I cannot imagine what the result would be without your kind help.
Best regards!
---------------------------------------------
It's the score detail:
Grade: P
Score: 369
Comment: This report shows the total 1.4 SCJD points that could have been awarded in each section, and the actual number of points you were awarded. This is provided to give you per-section feedback on your strengths. The maximum possible score is 400; the minimum to pass is 320.
General Considerations (maximum = 100): 94
Documentation (maximum = 70): 70
O-O Design (maximum = 30): 30
GUI (maximum = 40): 37
Locking (maximum = 80): 58
Data store (maximum = 40): 40
Network server (maximum = 40): 40
16 years ago
Hi,Andrew
Thanks, I think I will add some statements in the user guide in the section of [Parameters configuration] : the host name must begin with an alpha character.
Thanks!
Frank

Originally posted by Andrew Monkhouse:
Hi Frank,
Yep, just put your modifications into my code, and ran it under JDK 1.4.0 on Linux - worked without problems.
I agree it is weird.

Do you have computers with hostnames like this?

i am not going to worry about it - I dont think we should have to cater for this in our assignments.
Regards, Andrew


I am not sure all the computer's name do not start with a number.
The following is my finding on this problem, for your reference.
In the source code of java.rmi.Naming, it parses the argument of name in rebind and lookup:
URI uri = new URI(str)
and, uses this statement to get the Host and Port:

String host = uri.getHost();
int port = uri.getPort()

You can just test the argument of str in the constructor of URI.
when you input the str as "//1234A:2003/name", or any other
simular string with that, but only limits the host name starting with number.
the result of uri.getHost() always return null, and uri.getPort() always returns -1.
I think that's why the host name should not start with a number.
the below is from the comment of the getHost() in java.net.URI,It limits the name must begin with an alpha char.
A domain name consisting of one or more labels separated by period characters ('.'),
optionally followed by a period character. Each label consists of alphanum characters
as well as hyphen characters ('-'), though hyphens never occur as the first or last
characters in a label. The last, or only, label in a domain name begins with an alpha character.
So, I guess I have to stop to look for the trouble by myself on this problem.
But I still wonder should I specify this in the user guide, what's your suggestion?
Regards!
Frank
[ May 27, 2003: Message edited by: frank sun ]

Originally posted by Andrew Monkhouse:
Hi Frank,
Sorry, no can do. My schedule this week is very tight (including submitting today / tomorrow and doing the exam on Thursday), and I leave for a weeks holiday on Saturday, so I have no room for slipage, and no spare cycles to look into this.
Good luck with it.
Regards, Andrew


Thanks Andrew,
Congratuation in advance!
---------------------------------------------
The below is your code snippet of FrankRmi, I just
modified slightly.

---------------------------------------------
You'll find that it can run without any error.
that's what I wonder!
thanks!
Frank
Thanks Andrew,
The below is my snippet code of service binding and lookup.
I guess there are no "//", ":", "/", in your argument of name in rebind() and lookup(), that's why they cannot run.(not sure)


-------------------------------------------------
I debug the java source of java.rmi.Naming, when I pass the argument of name of the rebind(), it parses all the host, whose name starts with number(not the IP), as an empty string.
I think that's why the above freak thing happens.
Here is the code snippet in java.rmi.Naming from the java source:

it parses the argument(service name) into this method, and it always prints out an empty string when the host name starting with number.
-----------------------------------------------
And, if sets the computer name starting with number, say "1234AB", and it only permits to use the port of 1099 to start up.
I did test these situation.
I am trying to look into the source of java.net.URI.
So, could you help to deep into the java source code to find the truth with me?
Best regards!
Frank
[ May 26, 2003: Message edited by: frank sun ]
[ May 26, 2003: Message edited by: frank sun ]
Hi, all
If sets the host name with a string starting number format , you can bind the service on any computer,and if running the RMI client on the same computer with server, you can set the host name with any other digital number format string to lookup. (the server port must be 1099)
the below is the detail, you could read the bold words only.
the signature of rebind in java.rmi.Naming is:
public static void rebind(String name, Remote obj) throws RemoteException, MalformedURLException
Comments:
name - a name in URL format (without the scheme component)
MalformedURLException - if the name is not an appropriately formatted URL
the signature of lookup in java.rmi.Naming is:
public static Remote lookup(String name) throws NotBoundException, MalformedURLException, RemoteException
Comments:
name - a name in URL format (without the scheme component)
MalformedURLException - if the name is not an appropriately formatted URL

Let's see this condition : ( server and client Running on the same computer)
1. sets the parameter of name in rebind with "1111"(or "1111A") , and any available port, and startup the server,
2. sets the parameter of name of in lookup with "2222"(or "2222B"), and any available port, starts up the client
3. freakly, the client can connect to the server and do any query and other operations.
4. and, if sets the host with the remote host name of IP address in remote or local client, it can connect to the server.
Please note, the server binds a different name from the name of lookup!!!
** of course, if the server sets the bind name with the local host name of IP, the remote clients can only use the host name or IP of the remote server to connect to, but the local client can use any name starting with number.
You will find that the application runs normally, I wonder:
1: the parameters of name in rebind and lookup should be a valid computer name/IP, right?
2: if parameters of name not a host, the server starts up in a local mode, and does not accept LAN request, only accept the local client request, even the binded name differs from the lookup name right?
3: since the server has the different binded name from the lookup name, why the server can accept the request?
3: are there any other similar situation like that?
4: should I specify this situation in the user guide or design choices?

In a word, if the server binds to a name with number start(eg,"12",or "12A"), the local client can connect to it with any other host name(eg,"23",or "34A"), even different port; but the remote client can use the server's host name or IP and the same port to connect to the server. the prerequisite is: the server port must be 1099, otherwise, all these freak things won't show up.

Please, I am crazy about that.
Regards!
Frank
[ May 26, 2003: Message edited by: frank sun ]