Roberto Hernandez

Ranch Hand
+ Follow
since Apr 29, 2009
I'm a Java Developer currently working in San Antonio TX.
I was born and raised in Mexico. My family migrated to the U.S. in 1998.

I graduated from the University of Texas - Pan American.
San Antonio
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Roberto Hernandez

I have tried the suggestion posted above and it didn't work for me. I get the following

8 years ago
Hi All,
This is the code that I'm trying to convert to Hibernate. I'm fairly new to Hibernate so please bear with me.

the dao.insertApplication() returns the generated key as a String (appKey) because it will be a foreign key in the next insert of this transaction (dao.insertAppModuleInfo), and the generated key (moduleKey) will also serve as a foreign key for dao.insertModuleFunctionality() and dao.ModuleBusArea(). Am I making myself clear? There's probably a better way to do this in hibernate, I just don't know how. I'm hoping you all can help.
I'm inserting records in the database but I need to know how I can return the generated key using Hibernate. I'm currently using prepared statement to return the key as a string:

After the query is executed, I use this code to return back the generated key for the record I just inserted

I need to be able to do the same thing with Hibernate but I don't know how. Can anyone please help???

Thanks David, I thought about that too but I'm not really sure I've messed around with GlassFish settings. I'll investigate even further and will post again once I find the solution
8 years ago
Ok, here's my dilema,
I have an Struts2 application running on a GlassFish server. Everything runs just fine, but the problem that I have is configuring the logging levels using log4j. Every time I submit a request, my console gets a a ton of messages and the server.log file is getting rotated frequently because the logs get full rapidily. I've tried to decrease the log levels for some of the packages in struts 2 but nothing seems to work

Here's my

Does anyone know what I can do to stop all these messages from appearing in my logs. I just want error messages not bunch of debugs and info, warnings.
I've tried a lot of things but now I don't know what to do

Does the fact that I have both commons-logging.jar and lo4j.jar in my lib have anything to do with this? As far as I know Struts2 uses commons-logging but I would think that they can both work independently???
Please help

Here's a snippet from my console
8 years ago
I'm not very familiar with the struts2 framework yet, so I need your help on this scenario.
I have a form in a jsp with 15 fields. Once I submit the form, the request is passed on to the action and my question is "How do you get a hold of those fields (values).
I have read in many tutorials that you have to use getters and setters for each field and that works, but I think it's kind of cumbersome to do this for each form that I have because the same form fields will be used in multiple forms throughout the application and I don't want to have the same getters and setters declared in multiple places.

Is there a way to avoid this? Please please help!!!
8 years ago
Hi, I'm using the Struts 2 Dojo Plugin and I'm trying to expand a tree widget with dojo. After the user saves the data, the tree widget is destroyed and re-loaded in it's pane, but I'm trying to expand the node the user was working with after it finishes loading.
I've tried publishing and listening to an event among other things but can't figure it out.

Is it possible to make dojo wait until a widget is fully loaded? I've tried dojo.addOnLoad() but nothing. Please help!!!
If you're using struts2 you could use the struts2 dojo plugin and then you'll just have to declare it using <sx:textarea>. It's very simple and straight forward.
9 years ago
You would have to invoke a javascriipt function to submit your form

then in your button, declare an onclick attribute:

make sure you give your form a "Name" and "Id" that way you can get the form element
9 years ago
Try building a collection in your Servlet or Action

Now, in your JSP, add the forEach loop

9 years ago
Try something like this:
<c:forEach begin="1" end="10" items="${param.tier} var="tier" >

I don't know if param.tier will work as a collection. If it doesn't, you could use something like ${requestScope.tier}. Give it a try
9 years ago
Use JSTL instead of scriptlets
Try the following:
var str = "${crid}";

make sure JSTL taglib is declared before using it inside <script> tags
9 years ago
How is preventCache the problem here? That message doesn't even mention any error produced by using preventCache.
preventCache is just a parameter passed in the url.

Use Firebug to see what it prints out, that should help you.
9 years ago
As far as I know, there's not an easy way to do that once the page has been rendered. What you could do if you really want to have large textboxes is to get the size of your string and then pass that number as a parameter to the JSP, that way your textbox will always be big enough for your string:
For instance:

Your number could be smaller/bigger than the text length and you can play around with it until you get it right. But I'm pretty sure you can figure that out.

"Sorry, I misunderstood your problem. You're saying you want to resize the textbox as you type the string. That's more complex. The example above only applies when you already have a string coming from the request."
9 years ago
I agree with David that all complex operations should be handled in Java classes. Also, don't use scriptlets in JSP, use JSTL tags for cleaner code. If you really need to catch an exception in a JSP, you can use JSTL c:catch tag.
For example:
9 years ago