K Anshul

Greenhorn
+ Follow
since Oct 20, 2004
Merit badge: grant badges
For More
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 K Anshul

I have a piece of Java code which unzips a zip file. The file names could contain umlauts.



this code is unable to process the umlaut characters and throws IllegalArgumentException error. If there are no umlauts in the file name it works fine.

We are using Java 6 and
http://bugs.java.com/view_bug.do?bug_id=4820807 says it’s a Java bug which is fixed in version 7.

We are unable to use Java7 as it's not yet certified within the organization.

Is there any other way to get around this problem?

Thanks in anticipation.
10 years ago
I have a JSP page with a file selector. User selects a document on this page and submits it to the server which then does some processing with the document.

Below is a code snippet -



when the form is submitted, I have traced this request through Fiddler and noticed that for doc, docx, xls etc the content-type is getting set as application/octet-stream



However for other types, like pdf, txt, png etc it is being set to the correct content-type. Example,


For .doc files, I would have expected it to be set as application/msword but that is not the case. Can someone please help me understand why this is happening and what do I need to do to correct this.

Thanks in anticipation.

Originally posted by Nicholas Cheung:
Since your pages are not going to be reused by different flows, you may simply specify the target Servlet that your form wanna to be submitted to.

And that Servlet can determine which page will be forwarded to after the process.

This can then by pass the usage of Struts.

But still, seems using Struts gives you more flexibility, isnt it?

Nick



Does that mean having 1 controller for each model and view is correct ? And will hard coding the name of view and model in the controller be correct ?

Originally posted by Nicholas Cheung:
So, what's other upcoming stuff?

HF Movie making?

Nick



Looks like so.
http://www.amazon.com/exec/obidos/tg/detail/-/0596007132/qid=1098269810/sr=1-7/ref=sr_1_7/002-9691149-8308017?v=glance&s=books
I think it refers to methods and variables which are generated by the server and which u shouldn't override in ur code.
I am trying to use MVC in my JSP application. For each page I have 3 pages, one for view , one for model and one for controller. Say i have an html form (form1.html) which the user fills and submits. This form goes to the controller (servlet1.java) which calls a java class, Model (model1.java) to perform database operations and business logic and the request is dispathed to the view (jsp1.jsp).
Similarly, If user enters a query to search in form2.html, it goes to servlet2.java which calls model2.java and then dispatches request to jsp2.jsp to display the result to the user.
In this way if I have say 10 forms, then i'll have 10 jsp's , 10 servlets and 10 models, names of each model and view hard coded into the servlet.
I know this is not the right way to do it. So many controllers and hard coded names of servlets and jsps make it look weird. There must be a better way of doing it.
In chapter 14 of HF Servlets & JSP it is mentioned that Struts can be used to solve this problem. But at the moment i can't learn Struts. Is there any way i can use just Servlets and JSP to solve this problem.

From page 55 HF, something like this I am doing in my app



I want to solve this prob without using Struts.