Hernan Blanco

Greenhorn
+ Follow
since Aug 23, 2010
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 Hernan Blanco

Thanks! I supossed that it's a CSS issue because is only representational, not semantical.
Here my question: is there any way to define a table with a <thead> not at the top of the table, but at the left (or right) side? if not, is there any css mechanism to convert the table, like a kind of rotation?

Thanks!
Hernán.
Of course, you are right once more... redifining the estructure of the projec was sufficient (I had a very basic structure because those are my firsts steps with the project). Anyway, maintaining the relatives URLs in the project (mainly in <c:import> tags) seems to be so difficult, as the project grows with the time.

Thank you!
Hernán.
10 years ago
JSP
I'm doing that you said, trying to implement a friendly URL pattern in my application. I'm doing it with a Filter that parses the URL into attributes and then forwarding to the servlet.

But now, my problem is different. I added it in my web.xml:


When a JSP is loaded, it tries to download some JavaScript and CSS files, like that:


So the script or stylesheet requests will pass another time across the filter, because the <url-pattern> is "/*". I was thinking in a solution for that (defining another filter, using differents url-patterns...) but I don't know what is the most correct and easy way to solve it. Can anyone help me?

Hernán.
10 years ago
JSP
Thank you for the answer!

Yes, I already knew that's not professional using the word "servlet" in the URL, it was only for illustrate the example. I heard something about REST, I will take your advice and take a look about this!

Hernán.
10 years ago
JSP
Hi!

I'm developing a web application focused in DB managing. For that, I'm trying to be as strict as I could with the MVC model.

I've created some jsp templates for the different objects hold by the DB. e.g, I have a JSP called "competition.jsp" where I show all the details stored about a sport competition. I reach this page from a link, passing as parameter the competition ID to the servlet, which creates a JavaBean with the data from the DB associated with this competition ID and redirect it to the "competition.jsp" in order to show the data. So, in the browser I get a page named "www.example.com/servlet/competition.jsp", which will be the same for all the different competitions.

The problem is that I think having different URLs for different competitions is quite a lot important. I rejected adding a key to the query like "www.example.com/servlet/competition.jsp?id=123", would prefer to have an URL like "www.example.com/servlet/competitions/world-cup.jsp" or "www.example.com/servlet/competitions/world-cup.html", so I thought about generate a new HTML file from the "competition.jsp", calling it "world-cup.html".

It would be a good practice? Which could be the best practice in this case? Remember that I'm using the MVC pattern.


Simplifying, I'm doing something like that at now:

I have a link in a page with a javascript that submit the ID to the servlet:

Then in the servlet, I instantiate a bean with the data from de DB, set it as session attribute and redirect to "competition.jsp":

And finally, I show the data of the competition using JSTL:

Thank you in advance,
Hernán.
10 years ago
JSP
Yes, I agree with you Jimmy. But, quoting myself, I said that:

PS: I know that's not the best way to do an XML file (putting a PCDATA child into an element containing more children), but I'm not the responsable about that specification!



Yes, as I said before, I know that it's not a good practice, but I didn't create the XML specification (he was my professor...), so I have to create the DTD rules that specifies the XML he gave me.



... Beacause this, it isn't a good practice, using the mixed content model: you lose quite a lot of semantic information about the document.



Thanks!
Yes, as I said before, I know that it's not a good practice, but I didn't create the XML specification (he was my professor...), so I have to create the DTD rules that specifies the XML he gave me.

I had used the mixed content model in some cases, but it can be used when applying an 'or' rule at the DTD, and it isn't the case. However, reading the pages you gave me, I had an idea, doing that:



But I still getting an error. So I tried deleting the tagTwo tag:



and also deleting it from the xml:



And it worked fine. So, I realized that you can't nest the mixed content like I tried before. Beacause this, it isn't a good practice, using the mixed content model: you lose quite a lot of semantic information about the document.

Thank you so much!
Error at 12:10 The content of element type "tagOne" must match "(tagTwo,PCDATA?,tagThree)".

The error isn't very explicit. Another validator throws:

Element tagOne content does not follow the DTD, expecting (tagTwo , PCDATA? , tagThree), got (tagTwo CDATA tagThree )

Paul Clapham wrote:I'm not very good with DTD either, so could you explain why you used "PCDATA" in one place and "#PCDATA" in the other places? Do they mean different things?



I'm not sure... At first, I've used #PCDATA? but validators threw an error at the DTD, then I tried changing that and validators didn't throw DTD errors... but yes XML errors.
Hi! I'm a beginner about XML and DTD... I'm trying to design a films catalog, but I'm getting an error when I do something like that:



Validators throws an error when I put a PCDATA as child of an element containing more than one children (e.g. tagOne). Why is happening that, and how can I resolve it?

PS: I know that's not the best way to do an XML file (putting a PCDATA child into an element containing more children), but I'm not the responsable about that specification!

Thanks in advance.
OMG! I had checked and rechecked my code and I didn't find the error! (I was looking for any more complex...).

Setters of idInvocacion and idMetodo wasn't in the correct way.

Thanks a lot!!
10 years ago
I've written another topic but I made a mistake with the explanation and also with the title of the topic, so I'll try once more now!

I'm doing a client-server application. The Client send data contained into a Mensaje object (previously serialized with a DataOutputStream) using a DatagramSocket. The server recieves the datagram and dumps the byte array to a new Mensaje object using a DataInputStream (that's the goal of the getRequest() function); then it processes the information, and, finally, it sends the response to the client. The communication is not the problem, it works fine.

So, to simplify, I didn't add the communication module: I'm only giving to you a function called getRequest() that recieves as argument a Mensaje object, which should be modified. To simplify, I didn't add the communication module, so, into the getRequest() function I'm simulating that server recieves a byte array (called buffer) from line 20 to 30. Then, from 32 to 41, the server retrieves data from buffer, and represents it on screen. After that, coming back to main() function, the Mensaje object data is once more time printed on screen.

Now, I will paste a simplified code that represents my problem.


Sample.java



Mensaje.java


The results thrown running Sample are:

During getRequest():
tipoMensaje = 0
idInvocacion = 0
idMetodo = 0
longArgumentos = 13
argumentos = [B@7c6768

After getRequest():
tipoMensaje = 0
idInvocacion = 0
idMetodo = 0
longArgumentos = 13
argumentos = [B@7c6768


But I don't understand why is it hapenning, beacause at the getRequest() invocation, I've setted tipoMensaje = 1 and idInvocacion = 1, so I was expecting the next results:

During getRequest():
tipoMensaje = 1
idInvocacion = 1
idMetodo = 0
longArgumentos = 13
argumentos = [B@7c6768

After getRequest():
tipoMensaje = 1
idInvocacion = 1
idMetodo = 0
longArgumentos = 13
argumentos = [B@7c6768


I don't either understand why longArgumentos and argumentos are correcty setted and tipoMensaje and idInvocacion not.

Thanks in advance!
Hernán.
10 years ago
OK. I was trying to sintetize my question as much as possible, but it seems that I wasn't explicit enough. So now I will go to specify better the situation.

I'm doing a client-server application. The Client send data contained into a Mensaje object (previously serialized with a DataOutputStream) using a DatagramSocket. The server recieves the datagram and dumps the byte array to a new Mensaje object using a DataInputStream (that's the goal of the getRequest() function); then it processes the information, and, finally, it sends the response to the client. The communication is not the problem, it works fine.

So, to simplify, I didn't add the communication module: I'm only giving to you a function called getRequest() that recieves as argument a Mensaje object, which should be modified. To simplify, I didn't add the communication module, so, into the getRequest() function I'm simulating that server recieves a byte array (called buffer) from line 20 to 30. Then, from 32 to 41, the server retrieves data from buffer, and represents it on screen. After that, coming back to main() function, the Mensaje object data is once more time printed on screen.

Now, I will paste an (I think...) SCCEE code that represents my problem.


Sample.java



Mensaje.java


The results thrown running Sample are:

During getRequest():
tipoMensaje = 0
idInvocacion = 0
idMetodo = 0
longArgumentos = 13
argumentos = [B@7c6768

After getRequest():
tipoMensaje = 0
idInvocacion = 0
idMetodo = 0
longArgumentos = 13
argumentos = [B@7c6768


But I don't understand why is it hapenning, beacause at the getRequest() invocation, I've setted tipoMensaje = 1 and idInvocacion = 1, so I was expecting the next results:

During getRequest():
tipoMensaje = 1
idInvocacion = 1
idMetodo = 0
longArgumentos = 13
argumentos = [B@7c6768

After getRequest():
tipoMensaje = 1
idInvocacion = 1
idMetodo = 0
longArgumentos = 13
argumentos = [B@7c6768



At now, I think that it's not a problem with passing values to the getRequest() function... Before I got a different problem I think, but I should to solve it now.

Thanks in advance!
Hernán.
10 years ago
Hi! I'm surprised beacause I can't solve (and neither understand) a problem related I think to pass variables to a function.

Basically, I have this scene: a class MyClass containing some variables, and a MainClass where I initialize a MyClass object and I work with it. I need to change the variables into MyClass object obj passed to func, and keep the changes after the func call. The code is shown below:






And the results are:

During func:
obj.a = 1
obj.b = 20
After func:
obj.a = 0
obj.b = 20

¿¿¿??? WTF!! I can't understand that! Actually I'm simplifying the code a lot, but I'm sure that the error comes from here! Can anybody explain why the "a" variable isn't modified and "b" (and "c" too) are?
10 years ago